chiark / gitweb /
dgit: conflg handling: Undocumented --config-lookup-explode= feature.
[dgit.git] / dgit
diff --git a/dgit b/dgit
index af9b182fcf5e7952479d8778f517f6da53e4f272..e4987ae7984633827e6b4b7a1e919c73d0a8b511 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -691,7 +691,7 @@ sub cfg {
        "$us: distro or suite appears not to be (properly) supported";
 }
 
-sub access_basedistro () {
+sub access_basedistro__noalias () {
     if (defined $idistro) {
        return $idistro;
     } else {   
@@ -711,6 +711,12 @@ sub access_basedistro () {
     }
 }
 
+sub access_basedistro () {
+    my $noalias = access_basedistro__noalias();
+    my $canon = cfg("dgit-distro.$noalias.alias-canon",'RETURN-UNDEF');
+    return $canon // $noalias;
+}
+
 sub access_nomdistro () {
     my $base = access_basedistro();
     my $r = cfg("dgit-distro.$base.nominal-distro",'RETURN-UNDEF') // $base;
@@ -2769,7 +2775,8 @@ sub resolve_dsc_field_commit ($$) {
     return unless defined $dsc_hash;
 
     my $mapref =
-       $already_distro eq $dsc_distro || !$chase_dsc_distro 
+       defined $already_mapref &&
+       ($already_distro eq $dsc_distro || !$chase_dsc_distro)
        ? $already_mapref : undef;
 
     my $do_fetch;
@@ -6029,6 +6036,9 @@ sub cmd_import_dsc {
 
     if (defined $dsc_hash) {
        progress "dgit: import-dsc of .dsc with Dgit field, using git hash";
+       resolve_dsc_field_commit undef, undef;
+    }
+    if (defined $dsc_hash) {
        my @cmd = (qw(sh -ec),
                   "echo $dsc_hash | git cat-file --batch-check");
        my $objgot = cmdoutput @cmd;
@@ -6310,6 +6320,11 @@ sub parseopts () {
                # undocumented, for testing
                push @ropts, $_;
                $need_split_build_invocation = 1;
+           } elsif (m/^--config-lookup-explode=(.+)$/s) {
+               # undocumented, for testing
+               push @ropts, $_;
+               $gitcfgs{cmdline}{$1} = 'CONFIG-LOOKUP-EXPLODE';
+               # ^ it's supposed to be an array ref
            } elsif (m/^(--[-0-9a-z]+)(=|$)/ && ($oi = $valopts_long{$1})) {
                $val = $2 ? $' : undef; #';
                $valopt->($oi->{Long});