git: Handle git pre-commit hooks separately (#43285)

We now run git pre-commit hooks before we commit. This ensures we don't
run into timeout issues with askpass delegate and report invalid error
to the user.

Closes #43157

Release Notes:

- Fixed long running pre-commit hooks causing committing from Zed to
fail.

Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Jakub Konka
2025-11-22 00:33:32 +01:00
committed by GitHub
co-authored by Cole Miller
parent 279b76d440
commit d07193cdf2
8 changed files with 128 additions and 5 deletions
+9 -1
View File
@@ -3,7 +3,7 @@ use anyhow::{Context as _, Result, bail};
use collections::{HashMap, HashSet};
use futures::future::{self, BoxFuture, join_all};
use git::{
Oid,
Oid, RunHook,
blame::Blame,
repository::{
AskPassDelegate, Branch, CommitDetails, CommitOptions, FetchOptions, GitRepository,
@@ -532,6 +532,14 @@ impl GitRepository for FakeGitRepository {
unimplemented!()
}
fn run_hook(
&self,
_hook: RunHook,
_env: Arc<HashMap<String, String>>,
) -> BoxFuture<'_, Result<()>> {
unimplemented!()
}
fn push(
&self,
_branch: String,