X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=90b1fde67a5cb9887e42dec2e3be18c2c2183347;hb=136eec507183426c8daebd3dc201434608a136a1;hp=a25c74c18bf87a25205da4cfa6562e7e4a234205;hpb=7031bce4c16fea6e76c48753162d07d6aeef3531;p=dgit.git diff --git a/dgit b/dgit index a25c74c1..90b1fde6 100755 --- a/dgit +++ b/dgit @@ -222,7 +222,7 @@ sub no_such_package () { sub changedir ($) { my ($newdir) = @_; printdebug "CD $newdir\n"; - chdir $newdir or die "chdir: $newdir: $!"; + chdir $newdir or confess "chdir: $newdir: $!"; } sub deliberately ($) { @@ -1806,7 +1806,7 @@ sub fetch_from_archive () { # or another, according to us - ie this client's # appropritaely-updated archive view. Also returns the commit id. # If there is nothing in the archive, leaves lrref alone and - # returns undef. + # returns undef. git_fetch_us must have already been called. get_archive_dsc(); if ($dsc) { @@ -2506,21 +2506,8 @@ END if (check_for_git()) { git_fetch_us(); } - my $forceflag = ''; - if (fetch_from_archive()) { - if (is_fast_fwd(lrref(), 'HEAD')) { - # ok - } elsif (deliberately_not_fast_forward) { - $forceflag = '+'; - } else { - fail "dgit push: HEAD is not a descendant". - " of the archive's version.\n". - "dgit: To overwrite its contents,". - " use git merge -s ours ".lrref().".\n". - "dgit: To rewind history, if permitted by the archive,". - " use --deliberately-not-fast-forward"; - } - } else { + my $archive_hash = fetch_from_archive(); + if (!$archive_hash) { $new_package or fail "package appears to be new in this suite;". " if this is intentional, use --new"; @@ -2586,6 +2573,23 @@ END } check_not_dirty(); + + my $forceflag = ''; + if ($archive_hash) { + if (is_fast_fwd($archive_hash, 'HEAD')) { + # ok + } elsif (deliberately_not_fast_forward) { + $forceflag = '+'; + } else { + fail "dgit push: HEAD is not a descendant". + " of the archive's version.\n". + "dgit: To overwrite its contents,". + " use git merge -s ours ".lrref().".\n". + "dgit: To rewind history, if permitted by the archive,". + " use --deliberately-not-fast-forward"; + } + } + changedir $ud; progress "checking that $dscfn corresponds to HEAD"; runcmd qw(dpkg-source -x --),