diff options
author | antham <hamonanth@gmail.com> | 2018-01-03 00:50:20 +0100 |
---|---|---|
committer | antham <hamonanth@gmail.com> | 2018-04-16 21:47:31 +0200 |
commit | 0c7d7c6fc44a88b9ecd8aac9744272a71dd91f02 (patch) | |
tree | fe68c13b3b54a67b095f0f26a7b67ba1cf90dca3 /repository_test.go | |
parent | 0db54e829f81a28f71c22d54c03daba5ec144c8d (diff) | |
download | go-git-0c7d7c6fc44a88b9ecd8aac9744272a71dd91f02.tar.gz |
Resolve full commit sha to plumbing hash
Signed-off-by: antham <hamonanth@gmail.com>
Diffstat (limited to 'repository_test.go')
-rw-r--r-- | repository_test.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/repository_test.go b/repository_test.go index c98e2ac..3e94db9 100644 --- a/repository_test.go +++ b/repository_test.go @@ -1494,6 +1494,7 @@ func (s *RepositorySuite) TestResolveRevision(c *C) { "branch~1": "918c48b83bd081e863dbe1b80f8998f058cd8294", "v1.0.0~1": "918c48b83bd081e863dbe1b80f8998f058cd8294", "master~1": "918c48b83bd081e863dbe1b80f8998f058cd8294", + "918c48b83bd081e863dbe1b80f8998f058cd8294": "918c48b83bd081e863dbe1b80f8998f058cd8294", } for rev, hash := range datas { @@ -1513,10 +1514,19 @@ func (s *RepositorySuite) TestResolveRevisionWithErrors(c *C) { err := r.clone(context.Background(), &CloneOptions{URL: url}) c.Assert(err, IsNil) + headRef, err := r.Head() + c.Assert(err, IsNil) + + ref := plumbing.NewHashReference("refs/heads/918c48b83bd081e863dbe1b80f8998f058cd8294", headRef.Hash()) + err = r.Storer.SetReference(ref) + c.Assert(err, IsNil) + datas := map[string]string{ - "efs/heads/master~": "reference not found", - "HEAD^3": `Revision invalid : "3" found must be 0, 1 or 2 after "^"`, - "HEAD^{/whatever}": `No commit message match regexp : "whatever"`, + "efs/heads/master~": "reference not found", + "HEAD^3": `Revision invalid : "3" found must be 0, 1 or 2 after "^"`, + "HEAD^{/whatever}": `No commit message match regexp : "whatever"`, + "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83": "reference not found", + "918c48b83bd081e863dbe1b80f8998f058cd8294": `refname "918c48b83bd081e863dbe1b80f8998f058cd8294" is ambiguous`, } for rev, rerr := range datas { |