sub lrref () { return "refs/remotes/$remotename/".server_branch($csuite); }
sub rrref () { return server_ref($csuite); }
+sub lrfetchrefs () { return "refs/dgit-fetch/$isuite"; }
+
sub stripepoch ($) {
my ($vsn) = @_;
$vsn =~ s/^\d+\://;
return !!grep { $_ eq "--deliberately-$enquiry" } @deliberatelies;
}
+sub deliberately_not_fast_forward () {
+ deliberately('not-fast-forward') ||
+ deliberately('TEST-not-fast-forward-dgit-only');
+}
+
#---------- remote protocol support, common ----------
# remote push initiator/responder protocol:
sub git_fetch_us () {
runcmd_ordryrun_local @git, qw(fetch),access_giturl(),fetchspec();
+ if (deliberately_not_fast_forward) {
+ runcmd_ordryrun_local @git, qw(fetch -p), access_giturl(),
+ map { "+refs/$_/*:".lrfetchrefs."/$_/*" }
+ qw(tags heads);
+ }
}
sub fetch_from_archive () {
responder_send_command("param head $head");
responder_send_command("param csuite $csuite");
- if ($forceflag && defined $lastpush_hash) {
- git_for_each_tag_referring($lastpush_hash, sub {
- my ($tagobjid,$refobjid,$fullrefname,$tagname) = @_;
- responder_send_command("supersedes $fullrefname=$tagobjid");
- $supersedes{$fullrefname} = $tagobjid;
+ if ($forceflag) {
+ git_for_each_ref(lrfetchrefs, sub {
+ my ($objid,$objtype,$lrfetchrefname,$reftail) = @_;
+ my $rrefname= substr($lrfetchrefname, length(lrfetchrefs) + 1);
+ responder_send_command("supersedes $rrefname=$objid");
+ $supersedes{$rrefname} = $objid;
});
}
if (fetch_from_archive()) {
if (is_fast_fwd(lrref(), 'HEAD')) {
# ok
- } elsif (deliberately('not-fast-forward') ||
- deliberately('TEST-not-fast-forward-dgit-only')) {
+ } elsif (deliberately_not_fast_forward) {
$forceflag = '+';
} else {
fail "dgit push: HEAD is not a descendant".