diff --git a/modules/git/log_name_status.go b/modules/git/log_name_status.go index ffd0a0991bf..e1e117ff4b8 100644 --- a/modules/git/log_name_status.go +++ b/modules/git/log_name_status.go @@ -8,6 +8,7 @@ import ( "bufio" "bytes" "context" + "errors" "io" "path" "sort" @@ -62,9 +63,10 @@ func LogNameStatusRepo(ctx context.Context, repository, head, treepath string, p }) if err != nil { _ = stdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String())) - } else { - _ = stdoutWriter.Close() + return } + + _ = stdoutWriter.Close() }() // For simplicities sake we'll us a buffered reader to read from the cat-file --batch @@ -354,7 +356,7 @@ heaploop: } current, err := g.Next(treepath, path2idx, changed, maxpathlen) if err != nil { - if err == context.DeadlineExceeded { + if errors.Is(err, context.DeadlineExceeded) { break heaploop } g.Close()