Git improvements (#24238)

- **Base diffs on uncommitted changes**
- **Show added files in project diff view**
- **Fix git panel optimism**

Release Notes:

- Git: update diffs to be relative to HEAD instead of the index; to pave
the way for showing which hunks are staged

---------

Co-authored-by: Cole <cole@zed.dev>
This commit is contained in:
Conrad Irwin 2025-02-04 23:09:41 -07:00 committed by GitHub
parent 22b7042b9e
commit 0963401a8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 241 additions and 231 deletions

View file

@ -265,13 +265,13 @@ impl GitRepository for RealGitRepository {
.to_path_buf();
if !paths.is_empty() {
let cmd = new_std_command(&self.git_binary_path)
let status = new_std_command(&self.git_binary_path)
.current_dir(&working_directory)
.args(["update-index", "--add", "--remove", "--"])
.args(paths.iter().map(|p| p.as_ref()))
.status()?;
if !cmd.success() {
return Err(anyhow!("Failed to stage paths: {cmd}"));
if !status.success() {
return Err(anyhow!("Failed to stage paths: {status}"));
}
}
Ok(())