Decouple diff stats query from actual diffing#33810
Merged
Merged
Conversation
372b48b to
9974e14
Compare
9974e14 to
f609256
Compare
delvh
reviewed
Mar 6, 2025
| func (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommit, rightCommit *git.Commit) *DiffSection { | ||
| if len(diffFile.Sections) == 0 || diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile { | ||
| func (diffFile *DiffFile) GetTailSection(leftCommit, rightCommit *git.Commit) *DiffSection { | ||
| if len(diffFile.Sections) == 0 || leftCommit == nil || diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile { |
Member
There was a problem hiding this comment.
Wait, that seems strange:
What does the commit being missing have to do with whether we have to create the expand button?
These two things seem unrelated to me…
Member
There was a problem hiding this comment.
And if we do need it, wouldn't we need the check rightCommit == null as well?
Contributor
Author
There was a problem hiding this comment.
It's not strange (hmm, maybe strange), actually it doesn't need leftCommit == nil because DiffFileChange already implies leftCommit != nil.
This change just clarifies it.
And, rightCommit can never be nil
Contributor
Author
|
Suggested changes are done in 58d24ab |
553c108 to
c6a07ee
Compare
c6a07ee to
ca47fa9
Compare
lunny
approved these changes
Mar 7, 2025
hiifong
approved these changes
Mar 8, 2025
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Mar 10, 2025
* giteaofficial/main: Move notifywatch to service layer (go-gitea#33825) [skip ci] Updated translations via Crowdin Only keep popular licenses (go-gitea#33832) Removing unwanted ui container (go-gitea#33833) Full-file syntax highlighting for diff pages (go-gitea#33766) Improve theme display (go-gitea#30671) Decouple context from repository related structs (go-gitea#33823) Improve log format (go-gitea#33814) Decouple diff stats query from actual diffing (go-gitea#33810) Add global lock for migrations to make upgrade more safe with multiple replications (go-gitea#33706) Do not show passkey on http sites (go-gitea#33820)
hiifong
pushed a commit
to hiifong/gitea
that referenced
this pull request
Mar 10, 2025
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 go-gitea#31492 (cherry picked from commit 6422f05)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The diff stats are no longer part of the diff generation.
Use
GetDiffShortStatinstead to get the total number of changed files, added lines, and deleted lines.As such,
gitdiff.GetDiffcan be simplified:It should not do more than expected.
And do not run "git diff --shortstat" for pull list. Fix #31492