mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-03 01:17:00 +00:00
Add test and comment
This commit is contained in:
parent
99b5634494
commit
be18643bfd
@ -194,3 +194,15 @@ func TestParseDiffHunkString(t *testing.T) {
|
|||||||
assert.Equal(t, 2, rightLine)
|
assert.Equal(t, 2, rightLine)
|
||||||
assert.Equal(t, 1, rightHunk)
|
assert.Equal(t, 1, rightHunk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_GetAffectedHunksForTwoCommitsSpecialFile(t *testing.T) {
|
||||||
|
repoPath := "./tests/repos/repo4_commitsbetween"
|
||||||
|
hunks, err := GetAffectedHunksForTwoCommitsSpecialFile(t.Context(), repoPath, "fdc1b615bdcff0f0658b216df0c9209e5ecb7c78", "a78e5638b66ccfe7e1b4689d3d5684e42c97d7ca", "test.txt")
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Len(t, hunks, 1)
|
||||||
|
// @@ -1 +1 @@
|
||||||
|
assert.Equal(t, int64(1), hunks[0].LeftLine)
|
||||||
|
assert.Equal(t, int64(1), hunks[0].LeftHunk)
|
||||||
|
assert.Equal(t, int64(1), hunks[0].RightLine)
|
||||||
|
assert.Equal(t, int64(1), hunks[0].RightHunk)
|
||||||
|
}
|
||||||
|
@ -322,6 +322,9 @@ func (repo *Repository) CommitsBetween(lastCommitID, beforeCommitID string) ([]*
|
|||||||
return commits, nil
|
return commits, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CommitIDsBetween returns a list that contains commit IDs between (beforeCommitID, afterCommitID].
|
||||||
|
// If beforeCommitID is empty, it will return all commits before afterCommitID.
|
||||||
|
// If beforeCommitID is given, it will not be included in the result.
|
||||||
func CommitIDsBetween(ctx context.Context, repoPath, beforeCommitID, afterCommitID string) ([]string, error) {
|
func CommitIDsBetween(ctx context.Context, repoPath, beforeCommitID, afterCommitID string) ([]string, error) {
|
||||||
var stdout []byte
|
var stdout []byte
|
||||||
var err error
|
var err error
|
||||||
|
Loading…
Reference in New Issue
Block a user