path: root/dgit
diff options
authorIan Jackson <>2017-07-08 18:46:18 +0100
committerIan Jackson <>2017-07-08 18:54:00 +0100
commit7ad5d889f402e47dba2e51bb1907a505d93c8f38 (patch)
treebaf0186d22898b39b112eeb1e7b6b8172d1671ea /dgit
parent3c25f09fe6a6787011c2a16e12e54da264a881e0 (diff)
dgit: rpush: Do argument parsing and chdir in pre_...
The only thing in between pre_... and cmd_... os git_slurp_config. The code now in pre_... does the following things, all of these should be done before git_slurp_config: * Sets some global variables affecting debugging and logging output. If git_slurp_config is told to print debugging, it should be affected by these changes. * Rearranges its file descriptors so that stdin/stdout are as the rest of dgit expects, and the protocol is on PI/PO. If git_slurp_config were to use stdin/stdout, it ought to use the "normal" versions, and not access the protocol streams. * Checks and calculates the negotiated protocol version. This is not affected by the config, only by the arguments form the caller and our own idea of the protocol versions we support. * Changes to the appropriate working tree. Doing this before slurping the config arranges to honour the local git config from build host working tree. (It also avoids rpush failing on newer git due to asking for git config --local in the wrong place.) Signed-off-by: Ian Jackson <>
Diffstat (limited to 'dgit')
1 files changed, 5 insertions, 2 deletions
diff --git a/dgit b/dgit
index 47c8919..a009e41 100755
--- a/dgit
+++ b/dgit
@@ -4542,7 +4542,7 @@ sub cmd_push {
#---------- remote commands' implementation ----------
-sub cmd_remote_push_build_host {
+sub pre_remote_push_build_host {
my ($nrargs) = shift @ARGV;
my (@rargs) = @ARGV[0..$nrargs-1];
@ARGV = @ARGV[$nrargs..$#ARGV];
@@ -4572,11 +4572,14 @@ sub cmd_remote_push_build_host {
" but invocation host has $vsnwant"
unless defined $protovsn;
- responder_send_command("dgit-remote-push-ready $protovsn");
changedir $dir;
+sub cmd_remote_push_build_host {
+ responder_send_command("dgit-remote-push-ready $protovsn");
+sub pre_remote_push_responder { pre_remote_push_build_host(); }
sub cmd_remote_push_responder { cmd_remote_push_build_host(); }
# ... for compatibility with proto vsn.1 dgit (just so that user gets
# a good error message)