summaryrefslogtreecommitdiff
path: root/IkiWiki/Rcs
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2007-10-31 17:17:03 -0400
committerJoey Hess <joey@kodama.kitenet.net>2007-10-31 17:17:03 -0400
commitc5d9c0d6b641115072137703c61d54229077778a (patch)
tree8f396a7a3172885b0097ecf60f182204859955c9 /IkiWiki/Rcs
parent2a6e353c205a6c2c8b8e2eaf85fe9c585c1af0cd (diff)
* Avoid a race in the git rcs_commit function, by not assuming HEAD will
stay the same for the duration of the function.
Diffstat (limited to 'IkiWiki/Rcs')
-rw-r--r--IkiWiki/Rcs/git.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm
index 84e7d74e5..b5562f0ed 100644
--- a/IkiWiki/Rcs/git.pm
+++ b/IkiWiki/Rcs/git.pm
@@ -165,7 +165,10 @@ sub _parse_diff_tree ($@) { #{{{
# Identification lines for the commit.
while (my $line = shift @{ $dt_ref }) {
# Regexps are semi-stolen from gitweb.cgi.
- if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
+ if ($line =~ m/^commit ([0-9a-fA-F]{40})$/) {
+ $ci{'commit'} = $1;
+ }
+ elsif ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
$ci{'tree'} = $1;
}
elsif ($line =~ m/^parent ([0-9a-fA-F]{40})$/) {
@@ -431,12 +434,9 @@ sub rcs_notify () { #{{{
#
# Here, we rely on a simple fact: we can extract all parts of the
# notification content by parsing the "HEAD" commit (which also
- # triggers a refresh of IkiWiki pages) and we can obtain the diff
- # by comparing HEAD and HEAD^ (the previous commit).
-
- my $sha1 = 'HEAD'; # the commit which triggers this action
+ # triggers a refresh of IkiWiki pages).
- my $ci = git_commit_info($sha1);
+ my $ci = git_commit_info('HEAD');
return if !defined $ci;
my @changed_pages = map { $_->{'file'} } @{ $ci->{'details'} };
@@ -451,6 +451,8 @@ sub rcs_notify () { #{{{
$message = join "\n", @{ $ci->{'comment'} };
}
+ my $sha1 = $ci->{'commit'};
+
require IkiWiki::UserInfo;
send_commit_mails(
sub {