Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-cvsserver runs hooks/post-receive
author
Michael Witten
<mfwitten@mit.edu>
Fri, 23 Nov 2007 09:12:54 +0000
(
04:12
-0500)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 5 Dec 2007 09:06:02 +0000
(
01:06
-0800)
git-cvsserver just did the following:
(1) run hooks/update
(2) commit if hooks/update passed
This commit simply adds:
(3) run hooks/post-receive
Also, there are a few grammar cleanups and
consistency improvements.
Signed-off-by: Michael Witten <mfwitten@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-cvsserver.perl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
7a4a2e1
)
diff --git
a/git-cvsserver.perl
b/git-cvsserver.perl
index 0d55fec04fa7e3e2a02987543a857a26ae1f96cb..11f5127ce95a376200c12b7a620546e957dfac56 100755
(executable)
--- a/
git-cvsserver.perl
+++ b/
git-cvsserver.perl
@@
-1211,13
+1211,13
@@
sub req_ci
chdir $tmpdir;
chdir $tmpdir;
- # populate the temporary index
based
+ # populate the temporary index
system("git-read-tree", $parenthash);
unless ($? == 0)
{
die "Error running git-read-tree $state->{module} $file_index $!";
}
system("git-read-tree", $parenthash);
unless ($? == 0)
{
die "Error running git-read-tree $state->{module} $file_index $!";
}
- $log->info("Created index '$file_index'
with
for head $state->{module} - exit status $?");
+ $log->info("Created index '$file_index' for head $state->{module} - exit status $?");
my @committedfiles = ();
my %oldmeta;
my @committedfiles = ();
my %oldmeta;
@@
-1237,7
+1237,7
@@
sub req_ci
my ( $filepart, $dirpart ) = filenamesplit($filename);
my ( $filepart, $dirpart ) = filenamesplit($filename);
-
# do a checkout of the file if it
part of this tree
+
# do a checkout of the file if it is
part of this tree
if ($wrev) {
system('git-checkout-index', '-f', '-u', $filename);
unless ($? == 0) {
if ($wrev) {
system('git-checkout-index', '-f', '-u', $filename);
unless ($? == 0) {
@@
-1324,11
+1324,11
@@
sub req_ci
exit;
}
exit;
}
- #
Check that this is allowed, just as we would with a receive-pack
- my @
cmd
= ( $ENV{GIT_DIR}.'hooks/update', "refs/heads/$state->{module}",
+ #
## Emulate git-receive-pack by running hooks/update
+ my @
hook
= ( $ENV{GIT_DIR}.'hooks/update', "refs/heads/$state->{module}",
$parenthash, $commithash );
$parenthash, $commithash );
- if( -x $
cmd
[0] ) {
- unless( system( @
cmd
) == 0 )
+ if( -x $
hook
[0] ) {
+ unless( system( @
hook
) == 0 )
{
$log->warn("Commit failed (update hook declined to update ref)");
print "error 1 Commit failed (update hook declined)\n";
{
$log->warn("Commit failed (update hook declined to update ref)");
print "error 1 Commit failed (update hook declined)\n";
@@
-1337,6
+1337,7
@@
sub req_ci
}
}
}
}
+ ### Update the ref
if (system(qw(git update-ref -m), "cvsserver ci",
"refs/heads/$state->{module}", $commithash, $parenthash)) {
$log->warn("update-ref for $state->{module} failed.");
if (system(qw(git update-ref -m), "cvsserver ci",
"refs/heads/$state->{module}", $commithash, $parenthash)) {
$log->warn("update-ref for $state->{module} failed.");
@@
-1344,6
+1345,18
@@
sub req_ci
exit;
}
exit;
}
+ ### Emulate git-receive-pack by running hooks/post-receive
+ my $hook = $ENV{GIT_DIR}.'hooks/post-receive';
+ if( -x $hook ) {
+ open(my $pipe, "| $hook") || die "can't fork $!";
+
+ local $SIG{PIPE} = sub { die 'pipe broke' };
+
+ print $pipe "$parenthash $commithash refs/heads/$state->{module}\n";
+
+ close $pipe || die "bad pipe: $! $?";
+ }
+
$updater->update();
# foreach file specified on the command line ...
$updater->update();
# foreach file specified on the command line ...