move git ls-tree invocation to git package using gitNoLFSBuffered

The only side effect of this refactoring should be that the Git LFS
is disabled for the Git subprocess. No other functional changes are
intended.
This commit is contained in:
Lars Schneider 2017-08-21 12:16:10 +02:00
parent aba51b679a
commit de8ece9cd4
2 changed files with 13 additions and 8 deletions

@ -182,6 +182,17 @@ func LsRemote(remote, remoteRef string) (string, error) {
return gitNoLFSSimple("ls-remote", remote, remoteRef)
}
func LsTree(ref string) (*subprocess.BufferedCmd, error) {
return gitNoLFSBuffered(
"ls-tree",
"-r", // recurse
"-l", // report object size (we'll need this)
"-z", // null line termination
"--full-tree", // start at the root regardless of where we are in it
ref,
)
}
func ResolveRef(ref string) (*Ref, error) {
outp, err := gitNoLFSSimple("rev-parse", ref, "--symbolic-full-name", ref)
if err != nil {

@ -10,6 +10,7 @@ import (
"strings"
"github.com/git-lfs/git-lfs/filepathfilter"
"github.com/git-lfs/git-lfs/git"
)
// An entry from ls-tree or rev-list including a blob sha and tree path
@ -94,14 +95,7 @@ func catFileBatchTree(treeblobs *TreeBlobChannelWrapper) (*PointerChannelWrapper
// The returned channel will be sent these blobs which should be sent to catFileBatchTree
// for final check & conversion to Pointer
func lsTreeBlobs(ref string, filter *filepathfilter.Filter) (*TreeBlobChannelWrapper, error) {
cmd, err := startCommand("git", "ls-tree",
"-r", // recurse
"-l", // report object size (we'll need this)
"-z", // null line termination
"--full-tree", // start at the root regardless of where we are in it
ref,
)
cmd, err := git.LsTree(ref)
if err != nil {
return nil, err
}