Use correct line when using :parent in blame view #1372
Merged
koutcher merged 2 commits intojonas:masterfrom Apr 11, 2025
Merged
Use correct line when using :parent in blame view #1372koutcher merged 2 commits intojonas:masterfrom
:parent in blame view #1372koutcher merged 2 commits intojonas:masterfrom
Conversation
c2bfc10 to
5001878
Compare
krobelus
reviewed
Mar 22, 2025
krobelus
reviewed
Mar 22, 2025
@krobelus observed in jonas#1370 that this behavior, fixed in ca0809d, regressed again in 2280734. This bug is similar to, but not identical with, jonas#1369. The easiest way to observe the bug is to run `tig blame +28 tig-2.5.12 -- src/diff.c` and press `,` AKA `:parent`. The problem is that the view stays on line 28 instead of jumping to the corresponding line. The test is almost an exact copy of the test by @krobelus from jonas#1370.
This fixes the bug described in the parent commit. `blame->lineno` is only used here and in jonas#1370, so we can either do this or we could shift all the entries in `blame->lineno` by 1.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@krobelus observed in #1370 that this behavior, fixed in ca0809d, regressed again in 2280734.
This bug is similar to, but not identical with, #1369.
The easiest way to observe the bug is to run
tig blame +28 tig-2.5.12 -- src/diff.cand press,AKA:parent. The problem is that the view stays on line 28 instead of jumping to the corresponding line.This PR is complementary with #1370, they fix different bugs and can be merged independently. We could also decide on a different solution of changing the meaning of
blame->line. That would also require a change to #1370.See #1370 (comment) and the following comment for more details
A lot of this work is based heavily on that of @krobelus; the test is almost an exact copy of the test from #1370 for example.