aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-03-08 11:20:37 +0000
committerGitHub <noreply@github.com>2022-03-08 19:20:37 +0800
commitdd52c08b74682a71d44f254cf6bf8528101f1cea (patch)
treedf6b5b1ae463726e70657c59141e12f826d5ab09
parentb811b819e2d50af4b3b2d24ca28551839fd43036 (diff)
downloadgitea-dd52c08b74682a71d44f254cf6bf8528101f1cea.tar.gz
gitea-dd52c08b74682a71d44f254cf6bf8528101f1cea.zip
Don't show context cancelled errors in attribute reader (#19006) (#19027)
Backport #19006 Fix #18997 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r--modules/git/repo_attribute.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/git/repo_attribute.go b/modules/git/repo_attribute.go
index 3f6f8943a9..c107308fd6 100644
--- a/modules/git/repo_attribute.go
+++ b/modules/git/repo_attribute.go
@@ -191,7 +191,9 @@ func (c *CheckAttributeReader) Run() error {
}
return nil
})
- if err != nil && c.ctx.Err() != nil && err.Error() != "signal: killed" {
+ if err != nil && // If there is an error we need to return but:
+ c.ctx.Err() != err && // 1. Ignore the context error if the context is cancelled or exceeds the deadline (RunWithContext could return c.ctx.Err() which is Canceled or DeadlineExceeded)
+ err.Error() != "signal: killed" { // 2. We should not pass up errors due to the program being killed
return fmt.Errorf("failed to run attr-check. Error: %w\nStderr: %s", err, stdErr.String())
}
return nil