diff options
author | Unknwon <u@gogs.io> | 2017-04-04 01:45:57 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-04 01:45:57 -0400 |
commit | 55afc1ad21a6c5bebe7f7f8b6df8b0ee4308ba10 (patch) | |
tree | 685c2c0e975481a079aee2b146cb8790d7efb6e3 /vendor/github.com/gogits/git-module/commit.go | |
parent | 16c6ca72cd4cd4d686fd5142794f883343c3aed0 (diff) |
models/repo_diff: move core functions to gogits/git-module
Diffstat (limited to 'vendor/github.com/gogits/git-module/commit.go')
-rw-r--r-- | vendor/github.com/gogits/git-module/commit.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/vendor/github.com/gogits/git-module/commit.go b/vendor/github.com/gogits/git-module/commit.go index 6cc6b5fd..64831d7f 100644 --- a/vendor/github.com/gogits/git-module/commit.go +++ b/vendor/github.com/gogits/git-module/commit.go @@ -271,10 +271,7 @@ func NewCommitFileStatus() *CommitFileStatus { // GetCommitFileStatus returns file status of commit in given repository. func GetCommitFileStatus(repoPath, commitID string) (*CommitFileStatus, error) { stdout, w := io.Pipe() - defer stdout.Close() - - stderr := new(bytes.Buffer) - + done := make(chan struct{}) fileStatus := NewCommitFileStatus() go func() { scanner := bufio.NewScanner(stdout) @@ -293,12 +290,17 @@ func GetCommitFileStatus(repoPath, commitID string) (*CommitFileStatus, error) { fileStatus.Modified = append(fileStatus.Modified, fields[1]) } } + done <- struct{}{} }() - if err := NewCommand("log", "-1", "--name-status", "--pretty=format:''", commitID).RunInDirPipeline(repoPath, w, stderr); err != nil { + stderr := new(bytes.Buffer) + err := NewCommand("log", "-1", "--name-status", "--pretty=format:''", commitID).RunInDirPipeline(repoPath, w, stderr) + w.Close() // Close writer to exit parsing goroutine + if err != nil { return nil, concatenateError(err, stderr.String()) } + <-done return fileStatus, nil } |