aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git/sha1.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/sha1.go')
-rw-r--r--modules/git/sha1.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/git/sha1.go b/modules/git/sha1.go
index 4d69653e09..7d9d9776da 100644
--- a/modules/git/sha1.go
+++ b/modules/git/sha1.go
@@ -28,6 +28,14 @@ func IsValidSHAPattern(sha string) bool {
return shaPattern.MatchString(sha)
}
+type ErrInvalidSHA struct {
+ SHA string
+}
+
+func (err ErrInvalidSHA) Error() string {
+ return fmt.Sprintf("invalid sha: %s", err.SHA)
+}
+
// MustID always creates a new SHA1 from a [20]byte array with no validation of input.
func MustID(b []byte) SHA1 {
var id SHA1