chiark / gitweb /
git fetching: Tidy up a redundant list in git_lrfetch_sane
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 667919c4b38a9705581916ce48b49a00ff26f5e8..845edd3aa22878a3571116c59d37a743fba4ea8f 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -659,7 +659,9 @@ sub git_get_config ($) {
     my ($c) = @_;
     foreach my $src (@gitcfgsources) {
        my $l = $gitcfgs{$src}{$c};
-       printdebug"C $c ".(defined $l ? messagequote "'$l'" : "undef")."\n"
+       printdebug"C $c ".(defined $l ?
+                          join " ", map { messagequote "'$_'" } @$l :
+                          "undef")."\n"
            if $debuglevel >= 4;
        $l or next;
        @$l==1 or badcfg "multiple values for $c".
@@ -675,7 +677,10 @@ sub cfg {
        my $v = git_get_config($c);
        return $v if defined $v;
        my $dv = $defcfg{$c};
-       return $dv if defined $dv;
+       if (defined $dv) {
+           printdebug "CD $c $dv\n" if $debuglevel >= 4;
+           return $dv;
+       }
     }
     badcfg "need value for one of: @_\n".
        "$us: distro or suite appears not to be (properly) supported";
@@ -2485,7 +2490,7 @@ sub ensure_we_have_orig () {
 
 #---------- git fetch ----------
 
-sub lrfetchrefs () { return "refs/dgit-fetch/$csuite"; }
+sub lrfetchrefs () { return "refs/dgit-fetch/".access_basedistro(); }
 sub lrfetchref () { return lrfetchrefs.'/'.server_branch($csuite); }
 
 # We fetch some parts of lrfetchrefs/*.  Ideally we delete these
@@ -2534,7 +2539,7 @@ sub git_lrfetch_sane {
     # git fetch to try to generate it.  If we don't manage to generate
     # the target state, we try again.
 
-    printdebug "git_fetch_us specs @specs\n";
+    printdebug "git_lrfetch_sane specs @specs\n";
 
     my $specre = join '|', map {
        my $x = $_;
@@ -2542,7 +2547,7 @@ sub git_lrfetch_sane {
        $x =~ s/\\\*$/.*/;
        "(?:refs/$x)";
     } @specs;
-    printdebug "git_fetch_us specre=$specre\n";
+    printdebug "git_lrfetch_sane specre=$specre\n";
     my $wanted_rref = sub {
        local ($_) = @_;
        return m/^(?:$specre)$/o;
@@ -2551,7 +2556,7 @@ sub git_lrfetch_sane {
     my $fetch_iteration = 0;
     FETCH_ITERATION:
     for (;;) {
-       printdebug "git_fetch_us iteration $fetch_iteration\n";
+       printdebug "git_lrfetch_sane iteration $fetch_iteration\n";
         if (++$fetch_iteration > 10) {
            fail "too many iterations trying to get sane fetch!";
        }
@@ -2583,11 +2588,10 @@ END
            "+refs/$_:".lrfetchrefs."/$_";
        } @specs;
 
-       printdebug "git_fetch_us fspecs @fspecs\n";
+       printdebug "git_lrfetch_sane fspecs @fspecs\n";
 
        my @fcmd = (@git, qw(fetch -p -n -q), access_giturl(), @fspecs);
-       runcmd_ordryrun_local @git, qw(fetch -p -n -q), access_giturl(),
-           @fspecs;
+       runcmd_ordryrun_local @fcmd if @fspecs;
 
        %lrfetchrefs_f = ();
        my %objgot;
@@ -2639,7 +2643,7 @@ END
        }
        last;
     }
-    printdebug "git_fetch_us: git fetch --no-insane emulation complete\n",
+    printdebug "git_lrfetch_sane: git fetch --no-insane emulation complete\n",
        Dumper(\%lrfetchrefs_f);
 }