diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-07-17 16:35:18 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-07-17 16:35:18 -0400 |
commit | f66eddccc688059fee94b4b7789318e39675d34c (patch) | |
tree | 29000c7f15a8275a2fd920b42854ed0096e9b7f5 /IkiWiki/Rcs | |
parent | ac62a47ea431271447909b17e883eeaefa87aaea (diff) | |
download | ikiwiki-f66eddccc688059fee94b4b7789318e39675d34c.tar ikiwiki-f66eddccc688059fee94b4b7789318e39675d34c.tar.gz |
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.
Diffstat (limited to 'IkiWiki/Rcs')
-rw-r--r-- | IkiWiki/Rcs/git.pm | 22 |
1 files changed, 8 insertions, 14 deletions
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, |