chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
import-dsc: Refuse to update a checked-out branch
[dgit.git]
/
dgit
diff --git
a/dgit
b/dgit
index 48143341e9f47177228a6f58a96b9af416542dec..809d0b9d06fc713de3d6eb70ea689007576a0aed 100755
(executable)
--- a/
dgit
+++ b/
dgit
@@
-78,7
+78,8
@@
our %forceopts = map { $_=>0 }
qw(unrepresentable unsupported-source-format
dsc-changes-mismatch changes-origs-exactly
import-gitapply-absurd
qw(unrepresentable unsupported-source-format
dsc-changes-mismatch changes-origs-exactly
import-gitapply-absurd
- import-gitapply-no-absurd);
+ import-gitapply-no-absurd
+ import-dsc-with-dgit-field);
our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
@@
-5283,6
+5284,13
@@
sub cmd_import_dsc {
$dstbranch = "refs/heads/$dstbranch" unless $dstbranch =~ m#^refs/#;
$dstbranch = cmdoutput @git, qw(check-ref-format --normalize), $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: $!";
open D, "<", $dscfn or fail "open import .dsc ($dscfn): $!";
$dscdata = do { local $/ = undef; <D>; };
D->error and fail "read $dscfn: $!";