mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Decouple diff stats query from actual diffing (#33810)
The diff stats are no longer part of the diff generation. Use `GetDiffShortStat` instead to get the total number of changed files, added lines, and deleted lines. As such, `gitdiff.GetDiff` can be simplified: It should not do more than expected. And do not run "git diff --shortstat" for pull list. Fix #31492
This commit is contained in:
@@ -30,8 +30,6 @@ func TestGetDiffPreview(t *testing.T) {
|
||||
content := "# repo1\n\nDescription for repo1\nthis is a new line"
|
||||
|
||||
expectedDiff := &gitdiff.Diff{
|
||||
TotalAddition: 2,
|
||||
TotalDeletion: 1,
|
||||
Files: []*gitdiff.DiffFile{
|
||||
{
|
||||
Name: "README.md",
|
||||
@@ -114,7 +112,6 @@ func TestGetDiffPreview(t *testing.T) {
|
||||
},
|
||||
IsIncomplete: false,
|
||||
}
|
||||
expectedDiff.NumFiles = len(expectedDiff.Files)
|
||||
|
||||
t.Run("with given branch", func(t *testing.T) {
|
||||
diff, err := GetDiffPreview(ctx, ctx.Repo.Repository, branch, treePath, content)
|
||||
|
Reference in New Issue
Block a user