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
+25
View File
@@ -225,3 +225,28 @@ impl From<Oid> for usize {
u64::from_ne_bytes(u64_bytes) as usize
}
}
#[repr(i32)]
#[derive(Copy, Clone, Debug)]
pub enum RunHook {
PreCommit,
}
impl RunHook {
pub fn as_str(&self) -> &str {
match self {
Self::PreCommit => "pre-commit",
}
}
pub fn to_proto(&self) -> i32 {
*self as i32
}
pub fn from_proto(value: i32) -> Option<Self> {
match value {
0 => Some(Self::PreCommit),
_ => None,
}
}
}