summaryrefslogtreecommitdiffstats
path: root/modules/git/pipeline/lfs_nogogit.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/pipeline/lfs_nogogit.go')
-rw-r--r--modules/git/pipeline/lfs_nogogit.go23
1 files changed, 2 insertions, 21 deletions
diff --git a/modules/git/pipeline/lfs_nogogit.go b/modules/git/pipeline/lfs_nogogit.go
index 30d33e27e0..f6faa3a48a 100644
--- a/modules/git/pipeline/lfs_nogogit.go
+++ b/modules/git/pipeline/lfs_nogogit.go
@@ -64,27 +64,8 @@ func FindLFSFile(repo *git.Repository, hash git.SHA1) ([]*LFSResult, error) {
// Next feed the commits in order into cat-file --batch, followed by their trees and sub trees as necessary.
// so let's create a batch stdin and stdout
- batchStdinReader, batchStdinWriter := io.Pipe()
- batchStdoutReader, batchStdoutWriter := io.Pipe()
- defer func() {
- _ = batchStdinReader.Close()
- _ = batchStdinWriter.Close()
- _ = batchStdoutReader.Close()
- _ = batchStdoutWriter.Close()
- }()
-
- go func() {
- stderr := strings.Builder{}
- err := git.NewCommand("cat-file", "--batch").RunInDirFullPipeline(repo.Path, batchStdoutWriter, &stderr, batchStdinReader)
- if err != nil {
- _ = revListWriter.CloseWithError(git.ConcatenateError(err, (&stderr).String()))
- } else {
- _ = revListWriter.Close()
- }
- }()
-
- // For simplicities sake we'll us a buffered reader to read from the cat-file --batch
- batchReader := bufio.NewReader(batchStdoutReader)
+ batchStdinWriter, batchReader, cancel := git.CatFileBatch(repo.Path)
+ defer cancel()
// We'll use a scanner for the revList because it's simpler than a bufio.Reader
scan := bufio.NewScanner(revListReader)