chiark / gitweb /
dgit: rpush: Do argument parsing and chdir in pre_...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Jul 2017 17:46:18 +0000 (18:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Jul 2017 17:54:00 +0000 (18:54 +0100)
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 <ijackson@chiark.greenend.org.uk>
debian/changelog
dgit

index b8809bc074b74f05cf6f4d813092734a795f9b5e..682a44fec7d1691a5749ca858743b74c80f52c9f 100644 (file)
@@ -4,6 +4,8 @@ dgit (3.11~) unstable; urgency=medium
     Closes:#867693.
   * dgit: Cope if the archive server sends an HTTP redirect,
     by passing -L to curl.  Closes:#867185,#867309.
+  * dgit: rpush: Honour local git config from build host working
+    tree.
   * test suite: Cope with git restricting ext:: protocols.
 
  --
diff --git a/dgit b/dgit
index 47c89197f28e618ed01f895b0568a37d8f4f4be6..a009e41702c2d62439dad2348bf73e6e259ced95 100755 (executable)
--- 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");
     &cmd_push;
 }
 
+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)