diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-25 01:43:15 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-25 01:43:15 +0200 |
commit | 3048d280d2d5b258d9e582a226ff4bbed34fd5c9 (patch) | |
tree | 3be7a88afda8d4409d30e6a7fc7b7128dabe2b45 /formats/packfile/objects.go | |
parent | 27aa8cdd2431068606741a589383c02c149ea625 (diff) | |
download | go-git-3048d280d2d5b258d9e582a226ff4bbed34fd5c9.tar.gz |
formats/packfile: test improvements
Diffstat (limited to 'formats/packfile/objects.go')
-rw-r--r-- | formats/packfile/objects.go | 9 |
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[:]) } |