badusage "dry run makes no sense with import-dsc" unless act_local();
+ my $info = "$dscfn";
+
+ my $specbranch = $dstbranch;
$dstbranch = "refs/heads/$dstbranch" unless $dstbranch =~ m#^refs/#;
$dstbranch = cmdoutput @git, qw(check-ref-format --normalize), $dstbranch;
+ my @symcmd = (@git, qw(symbolic-ref -q HEAD));
+ my $chead = cmdoutput_errok @symcmd;
+ defined $chead or $?==256 or failedcmd @symcmd;
+
+ fail "$dstbranch is checked out - will not update it"
+ if defined $chead and $chead eq $dstbranch;
+
open D, "<", $dscfn or fail "open import .dsc ($dscfn): $!";
$dscdata = do { local $/ = undef; <D>; };
D->error and fail "read $dscfn: $!";
plausible server (browse.dgit.d.o? alioth?), and try the import-dsc again.
END
}
- @cmd = (@git, qw(update-ref -m), "dgit import-dsc (Dgit): $dscfn",
+ @cmd = (@git, qw(update-ref -m), "dgit import-dsc (Dgit): $info",
$dstbranch, $dgit_commit);
runcmd @cmd;
progress "dgit: import-dsc updated git ref $dstbranch";
my @mergeinputs = generate_commits_from_dsc();
die unless @mergeinputs == 1;
- my @cmd = (@git, qw(update-ref -m), "dgit import-dsc: $dscfn",
- $dstbranch, $mergeinputs[0]{Commit});
+ my $newhash = $mergeinputs[0]{Commit};
+
+ my @cmd = (@git, qw(update-ref -m), "dgit import-dsc: $info",
+ $dstbranch, $newhash);
runcmd @cmd;
progress "dgit: import-dsc results are in in git ref $dstbranch";
}