|
|
@ -31,18 +31,24 @@ func testGetCommitsInfo(t *testing.T, repo1 *Repository) { |
|
|
|
CommitID string |
|
|
|
CommitID string |
|
|
|
Path string |
|
|
|
Path string |
|
|
|
ExpectedIDs map[string]string |
|
|
|
ExpectedIDs map[string]string |
|
|
|
|
|
|
|
ExpectedTreeCommit string |
|
|
|
}{ |
|
|
|
}{ |
|
|
|
{"8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2", "", map[string]string{ |
|
|
|
{"8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2", "", map[string]string{ |
|
|
|
"file1.txt": "95bb4d39648ee7e325106df01a621c530863a653", |
|
|
|
"file1.txt": "95bb4d39648ee7e325106df01a621c530863a653", |
|
|
|
"file2.txt": "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2", |
|
|
|
"file2.txt": "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2", |
|
|
|
}}, |
|
|
|
}, "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2"}, |
|
|
|
{"2839944139e0de9737a044f78b0e4b40d989a9e3", "", map[string]string{ |
|
|
|
{"2839944139e0de9737a044f78b0e4b40d989a9e3", "", map[string]string{ |
|
|
|
"file1.txt": "2839944139e0de9737a044f78b0e4b40d989a9e3", |
|
|
|
"file1.txt": "2839944139e0de9737a044f78b0e4b40d989a9e3", |
|
|
|
"branch1.txt": "9c9aef8dd84e02bc7ec12641deb4c930a7c30185", |
|
|
|
"branch1.txt": "9c9aef8dd84e02bc7ec12641deb4c930a7c30185", |
|
|
|
}}, |
|
|
|
}, "2839944139e0de9737a044f78b0e4b40d989a9e3"}, |
|
|
|
{"5c80b0245c1c6f8343fa418ec374b13b5d4ee658", "branch2", map[string]string{ |
|
|
|
{"5c80b0245c1c6f8343fa418ec374b13b5d4ee658", "branch2", map[string]string{ |
|
|
|
"branch2.txt": "5c80b0245c1c6f8343fa418ec374b13b5d4ee658", |
|
|
|
"branch2.txt": "5c80b0245c1c6f8343fa418ec374b13b5d4ee658", |
|
|
|
}}, |
|
|
|
}, "5c80b0245c1c6f8343fa418ec374b13b5d4ee658"}, |
|
|
|
|
|
|
|
{"feaf4ba6bc635fec442f46ddd4512416ec43c2c2", "", map[string]string{ |
|
|
|
|
|
|
|
"file1.txt": "95bb4d39648ee7e325106df01a621c530863a653", |
|
|
|
|
|
|
|
"file2.txt": "8d92fc957a4d7cfd98bc375f0b7bb189a0d6c9f2", |
|
|
|
|
|
|
|
"foo": "37991dec2c8e592043f47155ce4808d4580f9123", |
|
|
|
|
|
|
|
}, "feaf4ba6bc635fec442f46ddd4512416ec43c2c2"}, |
|
|
|
} |
|
|
|
} |
|
|
|
for _, testCase := range testCases { |
|
|
|
for _, testCase := range testCases { |
|
|
|
commit, err := repo1.GetCommit(testCase.CommitID) |
|
|
|
commit, err := repo1.GetCommit(testCase.CommitID) |
|
|
@ -51,7 +57,8 @@ func testGetCommitsInfo(t *testing.T, repo1 *Repository) { |
|
|
|
assert.NoError(t, err) |
|
|
|
assert.NoError(t, err) |
|
|
|
entries, err := tree.ListEntries() |
|
|
|
entries, err := tree.ListEntries() |
|
|
|
assert.NoError(t, err) |
|
|
|
assert.NoError(t, err) |
|
|
|
commitsInfo, _, err := entries.GetCommitsInfo(commit, testCase.Path, nil) |
|
|
|
commitsInfo, treeCommit, err := entries.GetCommitsInfo(commit, testCase.Path, nil) |
|
|
|
|
|
|
|
assert.Equal(t, testCase.ExpectedTreeCommit, treeCommit.ID.String()) |
|
|
|
assert.NoError(t, err) |
|
|
|
assert.NoError(t, err) |
|
|
|
assert.Len(t, commitsInfo, len(testCase.ExpectedIDs)) |
|
|
|
assert.Len(t, commitsInfo, len(testCase.ExpectedIDs)) |
|
|
|
for _, commitInfo := range commitsInfo { |
|
|
|
for _, commitInfo := range commitsInfo { |
|
|
|