From 3048d280d2d5b258d9e582a226ff4bbed34fd5c9 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Sun, 25 Oct 2015 01:43:15 +0200 Subject: formats/packfile: test improvements --- formats/packfile/objects.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'formats/packfile/objects.go') 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[:]) } -- cgit