Add git blame
(#8889)
This adds a new action to the editor: `editor: toggle git blame`. When used it turns on a sidebar containing `git blame` information for the currently open buffer. The git blame information is updated when the buffer changes. It handles additions, deletions, modifications, changes to the underlying git data (new commits, changed commits, ...), file saves. It also handles folding and wrapping lines correctly. When the user hovers over a commit, a tooltip displays information for the commit that introduced the line. If the repository has a remote with the name `origin` configured, then clicking on a blame entry opens the permalink to the commit on the code host. Users can right-click on a blame entry to get a context menu which allows them to copy the SHA of the commit. The feature also works on shared projects, e.g. when collaborating a peer can request `git blame` data. As of this PR, Zed now comes bundled with a `git` binary so that users don't have to have `git` installed locally to use this feature. ### Screenshots    ### TODOs - [x] Bundling `git` binary ### Release Notes Release Notes: - Added `editor: toggle git blame` command that toggles a sidebar with git blame information for the current buffer. --------- Co-authored-by: Antonio <antonio@zed.dev> Co-authored-by: Piotr <piotr@zed.dev> Co-authored-by: Bennet <bennetbo@gmx.de> Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
e2d6b0deba
commit
7f54935324
39 changed files with 3760 additions and 157 deletions
|
@ -277,8 +277,8 @@ pub struct LocalRepositoryEntry {
|
|||
}
|
||||
|
||||
impl LocalRepositoryEntry {
|
||||
pub fn load_index_text(&self, relative_file_path: &Path) -> Option<String> {
|
||||
self.repo_ptr.lock().load_index_text(relative_file_path)
|
||||
pub fn repo(&self) -> &Arc<Mutex<dyn GitRepository>> {
|
||||
&self.repo_ptr
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -459,7 +459,7 @@ async fn test_renaming_case_only(cx: &mut TestAppContext) {
|
|||
const OLD_NAME: &str = "aaa.rs";
|
||||
const NEW_NAME: &str = "AAA.rs";
|
||||
|
||||
let fs = Arc::new(RealFs);
|
||||
let fs = Arc::new(RealFs::default());
|
||||
let temp_root = temp_tree(json!({
|
||||
OLD_NAME: "",
|
||||
}));
|
||||
|
@ -969,7 +969,7 @@ async fn test_write_file(cx: &mut TestAppContext) {
|
|||
build_client(cx),
|
||||
dir.path(),
|
||||
true,
|
||||
Arc::new(RealFs),
|
||||
Arc::new(RealFs::default()),
|
||||
Default::default(),
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
@ -1049,7 +1049,7 @@ async fn test_file_scan_exclusions(cx: &mut TestAppContext) {
|
|||
build_client(cx),
|
||||
dir.path(),
|
||||
true,
|
||||
Arc::new(RealFs),
|
||||
Arc::new(RealFs::default()),
|
||||
Default::default(),
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
@ -1153,7 +1153,7 @@ async fn test_fs_events_in_exclusions(cx: &mut TestAppContext) {
|
|||
build_client(cx),
|
||||
dir.path(),
|
||||
true,
|
||||
Arc::new(RealFs),
|
||||
Arc::new(RealFs::default()),
|
||||
Default::default(),
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
@ -1263,7 +1263,7 @@ async fn test_fs_events_in_dot_git_worktree(cx: &mut TestAppContext) {
|
|||
build_client(cx),
|
||||
dot_git_worktree_dir.clone(),
|
||||
true,
|
||||
Arc::new(RealFs),
|
||||
Arc::new(RealFs::default()),
|
||||
Default::default(),
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
@ -1404,7 +1404,7 @@ async fn test_create_dir_all_on_create_entry(cx: &mut TestAppContext) {
|
|||
)
|
||||
});
|
||||
|
||||
let fs_real = Arc::new(RealFs);
|
||||
let fs_real = Arc::new(RealFs::default());
|
||||
let temp_root = temp_tree(json!({
|
||||
"a": {}
|
||||
}));
|
||||
|
@ -2008,7 +2008,7 @@ async fn test_rename_work_directory(cx: &mut TestAppContext) {
|
|||
build_client(cx),
|
||||
root_path,
|
||||
true,
|
||||
Arc::new(RealFs),
|
||||
Arc::new(RealFs::default()),
|
||||
Default::default(),
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
@ -2087,7 +2087,7 @@ async fn test_git_repository_for_path(cx: &mut TestAppContext) {
|
|||
build_client(cx),
|
||||
root.path(),
|
||||
true,
|
||||
Arc::new(RealFs),
|
||||
Arc::new(RealFs::default()),
|
||||
Default::default(),
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
@ -2228,7 +2228,7 @@ async fn test_git_status(cx: &mut TestAppContext) {
|
|||
build_client(cx),
|
||||
root.path(),
|
||||
true,
|
||||
Arc::new(RealFs),
|
||||
Arc::new(RealFs::default()),
|
||||
Default::default(),
|
||||
&mut cx.to_async(),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue