chiark / gitweb /
dgit: Postpone call to git_slurp_config
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 28 Jun 2017 15:39:59 +0000 (16:39 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 8 Jul 2017 17:53:59 +0000 (18:53 +0100)
This is needed to fix #865863: we need to know what our operation is,
before we can decide whether to look for --local git config.

The code which now runs earlier is:
 * The messages about $dryrun_level (which is set only by
   the command line, and not by configuration - verified by
   searching for $dryrun_level).
 * Usage failure if @ARGV empty.  This is not affected by
   configuration.  (parseopts does the argument parsing and
   already runs before git_slurp_config.)
 * Extracting the $cmd from @ARGV.
 * Calling $pre_fn.  There is only one pre_* sub, which is
   pre_gbp_build.  It provides the default for $quilt_mode.
   $quilt_mode is indeed somewhat entangled with the git config,
   but this takes place in parseopts_late_defaults, which is
   called much later.

Therefore there is no functional change.

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

diff --git a/dgit b/dgit
index a4c9640475fcfae13a6093631a2012931fc51648..47c89197f28e618ed01f895b0568a37d8f4f4be6 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -6778,7 +6778,6 @@ if ($ENV{$fakeeditorenv}) {
 
 parseopts();
 check_env_sanity();
-git_slurp_config();
 
 print STDERR "DRY RUN ONLY\n" if $dryrun_level > 1;
 print STDERR "DAMP RUN - WILL MAKE LOCAL (UNSIGNED) CHANGES\n"
@@ -6793,6 +6792,8 @@ $cmd =~ y/-/_/;
 my $pre_fn = ${*::}{"pre_$cmd"};
 $pre_fn->() if $pre_fn;
 
+git_slurp_config();
+
 my $fn = ${*::}{"cmd_$cmd"};
 $fn or badusage "unknown operation $cmd";
 $fn->();