aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-06-19 12:52:03 +0200
committerAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-06-19 12:52:03 +0200
commit9d4773cbae0c2ae9b6931c5a6bbac3da8d074ac7 (patch)
treea6205c07fcf5d2c6f50ceeaf0898bda9e58983bb /plumbing
parentad7432333d5859352ca67864815c4e5037fcd4eb (diff)
downloadgo-git-9d4773cbae0c2ae9b6931c5a6bbac3da8d074ac7.tar.gz
revlist: ignore treeEntries that are submodules.
- If we don't ignore submodules in trees, when we tried to perform a push, revlist.Objects returned hashes that was from submodules, causing an "object not found" error in packfile generation.
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/revlist/revlist.go5
-rw-r--r--plumbing/revlist/revlist_test.go20
2 files changed, 24 insertions, 1 deletions
diff --git a/plumbing/revlist/revlist.go b/plumbing/revlist/revlist.go
index 3e02184..20bc99d 100644
--- a/plumbing/revlist/revlist.go
+++ b/plumbing/revlist/revlist.go
@@ -7,6 +7,7 @@ import (
"io"
"gopkg.in/src-d/go-git.v4/plumbing"
+ "gopkg.in/src-d/go-git.v4/plumbing/filemode"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
)
@@ -121,6 +122,10 @@ func iterateCommitTrees(
return err
}
+ if e.Mode == filemode.Submodule {
+ continue
+ }
+
if seen[e.Hash] {
continue
}
diff --git a/plumbing/revlist/revlist_test.go b/plumbing/revlist/revlist_test.go
index 0baf27e..dd1e8c1 100644
--- a/plumbing/revlist/revlist_test.go
+++ b/plumbing/revlist/revlist_test.go
@@ -3,12 +3,12 @@ package revlist
import (
"testing"
- "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/plumbing/storer"
"gopkg.in/src-d/go-git.v4/storage/filesystem"
+ "github.com/src-d/go-git-fixtures"
. "gopkg.in/check.v1"
)
@@ -62,6 +62,24 @@ func (s *RevListSuite) commit(c *C, h plumbing.Hash) *object.Commit {
return commit
}
+func (s *RevListSuite) TestRevListObjects_Submodules(c *C) {
+ submodules := map[string]bool{
+ "6ecf0ef2c2dffb796033e5a02219af86ec6584e5": true,
+ }
+
+ sto, err := filesystem.NewStorage(fixtures.ByTag("submodule").One().DotGit())
+ c.Assert(err, IsNil)
+
+ ref, err := storer.ResolveReference(sto, plumbing.HEAD)
+ c.Assert(err, IsNil)
+
+ revList, err := Objects(sto, []plumbing.Hash{ref.Hash()}, nil)
+ c.Assert(err, IsNil)
+ for _, h := range revList {
+ c.Assert(submodules[h.String()], Equals, false)
+ }
+}
+
// ---
// | |\
// | | * b8e471f Creating changelog