X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=809d0b9d06fc713de3d6eb70ea689007576a0aed;hb=5c9ed5c0a77935dca8bb6f0c1cf6181d2ee54e48;hp=48143341e9f47177228a6f58a96b9af416542dec;hpb=808b73e0d25838e98cb19d0f71e62abc145cbd21;p=dgit.git diff --git a/dgit b/dgit index 48143341..809d0b9d 100755 --- 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 - 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)"); @@ -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; + 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->error and fail "read $dscfn: $!";