aboutsummaryrefslogtreecommitdiffstats
path: root/references_test.go
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-04-19 17:53:26 +0200
committerAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-04-19 17:53:26 +0200
commitbc4bbeebdee57685033c6d39b6eb1c858d06b25c (patch)
treee07aac5391c14f8e119bd2aae961e8b41eea83ac /references_test.go
parenta504b72b1ad9c2fe5a8460a3073f8f69cade2c17 (diff)
downloadgo-git-bc4bbeebdee57685033c6d39b6eb1c858d06b25c.tar.gz
Add test
Diffstat (limited to 'references_test.go')
-rw-r--r--references_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/references_test.go b/references_test.go
index 22efc4d..3cd0b97 100644
--- a/references_test.go
+++ b/references_test.go
@@ -7,6 +7,7 @@ import (
"github.com/src-d/go-git-fixtures"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/object"
+ "gopkg.in/src-d/go-git.v4/storage/memory"
. "gopkg.in/check.v1"
)
@@ -287,6 +288,26 @@ var referencesTests = [...]struct {
*/
}
+func (s *ReferencesSuite) TestObjectNotFoundError(c *C) {
+ h1 := plumbing.NewHash("af2d6a6954d532f8ffb47615169c8fdf9d383a1a")
+ hParent := plumbing.NewHash("1669dce138d9b841a518c64b10914d88f5e488ea")
+
+ url := fixtures.ByURL("https://github.com/git-fixtures/basic.git").One().DotGit().Base()
+ storer := memory.NewStorage()
+ r, err := Clone(storer, nil, &CloneOptions{
+ URL: "file://" + url,
+ })
+ c.Assert(err, IsNil)
+
+ delete(storer.Objects, hParent)
+
+ commit, err := r.CommitObject(h1)
+ c.Assert(err, IsNil)
+
+ _, err = references(commit, "LICENSE")
+ c.Assert(err, Equals, plumbing.ErrObjectNotFound)
+}
+
func (s *ReferencesSuite) TestRevList(c *C) {
for _, t := range referencesTests {
r := s.NewRepositoryFromPackfile(fixtures.ByURL(t.repo).One())