diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-12-07 11:04:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-07 11:04:26 +0100 |
commit | a955b6f6f3e3cf37d284dca64c8335873ff9e3be (patch) | |
tree | c9bc458006c00a213474beca2c7294de3ce440f4 /plumbing/object/patch_test.go | |
parent | eb74b0e1a0ae20075435aded41bffc522bc3554c (diff) | |
parent | 89932462a587e15051040aa49d99201853726dcf (diff) | |
download | go-git-a955b6f6f3e3cf37d284dca64c8335873ff9e3be.tar.gz |
Merge pull request #677 from krylovsk/bugffix/stats-on-empty-patch
object: patch, fix stats for submodules (fixes #654)
Diffstat (limited to 'plumbing/object/patch_test.go')
-rw-r--r-- | plumbing/object/patch_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/plumbing/object/patch_test.go b/plumbing/object/patch_test.go new file mode 100644 index 0000000..8eb65ec --- /dev/null +++ b/plumbing/object/patch_test.go @@ -0,0 +1,44 @@ +package object + +import ( + . "gopkg.in/check.v1" + fixtures "gopkg.in/src-d/go-git-fixtures.v3" + "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/storage/filesystem" +) + +type PatchSuite struct { + BaseObjectsSuite +} + +var _ = Suite(&PatchSuite{}) + +func (s *PatchSuite) TestStatsWithSubmodules(c *C) { + storer, err := filesystem.NewStorage( + fixtures.ByURL("https://github.com/git-fixtures/submodule.git").One().DotGit()) + + commit, err := GetCommit(storer, plumbing.NewHash("b685400c1f9316f350965a5993d350bc746b0bf4")) + + tree, err := commit.Tree() + c.Assert(err, IsNil) + + e, err := tree.entry("basic") + c.Assert(err, IsNil) + + ch := &Change{ + From: ChangeEntry{ + Name: "basic", + Tree: tree, + TreeEntry: *e, + }, + To: ChangeEntry{ + Name: "basic", + Tree: tree, + TreeEntry: *e, + }, + } + + p, err := getPatch("", ch) + c.Assert(err, IsNil) + c.Assert(p, NotNil) +} |