Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Increase askpass timeout for git operations (#42946)

Bhuminjay Sonia74aac88c957
diff --git a/crates/git/src/git.rs b/crates/git/src/git.rs
index 8b8f88ef65b..197ce4d6fb3 100644
--- a/crates/git/src/git.rs
+++ b/crates/git/src/git.rs
@@ -232,12 +232,14 @@ impl From<Oid> for usize {
#[derive(Copy, Clone, Debug)]
pub enum RunHook {
PreCommit,
+ PrePush,
}
impl RunHook {
pub fn as_str(&self) -> &str {
match self {
Self::PreCommit => "pre-commit",
+ Self::PrePush => "pre-push",
}
}
@@ -248,6 +250,7 @@ impl RunHook {
pub fn from_proto(value: i32) -> Option<Self> {
match value {
0 => Some(Self::PreCommit),
+ 1 => Some(Self::PrePush),
_ => None,
}
}
diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs
index be08ed27440..58181e20e96 100644
--- a/crates/project/src/git_store.rs
+++ b/crates/project/src/git_store.rs
@@ -4648,9 +4648,11 @@ impl Repository {
});
let this = cx.weak_entity();
+ let rx = self.run_hook(RunHook::PrePush, cx);
self.send_job(
Some(format!("git push {} {} {}", args, remote, branch).into()),
move |git_repo, mut cx| async move {
+ rx.await??;
match git_repo {
RepositoryState::Local(LocalRepositoryState {
backend,
diff --git a/crates/proto/proto/git.proto b/crates/proto/proto/git.proto
index 6ef21c2d7a1..de6a5f676df 100644
--- a/crates/proto/proto/git.proto
+++ b/crates/proto/proto/git.proto
@@ -565,6 +565,7 @@ message GitCreateWorktree {
message RunGitHook {
enum GitHook {
PRE_COMMIT = 0;
+ PRE_PUSH = 1;
}
uint64 project_id = 1;