Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 10f7663

Browse files
committed
object: patch, test patch on submodules
1 parent 1654484 commit 10f7663

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

plumbing/object/patch_test.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package object
2+
3+
import (
4+
. "gopkg.in/check.v1"
5+
fixtures "gopkg.in/src-d/go-git-fixtures.v3"
6+
"gopkg.in/src-d/go-git.v4/plumbing"
7+
"gopkg.in/src-d/go-git.v4/storage/filesystem"
8+
)
9+
10+
type PatchSuite struct {
11+
BaseObjectsSuite
12+
}
13+
14+
var _ = Suite(&PatchSuite{})
15+
16+
func (s *PatchSuite) TestStatsWithSubmodules(c *C) {
17+
storer, err := filesystem.NewStorage(
18+
fixtures.ByURL("https://github.com/git-fixtures/submodule.git").One().DotGit())
19+
20+
commit, err := GetCommit(storer, plumbing.NewHash("b685400c1f9316f350965a5993d350bc746b0bf4"))
21+
22+
tree, err := commit.Tree()
23+
c.Assert(err, IsNil)
24+
25+
e, err := tree.entry("basic")
26+
c.Assert(err, IsNil)
27+
28+
ch := &Change{
29+
From: ChangeEntry{
30+
Name: "basic",
31+
Tree: tree,
32+
TreeEntry: *e,
33+
},
34+
To: ChangeEntry{
35+
Name: "basic",
36+
Tree: tree,
37+
TreeEntry: *e,
38+
},
39+
}
40+
41+
p, err := getPatch("", ch)
42+
c.Assert(err, IsNil)
43+
c.Assert(p, NotNil)
44+
}

0 commit comments

Comments
 (0)