X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=dgit;h=1aea272c413a246eaad93ae1672dee4a3253254e;hb=bdda173e853cc3ed9178b32810bfb5b1e64d7749;hp=42f9f457332655cae0832baec4c03c4029fcad50;hpb=0c838feda384f115a115ddd609eca9b8c6ece162;p=dgit.git diff --git a/dgit b/dgit index 42f9f457..1aea272c 100755 --- a/dgit +++ b/dgit @@ -2,7 +2,7 @@ # dgit # Integration between git and Debian-style archives # -# Copyright (C)2013 Ian Jackson +# Copyright (C)2013-2015 Ian Jackson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ our $new_package = 0; our $ignoredirty = 0; our $rmonerror = 1; our @deliberatelies; -our %supersedes; +our %previously; our $existing_package = 'dpkg'; our $cleanmode = 'dpkg-source'; our $changes_since_version; @@ -111,6 +111,8 @@ sub lref () { return "refs/heads/".lbranch(); } 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+\://; @@ -162,6 +164,12 @@ sub deliberately ($) { return !!grep { $_ eq "--deliberately-$enquiry" } @deliberatelies; } +sub deliberately_not_fast_forward () { + foreach (qw(not-fast-forward fresh-repo)) { + return 1 if deliberately($_) || deliberately("TEST-dgit-only-$_"); + } +} + #---------- remote protocol support, common ---------- # remote push initiator/responder protocol: @@ -705,7 +713,7 @@ sub archive_api_query_cmd ($) { fail "for $url: stat $key: $!" unless $!==ENOENT; next; } - push @cmd, "--ca-certificate=$key", "--ca-directory=/dev/enoent"; + push @cmd, "--cacert", $key, "--capath", "/dev/enoent"; last; } } @@ -1256,6 +1264,11 @@ sub ensure_we_have_orig () { 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 () { @@ -1529,9 +1542,9 @@ tagger $authline $package release $cversion for $clogsuite ($csuite) [dgit] [dgit distro=$declaredistro$delibs] END - foreach my $ref (sort keys %supersedes) { + foreach my $ref (sort keys %previously) { print TO <",@cmd; + exec @cmd or fail "exec git clone: $!\n"; +} + #---------- argument parsing and main program ---------- sub cmd_version {