Repository navigation
feat: show who last changed each line of a file, from its right-click menu, also as the file is in the working tree - #46
Merged
Merged
Conversation
… menu, also as the file is in the working tree
Merged
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.
What this changes
Right-click a file, in a commit or in your changes, and pick Blame: the centre shows the file with, beside each run of lines, the commit that last changed them (SHA, summary, author, date). Clicking a line shows its commit in the details panel and highlights every other line that commit changed. From your changes it is the file as it is now: lines you have not committed yet say so, and the blame follows your edits and new commits. From a commit it is the file in that commit. Renames are followed, as
git blamedoes. A file a commit deleted only offers its history.git blame --porcelainis read on a background thread (in git.git,sequencer.cwith 7,094 lines takes under a second), so the window never waits. The thread-and-channel code of the file history is now shared with it, and showing something in the centre closes the rest in one place.How it is tested
Core:
blame_tells_which_commit_last_changed_each_linerunsgit blamethrough a rename, in the working tree (a new line has the null id), in an older commit, and for a file that commit does not have;parses_blameandrejects_what_it_does_not_knowcover the parser.App:
blame_tells_which_commit_last_changed_each_lineopens the blame from the changes and from a commit, clicks a line, sees a line written outside appear and then get its commit, closes with Escape, and finds no Blame for a deleted file. It fails without the reload of the working tree and without the check for deleted files.Tried in the app on a small repository with a rename and on git.git.
cargo fmt --all,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepassIt adds as little code as the change needs, and removes what it makes unnecessary
Nothing in it comes from GitKraken or another closed-source client (see CONTRIBUTING.md)