Skip to content

Commit d212c47

Browse files
committed
fix DiffIndex throwing an error when canceling the process early
1 parent 3460918 commit d212c47

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

services/repository/files/temp_repo.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,14 @@ func (t *TemporaryUploadRepository) DiffIndex() (*gitdiff.Diff, error) {
372372
log.Error("Unable to ParsePatch in temporary repo %s (%s). Error: %v", t.repo.FullName(), t.basePath, finalErr)
373373
return nil, finalErr
374374
}
375-
log.Error("Unable to run diff-index pipeline in temporary repo %s (%s). Error: %v\nStderr: %s",
376-
t.repo.FullName(), t.basePath, err, stderr)
377-
return nil, fmt.Errorf("Unable to run diff-index pipeline in temporary repo %s. Error: %w\nStderr: %s",
378-
t.repo.FullName(), err, stderr)
375+
376+
// If the process exited early, don't error
377+
if err != context.Canceled {
378+
log.Error("Unable to run diff-index pipeline in temporary repo %s (%s). Error: %v\nStderr: %s",
379+
t.repo.FullName(), t.basePath, err, stderr)
380+
return nil, fmt.Errorf("Unable to run diff-index pipeline in temporary repo %s. Error: %w\nStderr: %s",
381+
t.repo.FullName(), err, stderr)
382+
}
379383
}
380384

381385
diff.NumFiles, diff.TotalAddition, diff.TotalDeletion, err = git.GetDiffShortStat(t.ctx, t.basePath, git.TrustedCmdArgs{"--cached"}, "HEAD")

0 commit comments

Comments
 (0)