chiark / gitweb /
dgit: Set default dsc import distro when suppressing Dgit field.
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 5ca4a817aa1ddf47c52ace3f2e36f12ae5b53391..f4a470d941449916b965b56113968dde52950f62 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2799,6 +2799,11 @@ sub fetch_from_archive_record_2 ($) {
     }
 }
 
+sub parse_dsc_field_def_dsc_distro () {
+    $dsc_distro //= cfg qw(dgit.default.old-dsc-distro
+                          dgit.default.distro);
+}
+
 sub parse_dsc_field ($$) {
     my ($dsc, $what) = @_;
     my $f;
@@ -2807,20 +2812,16 @@ sub parse_dsc_field ($$) {
        last if defined $f;
     }
 
-    my $def_dsc_distro = sub {
-       $dsc_distro //= cfg qw(dgit.default.old-dsc-distro
-                              dgit.default.distro);
-    };
-
     if (!defined $f) {
        progress "$what: NO git hash";
+       parse_dsc_field_def_dsc_distro();
     } elsif (($dsc_hash, $dsc_distro, $dsc_hint_tag, $dsc_hint_url)
             = $f =~ m/^(\w+)\s+($distro_re)\s+($versiontag_re)\s+(\S+)(?:\s|$)/) {
        progress "$what: specified git info ($dsc_distro)";
        $dsc_hint_tag = [ $dsc_hint_tag ];
     } elsif ($f =~ m/^\w+\s*$/) {
        $dsc_hash = $&;
-       $def_dsc_distro->();
+       parse_dsc_field_def_dsc_distro();
        $dsc_hint_tag = [ debiantags +(getfield $dsc, 'Version'),
                          $dsc_distro ];
        progress "$what: specified git hash";
@@ -6116,6 +6117,7 @@ sub cmd_import_dsc {
 
     parse_dsc_field($dsc, "Dgit metadata in .dsc")
        unless forceing [qw(import-dsc-with-dgit-field)];
+    parse_dsc_field_def_dsc_distro();
 
     if (defined $dsc_hash) {
        progress "dgit: import-dsc of .dsc with Dgit field, using git hash";