From fd73a4dd89b27f6b93875f2748e0f2ac4f41f90d Mon Sep 17 00:00:00 2001 From: Taylor Blau Date: Wed, 2 Aug 2017 13:20:30 -0600 Subject: [PATCH] commands,git: teach NegotiateCapabilities() to to return 'supcaps' --- commands/command_filter_process.go | 4 +++- git/filter_process_scanner.go | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/commands/command_filter_process.go b/commands/command_filter_process.go index a622aaad..3edc5914 100644 --- a/commands/command_filter_process.go +++ b/commands/command_filter_process.go @@ -39,7 +39,9 @@ func filterCommand(cmd *cobra.Command, args []string) { if err := s.Init(); err != nil { ExitWithError(err) } - if err := s.NegotiateCapabilities(); err != nil { + + _, err := s.NegotiateCapabilities() + if err != nil { ExitWithError(err) } diff --git a/git/filter_process_scanner.go b/git/filter_process_scanner.go index 01b15a9d..050e41a4 100644 --- a/git/filter_process_scanner.go +++ b/git/filter_process_scanner.go @@ -98,25 +98,25 @@ func (o *FilterProcessScanner) Init() error { // capabilities given to LFS by the parent, an error will be returned. If there // was an error reading or writing capabilities between the two, an error will // be returned. -func (o *FilterProcessScanner) NegotiateCapabilities() error { +func (o *FilterProcessScanner) NegotiateCapabilities() ([]string, error) { reqCaps := []string{"capability=clean", "capability=smudge"} supCaps, err := o.pl.readPacketList() if err != nil { - return fmt.Errorf("reading filter-process capabilities failed with %s", err) + return nil, fmt.Errorf("reading filter-process capabilities failed with %s", err) } for _, reqCap := range reqCaps { if !isStringInSlice(supCaps, reqCap) { - return fmt.Errorf("filter '%s' not supported (your Git supports: %s)", reqCap, supCaps) + return nil, fmt.Errorf("filter '%s' not supported (your Git supports: %s)", reqCap, supCaps) } } err = o.pl.writePacketList(reqCaps) if err != nil { - return fmt.Errorf("writing filter-process capabilities failed with %s", err) + return nil, fmt.Errorf("writing filter-process capabilities failed with %s", err) } - return nil + return supCaps, nil } // Request represents a single command sent to LFS from the parent Git process.