MCPcopy
hub / github.com/go-git/go-git / TestResolveRevisionWithErrors

Method TestResolveRevisionWithErrors

repository_test.go:3187–3215  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

3185}
3186
3187func (s *RepositorySuite) TestResolveRevisionWithErrors(c *C) {
3188 url := s.GetLocalRepositoryURL(
3189 fixtures.ByURL("https://github.com/git-fixtures/basic.git").One(),
3190 )
3191
3192 r, _ := Init(memory.NewStorage(), nil)
3193 err := r.clone(context.Background(), &CloneOptions{URL: url})
3194 c.Assert(err, IsNil)
3195
3196 headRef, err := r.Head()
3197 c.Assert(err, IsNil)
3198
3199 ref := plumbing.NewHashReference("refs/heads/918c48b83bd081e863dbe1b80f8998f058cd8294", headRef.Hash())
3200 err = r.Storer.SetReference(ref)
3201 c.Assert(err, IsNil)
3202
3203 datas := map[string]string{
3204 "efs/heads/master~": "reference not found",
3205 "HEAD^3": `Revision invalid : "3" found must be 0, 1 or 2 after "^"`,
3206 "HEAD^{/whatever}": `no commit message match regexp: "whatever"`,
3207 "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83": "reference not found",
3208 }
3209
3210 for rev, rerr := range datas {
3211 _, err := r.ResolveRevision(plumbing.Revision(rev))
3212 c.Assert(err, NotNil)
3213 c.Assert(err.Error(), Equals, rerr)
3214 }
3215}
3216
3217func (s *RepositorySuite) testRepackObjects(
3218 c *C, deleteTime time.Time, expectedPacks int) {

Callers

nothing calls this directly

Calls 11

NewStorageFunction · 0.92
NewHashReferenceFunction · 0.92
RevisionTypeAlias · 0.92
InitFunction · 0.85
GetLocalRepositoryURLMethod · 0.80
cloneMethod · 0.80
HeadMethod · 0.80
ResolveRevisionMethod · 0.80
HashMethod · 0.65
SetReferenceMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected