lfs: don't return *wrappedCmd from NewDiffIndexScanner()

This commit is contained in:
Taylor Blau 2017-03-15 14:41:50 -06:00
parent f435f1fa62
commit ce358305e6
2 changed files with 5 additions and 7 deletions

@ -99,19 +99,19 @@ type DiffIndexScanner struct {
// If any error was encountered in starting the command or closing its `stdin`,
// that error will be returned immediately. Otherwise, a `*DiffIndexScanner`
// will be returned with a `nil` error.
func NewDiffIndexScanner(ref string, cached bool) (*DiffIndexScanner, *wrappedCmd, error) {
func NewDiffIndexScanner(ref string, cached bool) (*DiffIndexScanner, error) {
cmd, err := startCommand("git", diffIndexCmdArgs(ref, cached)...)
if err != nil {
return nil, cmd, errors.Wrap(err, "diff-index")
return nil, errors.Wrap(err, "diff-index")
}
if err = cmd.Stdin.Close(); err != nil {
return nil, cmd, errors.Wrap(err, "diff-index: close")
return nil, errors.Wrap(err, "diff-index: close")
}
return &DiffIndexScanner{
from: bufio.NewScanner(cmd.Stdout),
}, cmd, nil
}, nil
}
// diffIndexCmdArgs returns a string slice containing the arguments necessary

@ -105,7 +105,7 @@ func scanIndex(cb GitScannerFoundPointer, ref string) error {
// for in the indexf. It returns a channel from which sha1 strings can be read.
// The namMap will be filled indexFile pointers mapping sha1s to indexFiles.
func revListIndex(atRef string, cache bool, indexMap *indexFileMap) (*StringChannelWrapper, error) {
scanner, cmd, err := NewDiffIndexScanner(atRef, cache)
scanner, err := NewDiffIndexScanner(atRef, cache)
if err != nil {
return nil, err
}
@ -138,8 +138,6 @@ func revListIndex(atRef string, cache bool, indexMap *indexFileMap) (*StringChan
errs <- err
}
cmd.Wait()
close(revs)
close(errs)
}()