From f66eddccc688059fee94b4b7789318e39675d34c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Jul 2008 16:35:18 -0400 Subject: change how web commits are specified The trailer line was a bit complex and ugly; I think it's better to just put "(web)" after the user name. This has a side effect of making web commits with no messages have a completly empty commit message. Use --cleanup=verbatim to force git to accept such. --- IkiWiki/Rcs/git.pm | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'IkiWiki/Rcs') diff --git a/IkiWiki/Rcs/git.pm b/IkiWiki/Rcs/git.pm index f71b57774..c816d1bb5 100644 --- a/IkiWiki/Rcs/git.pm +++ b/IkiWiki/Rcs/git.pm @@ -324,15 +324,14 @@ sub rcs_commit ($$$;$$) { #{{{ # Set the commit author to the web committer. my %env=%ENV; if (defined $user || defined $ipaddr) { - $ENV{GIT_AUTHOR_NAME}=defined $user ? $user : $ipaddr; + $ENV{GIT_AUTHOR_NAME}=(defined $user ? $user : $ipaddr)." (web)"; $ENV{GIT_AUTHOR_EMAIL}=""; - $message.="\n\nWeb-commit: true\n"; } # git commit returns non-zero if file has not been really changed. # so we should ignore its exit status (hence run_or_non). $message = possibly_foolish_untaint($message); - if (run_or_non('git', 'commit', '-q', '-m', $message, '-i', $file)) { + if (run_or_non('git', 'commit', '--cleanup=verbatim', '-q', '-m', $message, '-i', $file)) { if (length $config{gitorigin_branch}) { run_or_cry('git', 'push', $config{gitorigin_branch}); } @@ -384,29 +383,24 @@ sub rcs_recentchanges ($) { #{{{ }; } - my $web_commit=0; my @messages; my $pastblank=0; foreach my $line (@{$ci->{'comment'}}) { $pastblank=1 if $line eq ''; next if $pastblank && $line=~m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i; - if ($pastblank && $line=~m/^ *web-commit: true$/i) { - $web_commit=1; - next; - } push @messages, { line => $line }; } - my $user; + my $user=$ci->{'author_username'}; + my $web_commit = ($user=~s/\s+\(web\)$//); + # compatability code for old web commit messages - if (! $web_commit && defined $messages[0] && - $messages[0]->{line} =~ m/$config{web_commit_regexp}/) { + if (! $web_commit && + defined $messages[0] && + $messages[0]->{line} =~ m/$config{web_commit_regexp}/) { $user = defined $2 ? "$2" : "$3"; $messages[0]->{line} = $4; } - else { - $user = $ci->{'author_username'}; - } push @rets, { rev => $sha1, -- cgit v1.2.3