-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple diff stats query from actual diffing #33810
Conversation
372b48b
to
9974e14
Compare
9974e14
to
f609256
Compare
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if we do need it, wouldn't we need the check rightCommit == null
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Suggested changes are done in 58d24ab |
553c108
to
c6a07ee
Compare
c6a07ee
to
ca47fa9
Compare
* 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)
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)
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