From 379037956a6cb88cb826a7f57276fca4a2c6c084 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Thu, 11 Sep 2025 10:02:51 +0200 Subject: [PATCH] remote-helper: Prevent doubly verifying each push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The context of the invocation of `git push` "internally" by the remote helper is the same as by the user invoking `git push` most of the time. That is, these pushes run within the same repository, thus the configuration for pre-push hooks applies to both. This leads to every push being verified *twice*. If the user intends to configure pre-push hooks, then they would do that on the remote with URL `rad://…`, and so the hook would be executed before `git-remote-rad` even gets called. We thus specify `--no-verify` to not verify again. --- crates/radicle-remote-helper/src/push.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/radicle-remote-helper/src/push.rs b/crates/radicle-remote-helper/src/push.rs index c7432fde..5e02f7d9 100644 --- a/crates/radicle-remote-helper/src/push.rs +++ b/crates/radicle-remote-helper/src/push.rs @@ -890,8 +890,18 @@ fn push_ref( // This happens during the `list for-push` phase. let refspec = git::Refspec { src, dst, force }; let repo = working.workdir().unwrap_or_else(|| working.path()); - - let mut args = vec!["push".to_string()]; + + let mut args = vec![ + "push".to_string(), + // This push is "internal" from the point of view of the user. + // If they want to run a pre-push hook, then they would configure + // this on their remote, and the hook would run before we get here. + // However, the context of this invocation of `git push` is + // the same repository, so if the user has configured a pre-push + // hook it would run twice, which is not what we want, so set this + // option. + "--no-verify".to_string(), + ]; let verbosity: git::Verbosity = verbosity.into(); args.extend(verbosity.into_flag());