From: Ian Jackson Date: Sun, 12 Jan 2014 18:24:18 +0000 (+0000) Subject: dgit-repos-server: wip X-Git-Tag: debian/0.22~109 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=86b0a275600e7e40a5cda380797163dc661f903d dgit-repos-server: wip --- diff --git a/dgit-repos-server b/dgit-repos-server index 0f7c4b0d..677e3d71 100644 --- a/dgit-repos-server +++ b/dgit-repos-server @@ -242,7 +242,7 @@ sub verifytag () { } sub checktag () { - tagh1('object') eq $branchval or die; + tagh1('object') eq $commit or die; tagh1('type') eq 'commit' or die; tagh1('tag') eq $tagname or die; @@ -250,9 +250,22 @@ sub checktag () { $v =~ y/~:/_%/; $tagname eq "debian/$v" or die; - check fast forward; + # check that our ref is being fast-forwarded + if ($oldcommit =~ m/[^0]/) { + $?=0; $!=0; my $mb = `git merge-base $commit $oldcommit`; + chomp $mb; + $mb eq $oldcommit or reject "not fast forward on dgit branch"; + } } +sub onwardpush () { + $!=0; + my $r = system (qw(git send-pack), + $destrepo, + "$commit:refs/dgit/$suite", + "$tagval:refs/tags/$tagname"); + !$r or die "onward push failed: $r $!"; +} sub stunthook () { chdir $workrepo or die "chdir $workrepo: $!"; @@ -261,7 +274,7 @@ sub stunthook () { parsetag(); verifytag(); checktag(); -... ... + onwardpush(); } #----- arg parsing and main program ----- @@ -308,6 +321,10 @@ sub parseargs () { or die "requested command $cmd not understood"; $method = $1; $pkg = $2; + my $func = $method; + $func =~ y/-/_/; + $func = $main::{"main__$func"}; + &$func; } else { die; } @@ -315,7 +332,7 @@ sub parseargs () { $destrepo = "$dgitrepos/$pkg.git"; } -sub main () { +sub main__git_receive_pack () { parseargs(); fixme check method; makeworkingclone();