From 3441896d54a67afcf18987eed287061d2afea956 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 28 Jun 2017 17:00:19 +0100 Subject: [PATCH] dgit: Add many pre_* to call no_local_git_cfg 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 --- debian/changelog | 2 ++ dgit | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/debian/changelog b/debian/changelog index 682a44fe..3ee2de87 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 51a2ccb2..43f3fd38 100755 --- 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; -- 2.30.2