@@ -28,21 +28,27 @@ func cloneRepo(url, dir, name string) (string, error) {
28
28
func testGetCommitsInfo (t * testing.T , repo1 * Repository ) {
29
29
// these test case are specific to the repo1 test repo
30
30
testCases := []struct {
31
- CommitID string
32
- Path string
33
- ExpectedIDs map [string ]string
31
+ CommitID string
32
+ Path string
33
+ ExpectedIDs map [string ]string
34
+ ExpectedTreeCommit string
34
35
}{
35
36
{"8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2" , "" , map [string ]string {
36
37
"file1.txt" : "95bb4d39648ee7e325106df01a621c530863a653" ,
37
38
"file2.txt" : "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2" ,
38
- }},
39
+ }, "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2" },
39
40
{"2839944139e0de9737a044f78b0e4b40d989a9e3" , "" , map [string ]string {
40
41
"file1.txt" : "2839944139e0de9737a044f78b0e4b40d989a9e3" ,
41
42
"branch1.txt" : "9c9aef8dd84e02bc7ec12641deb4c930a7c30185" ,
42
- }},
43
+ }, "2839944139e0de9737a044f78b0e4b40d989a9e3" },
43
44
{"5c80b0245c1c6f8343fa418ec374b13b5d4ee658" , "branch2" , map [string ]string {
44
45
"branch2.txt" : "5c80b0245c1c6f8343fa418ec374b13b5d4ee658" ,
45
- }},
46
+ }, "5c80b0245c1c6f8343fa418ec374b13b5d4ee658" },
47
+ {"feaf4ba6bc635fec442f46ddd4512416ec43c2c2" , "" , map [string ]string {
48
+ "file1.txt" : "95bb4d39648ee7e325106df01a621c530863a653" ,
49
+ "file2.txt" : "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2" ,
50
+ "foo" : "37991dec2c8e592043f47155ce4808d4580f9123" ,
51
+ }, "feaf4ba6bc635fec442f46ddd4512416ec43c2c2" },
46
52
}
47
53
for _ , testCase := range testCases {
48
54
commit , err := repo1 .GetCommit (testCase .CommitID )
@@ -51,7 +57,8 @@ func testGetCommitsInfo(t *testing.T, repo1 *Repository) {
51
57
assert .NoError (t , err )
52
58
entries , err := tree .ListEntries ()
53
59
assert .NoError (t , err )
54
- commitsInfo , _ , err := entries .GetCommitsInfo (commit , testCase .Path , nil )
60
+ commitsInfo , treeCommit , err := entries .GetCommitsInfo (commit , testCase .Path , nil )
61
+ assert .Equal (t , testCase .ExpectedTreeCommit , treeCommit .ID .String ())
55
62
assert .NoError (t , err )
56
63
assert .Len (t , commitsInfo , len (testCase .ExpectedIDs ))
57
64
for _ , commitInfo := range commitsInfo {
0 commit comments