Allow viewing past commits in Zed (#27636)
This PR adds functionality for loading the diff for an arbitrary git commit, and displaying it in a tab. To retrieve the diff for the commit, I'm using a single `git cat-file --batch` invocation to efficiently load both the old and new versions of each file that was changed in the commit. Todo * Features * [x] Open the commit view when clicking the most recent commit message in the commit panel * [x] Open the commit view when clicking a SHA in a git blame column * [x] Open the commit view when clicking a SHA in a commit tooltip * [x] Make it work over RPC * [x] Allow buffer search in commit view * [x] Command palette action to open the commit for the current blame line * Styling * [x] Add a header that shows the author, timestamp, and the full commit message * [x] Remove stage/unstage buttons in commit view * [x] Truncate the commit message in the tab * Bugs * [x] Dedup commit tabs within a pane * [x] Add a tooltip to the tab Release Notes: - Added the ability to show past commits in Zed. You can view the most recent commit by clicking its message in the commit panel. And when viewing a git blame, you can show any commit by clicking its sha.
This commit is contained in:
parent
33912011b7
commit
8546dc101d
28 changed files with 1742 additions and 603 deletions
|
@ -365,6 +365,9 @@ message Envelope {
|
|||
|
||||
LanguageServerIdForName language_server_id_for_name = 332;
|
||||
LanguageServerIdForNameResponse language_server_id_for_name_response = 333; // current max
|
||||
|
||||
LoadCommitDiff load_commit_diff = 334;
|
||||
LoadCommitDiffResponse load_commit_diff_response = 335; // current max
|
||||
}
|
||||
|
||||
reserved 87 to 88;
|
||||
|
@ -3365,6 +3368,23 @@ message GitCommitDetails {
|
|||
string committer_name = 5;
|
||||
}
|
||||
|
||||
message LoadCommitDiff {
|
||||
uint64 project_id = 1;
|
||||
reserved 2;
|
||||
uint64 work_directory_id = 3;
|
||||
string commit = 4;
|
||||
}
|
||||
|
||||
message LoadCommitDiffResponse {
|
||||
repeated CommitFile files = 1;
|
||||
}
|
||||
|
||||
message CommitFile {
|
||||
string path = 1;
|
||||
optional string old_text = 2;
|
||||
optional string new_text = 3;
|
||||
}
|
||||
|
||||
message GitReset {
|
||||
uint64 project_id = 1;
|
||||
reserved 2;
|
||||
|
|
|
@ -340,6 +340,8 @@ messages!(
|
|||
(ListRemoteDirectoryResponse, Background),
|
||||
(ListToolchains, Foreground),
|
||||
(ListToolchainsResponse, Foreground),
|
||||
(LoadCommitDiff, Foreground),
|
||||
(LoadCommitDiffResponse, Foreground),
|
||||
(LspExtExpandMacro, Background),
|
||||
(LspExtExpandMacroResponse, Background),
|
||||
(LspExtOpenDocs, Background),
|
||||
|
@ -534,6 +536,7 @@ request_messages!(
|
|||
(JoinRoom, JoinRoomResponse),
|
||||
(LeaveChannelBuffer, Ack),
|
||||
(LeaveRoom, Ack),
|
||||
(LoadCommitDiff, LoadCommitDiffResponse),
|
||||
(MarkNotificationRead, Ack),
|
||||
(MoveChannel, Ack),
|
||||
(OnTypeFormatting, OnTypeFormattingResponse),
|
||||
|
@ -668,6 +671,7 @@ entity_messages!(
|
|||
JoinProject,
|
||||
LeaveProject,
|
||||
LinkedEditingRange,
|
||||
LoadCommitDiff,
|
||||
MultiLspQuery,
|
||||
RestartLanguageServers,
|
||||
OnTypeFormatting,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue