Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sbillig
Copy link
Contributor

@sbillig sbillig commented May 28, 2025

The file line number that was sent to $EDITOR was relative to the start of the diff text. We now use the parsed hunk header new_line_start, plus an offset to get to the first edited line in the hunk.

This behavior isn't always correct of course, but it's at least better for the common case of viewing a hunk in the diff of the working tree. When viewing a diff of an older commit, the hunk new_line_start doesn't necessarily refer to the correct line in the current code (and the relevant code might no longer exist). In this case, magit will open a buffer (revived from git) which reflects the code at the time of the commit. If you press enter while on a single changed line in the hunk, magit will show you the pre-edit or post-edit version of the code, depending on whether you're on a - or + diff line, which is pretty fancy.

@codecov
Copy link

codecov bot commented May 31, 2025

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Project coverage is 88.32%. Comparing base (6b8f359) to head (11ffc08).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/git/diff.rs 0.00% 10 Missing ⚠️
src/ops/show.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #375      +/-   ##
==========================================
- Coverage   88.36%   88.32%   -0.04%     
==========================================
  Files          67       67              
  Lines        6798     6801       +3     
==========================================
  Hits         6007     6007              
- Misses        791      794       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@altsem altsem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works a lot better, nice!

@altsem altsem merged commit 9b0f640 into altsem:master May 31, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants