aboutsummaryrefslogtreecommitdiffstats
path: root/formats/packfile/objects.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2015-10-25 01:43:15 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2015-10-25 01:43:15 +0200
commit3048d280d2d5b258d9e582a226ff4bbed34fd5c9 (patch)
tree3be7a88afda8d4409d30e6a7fc7b7128dabe2b45 /formats/packfile/objects.go
parent27aa8cdd2431068606741a589383c02c149ea625 (diff)
downloadgo-git-3048d280d2d5b258d9e582a226ff4bbed34fd5c9.tar.gz
formats/packfile: test improvements
Diffstat (limited to 'formats/packfile/objects.go')
-rw-r--r--formats/packfile/objects.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/formats/packfile/objects.go b/formats/packfile/objects.go
index 1077b5f..e46d8af 100644
--- a/formats/packfile/objects.go
+++ b/formats/packfile/objects.go
@@ -37,6 +37,15 @@ func ComputeHash(t ObjectType, content []byte) Hash {
return Hash(sha1.Sum(h))
}
+func NewHash(s string) Hash {
+ b, _ := hex.DecodeString(s)
+
+ var h Hash
+ copy(h[:], b)
+
+ return h
+}
+
func (h Hash) String() string {
return hex.EncodeToString(h[:])
}