Git Panel: separate new and changed (#24181)

Release Notes:

- N/A

---------

Co-authored-by: conrad <conrad@zed.dev>
Co-authored-by: nate <nate@zed.dev>
This commit is contained in:
Mikayla Maki 2025-02-04 01:15:09 -08:00 committed by GitHub
parent 6659aea13b
commit 71f2cbe798
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 666 additions and 589 deletions

View file

@ -2,7 +2,6 @@ use anyhow::{anyhow, Context as _, Result};
use extension::ExtensionHostProxy;
use extension_host::headless_host::HeadlessExtensionStore;
use fs::{CreateOptions, Fs};
use futures::channel::mpsc;
use git::{repository::RepoPath, COMMIT_MESSAGE};
use gpui::{App, AppContext as _, AsyncApp, Context, Entity, PromptLevel, SharedString};
use http_client::HttpClient;
@ -637,15 +636,9 @@ impl HeadlessProject {
.map(PathBuf::from)
.map(RepoPath::new)
.collect();
let (err_sender, mut err_receiver) = mpsc::channel(1);
repository_handle
.stage_entries(entries, err_sender)
.context("staging entries")?;
if let Some(error) = err_receiver.next().await {
Err(error.context("error during staging"))
} else {
Ok(proto::Ack {})
}
repository_handle.stage_entries(entries).await?;
Ok(proto::Ack {})
}
async fn handle_unstage(
@ -665,15 +658,10 @@ impl HeadlessProject {
.map(PathBuf::from)
.map(RepoPath::new)
.collect();
let (err_sender, mut err_receiver) = mpsc::channel(1);
repository_handle
.unstage_entries(entries, err_sender)
.context("unstaging entries")?;
if let Some(error) = err_receiver.next().await {
Err(error.context("error during unstaging"))
} else {
Ok(proto::Ack {})
}
repository_handle.unstage_entries(entries).await?;
Ok(proto::Ack {})
}
async fn handle_commit(
@ -688,17 +676,9 @@ impl HeadlessProject {
let name = envelope.payload.name.map(SharedString::from);
let email = envelope.payload.email.map(SharedString::from);
let (err_sender, mut err_receiver) = mpsc::channel(1);
cx.update(|cx| {
repository_handle
.commit(name.zip(email), err_sender, cx)
.context("unstaging entries")
})??;
if let Some(error) = err_receiver.next().await {
Err(error.context("error during unstaging"))
} else {
Ok(proto::Ack {})
}
repository_handle.commit(name.zip(email)).await?;
Ok(proto::Ack {})
}
async fn handle_open_commit_message_buffer(