@@ -28,21 +28,27 @@ func cloneRepo(url, dir, name string) (string, error) {
2828func testGetCommitsInfo (t * testing.T , repo1 * Repository ) {
2929 // these test case are specific to the repo1 test repo
3030 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
3435 }{
3536 {"8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2" , "" , map [string ]string {
3637 "file1.txt" : "95bb4d39648ee7e325106df01a621c530863a653" ,
3738 "file2.txt" : "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2" ,
38- }},
39+ }, "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2" },
3940 {"2839944139e0de9737a044f78b0e4b40d989a9e3" , "" , map [string ]string {
4041 "file1.txt" : "2839944139e0de9737a044f78b0e4b40d989a9e3" ,
4142 "branch1.txt" : "9c9aef8dd84e02bc7ec12641deb4c930a7c30185" ,
42- }},
43+ }, "2839944139e0de9737a044f78b0e4b40d989a9e3" },
4344 {"5c80b0245c1c6f8343fa418ec374b13b5d4ee658" , "branch2" , map [string ]string {
4445 "branch2.txt" : "5c80b0245c1c6f8343fa418ec374b13b5d4ee658" ,
45- }},
46+ }, "5c80b0245c1c6f8343fa418ec374b13b5d4ee658" },
47+ {"feaf4ba6bc635fec442f46ddd4512416ec43c2c2" , "" , map [string ]string {
48+ "file1.txt" : "95bb4d39648ee7e325106df01a621c530863a653" ,
49+ "file2.txt" : "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2" ,
50+ "foo" : "37991dec2c8e592043f47155ce4808d4580f9123" ,
51+ }, "feaf4ba6bc635fec442f46ddd4512416ec43c2c2" },
4652 }
4753 for _ , testCase := range testCases {
4854 commit , err := repo1 .GetCommit (testCase .CommitID )
@@ -51,7 +57,8 @@ func testGetCommitsInfo(t *testing.T, repo1 *Repository) {
5157 assert .NoError (t , err )
5258 entries , err := tree .ListEntries ()
5359 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 ())
5562 assert .NoError (t , err )
5663 assert .Len (t , commitsInfo , len (testCase .ExpectedIDs ))
5764 for _ , commitInfo := range commitsInfo {
0 commit comments