aboutsummaryrefslogtreecommitdiff
path: root/internal/gitutil
diff options
context:
space:
mode:
Diffstat (limited to 'internal/gitutil')
-rw-r--r--internal/gitutil/error.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/gitutil/error.go b/internal/gitutil/error.go
index 205546aa..a823dd72 100644
--- a/internal/gitutil/error.go
+++ b/internal/gitutil/error.go
@@ -6,6 +6,7 @@ package gitutil
import (
"github.com/gogs/git-module"
+ "github.com/pkg/errors"
"gogs.io/gogs/internal/errutil"
)
@@ -27,17 +28,19 @@ func NewError(err error) error {
return Error{error: err}
}
-// IsErrSubmoduleNotExist returns true if the error is git.ErrSubmoduleNotExist.
+// IsErrSubmoduleNotExist returns true if the underlying error is
+// git.ErrSubmoduleNotExist.
func IsErrSubmoduleNotExist(err error) bool {
- return err == git.ErrSubmoduleNotExist
+ return errors.Cause(err) == git.ErrSubmoduleNotExist
}
-// IsErrRevisionNotExist returns true if the error is git.ErrRevisionNotExist.
+// IsErrRevisionNotExist returns true if the underlying error is
+// git.ErrRevisionNotExist.
func IsErrRevisionNotExist(err error) bool {
- return err == git.ErrRevisionNotExist
+ return errors.Cause(err) == git.ErrRevisionNotExist
}
-// IsErrNoMergeBase returns true if the error is git.ErrNoMergeBase.
+// IsErrNoMergeBase returns true if the underlying error is git.ErrNoMergeBase.
func IsErrNoMergeBase(err error) bool {
- return err == git.ErrNoMergeBase
+ return errors.Cause(err) == git.ErrNoMergeBase
}