Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix incorrect diff expander for deletion of last lines in a file #29501

Merged
merged 3 commits into from
Mar 1, 2024

Conversation

silverwind
Copy link
Member

Fixes: #29498

I don't quite understand this code, but this change does seem to fix the issue and I tested a number of diffs with it and saw no issue. The function gets such value if last line is an addition:

  LastLeftIdx: (int) 0,
  LastRightIdx: (int) 47,
  LeftIdx: (int) 47,
  RightIdx: (int) 48,

If it's a deletion, it gets:

  LastLeftIdx: (int) 47,
  LastRightIdx: (int) 0,
  LeftIdx: (int) 48,
  RightIdx: (int) 47,

So I think it's correct to make this check respect both left and right side.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 29, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 29, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 29, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 1, 2024
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 1, 2024
@silverwind silverwind enabled auto-merge (squash) March 1, 2024 15:41
@silverwind silverwind merged commit 3b99066 into go-gitea:main Mar 1, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.22.0 milestone Mar 1, 2024
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 1, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 2, 2024
* giteaofficial/main:
  Actions Artifacts v4 backend (go-gitea#28965)
  Remove jQuery AJAX from common global functions (go-gitea#29528)
  Allow options to disable user gpg keys configuration from the interface on app.ini (go-gitea#29486)
  [skip ci] Updated translations via Crowdin
  Fix issue & comment history bugs (go-gitea#29525)
  Fix incorrect diff expander for deletion of last lines in a file (go-gitea#29501)
  Ignore `__debug_bin*` which is generated by vscode when debugging (go-gitea#29524)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2024
@silverwind silverwind deleted the expander branch May 28, 2024 14:17
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect code-expander-button when last line is deleted in a diff
4 participants