chiark / gitweb /
dgit: Add many pre_* to call no_local_git_cfg
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 28 Jun 2017 16:00:19 +0000 (17:00 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Jul 2017 17:54:00 +0000 (18:54 +0100)
For each operation which can meaningfully be run outside a git tree,
arrange to call no_local_git_cfg and thus avoid running
  git config --local

There is one slight infelicity: some subcommands (notably
archive-api-query) could in theory be run within a git tree and expect
that git tree to influence their output.  However, this seems
unlikely.  In fact, I think there are probably only in-tree callers
and the in-tree callers do not do this.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
dgit

index 682a44fec7d1691a5749ca858743b74c80f52c9f..3ee2de879c177e8be1c361eb05aa1f37637be092 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: Cope with newer git which hates --local outside a working
+    tree.  Closes:#865863.
   * 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 51a2ccb20c3e18406ee60046a5b69b43c18041b0..43f3fd38916f2bac98f06a5e1b0988205fef7e45 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -566,6 +566,9 @@ sub nextarg {
     return scalar shift @ARGV;
 }
 
+sub pre_help () {
+    no_local_git_cfg();
+}
 sub cmd_help () {
     print $helpmsg or die $!;
     exit 0;
@@ -4414,6 +4417,9 @@ END
     responder_send_command("complete");
 }
 
+sub pre_clone () {
+    no_local_git_cfg();
+}
 sub cmd_clone {
     parseopts();
     my $dstdir;
@@ -4624,6 +4630,9 @@ sub i_method {
     { no strict qw(refs); &{"${base}_${selector}"}(@args); }
 }
 
+sub pre_rpush () {
+    no_local_git_cfg();
+}
 sub cmd_rpush {
     my $host = nextarg;
     my $dir;
@@ -6380,6 +6389,9 @@ END
        "results are in in git ref $dstbranch";
 }
 
+sub pre_archive_api_query () {
+    no_local_git_cfg();
+}
 sub cmd_archive_api_query {
     badusage "need only 1 subpath argument" unless @ARGV==1;
     my ($subpath) = @ARGV;
@@ -6396,6 +6408,9 @@ sub repos_server_url () {
     my $url = access_giturl();
 }    
 
+sub pre_clone_dgit_repos_server () {
+    no_local_git_cfg();
+}
 sub cmd_clone_dgit_repos_server {
     badusage "need destination argument" unless @ARGV==1;
     my ($destdir) = @ARGV;
@@ -6405,6 +6420,9 @@ sub cmd_clone_dgit_repos_server {
     exec @cmd or fail "exec git clone: $!\n";
 }
 
+sub pre_print_dgit_repos_server_source_url () {
+    no_local_git_cfg();
+}
 sub cmd_print_dgit_repos_server_source_url {
     badusage "no arguments allowed to dgit print-dgit-repos-server-source-url"
        if @ARGV;