diff options
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[:]) } |