chiark / gitweb /
test suite: gdr-convert-gbp: Provide some unprocessable branches
[dgit.git] / git-debrebase
index 7b2e4f311dfbdf64813d14cb2bac92184837a6ff..3449ec3950ad98064baf6b0736455dfa76c456f9 100755 (executable)
@@ -573,7 +573,7 @@ sub keycommits ($;$$$$) {
     my ($anchor, $breakwater);
     my $clogonly;
     my $cl;
-    $fatal //= sub { fail $_[2]; };
+    $fatal //= sub { fail $_[1]; };
     my $x = sub {
        my ($cb, $tagsfx, $mainwhy, $xwhy) = @_;
        my $why = $mainwhy.$xwhy;
@@ -679,10 +679,11 @@ sub walk ($;$$) {
        if ($nogenerate) {
            return (undef,undef);
        }
-       die "commit $cur: Cannot cope with this commit (d.".
+       fail "found unprocessable commit, cannot cope:".
+           (defined $cl->{Why} ? "; $cl->{Why}": '').
+           " (commit $cur) (d.".
            (join ' ', map { sprintf "%#x", $_->{Differs} }
             @{ $cl->{Parents} }).
-           (defined $cl->{Why} ? "; $cl->{Why}": '').
                 ")";
     };
 
@@ -970,7 +971,8 @@ sub defaultcmd_rebase () {
 }
 
 sub cmd_analyse () {
-    die if ($ARGV[0]//'') =~ m/^-/;
+    badusage "analyse does not support any options"
+       if @ARGV and $ARGV[0] =~ m/^-/;
     badusage "too many arguments to analyse" if @ARGV>1;
     my ($old) = @ARGV;
     if (defined $old) {
@@ -1171,6 +1173,7 @@ sub cmd_new_upstream () {
     # parse args - low commitment
     my $spec_version = shift @ARGV;
     my $new_version = (new Dpkg::Version $spec_version, check => 1);
+    fail "bad version number \`$spec_version'" unless defined $new_version;
     if ($new_version->is_native()) {
        $new_version = (new Dpkg::Version "$spec_version-1", check => 1);
     }
@@ -1658,7 +1661,7 @@ sub cmd_convert_from_gbp () {
        print STDERR "cannot stitch in dgit view: $@\n";
     }
 
-    snags_maybe_bail();
+    snags_maybe_bail_early();
 
     my $work;
 
@@ -1696,6 +1699,8 @@ sub cmd_convert_from_gbp () {
        }
     };
 
+    ffq_check $work;
+    snags_maybe_bail();
     update_head_checkout $old_head, $work, 'convert-from-gbp';
 }