diff options
Diffstat (limited to 'modules/git/log_name_status.go')
-rw-r--r-- | modules/git/log_name_status.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/git/log_name_status.go b/modules/git/log_name_status.go index 7d83ac7270..e792b02a5d 100644 --- a/modules/git/log_name_status.go +++ b/modules/git/log_name_status.go @@ -275,7 +275,9 @@ func (g *LogNameStatusRepoParser) Close() { } // WalkGitLog walks the git log --name-status for the head commit in the provided treepath and files -func WalkGitLog(ctx context.Context, repo *Repository, head *Commit, treepath string, paths ...string) (map[string]string, error) { +func WalkGitLog(ctx context.Context, cache *LastCommitCache, repo *Repository, head *Commit, treepath string, paths ...string) (map[string]string, error) { + headRef := head.ID.String() + tree, err := head.SubTree(treepath) if err != nil { return nil, err @@ -339,6 +341,9 @@ heaploop: for { select { case <-ctx.Done(): + if ctx.Err() == context.DeadlineExceeded { + break heaploop + } g.Close() return nil, ctx.Err() default: @@ -360,10 +365,16 @@ heaploop: changed[i] = false if results[i] == "" { results[i] = current.CommitID + if err := cache.Put(headRef, path.Join(treepath, paths[i]), current.CommitID); err != nil { + return nil, err + } delete(path2idx, paths[i]) remaining-- if results[0] == "" { results[0] = current.CommitID + if err := cache.Put(headRef, treepath, current.CommitID); err != nil { + return nil, err + } delete(path2idx, "") remaining-- } |