1 Looks good, [[patchqueue/done]] -- [[Joey]]
5 Match 'web commit from' in SVN and git, these are web
6 commits too. Show the IP instead of the user 'www-data' (which is kind
7 of security fix too, since the user Apache is running as was visible).
9 Note that the git backend patch is untested.
10 Recai, could you test it? (if Joey finds the change acceptable that is).
12 Index: IkiWiki/Rcs/svn.pm
13 ===================================================================
14 --- IkiWiki/Rcs/svn.pm (revision 904)
15 +++ IkiWiki/Rcs/svn.pm (working copy)
20 -my $svn_webcommit=qr/^web commit by (\w+):?(.*)/;
21 +my $svn_webcommit=qr/^web commit (by (\w+)|from (\d+\.\d+\.\d+\.\d+)):?(.*)/;
23 sub svn_info ($$) { #{{{
27 if (defined $message[0] &&
28 $message[0]->{line}=~/$svn_webcommit/) {
30 - $message[0]->{line}=$2;
31 + $user=defined $2 ? "$2" : "$3";
32 + $message[0]->{line}=$4;
38 my $message=`svnlook log $config{svnrepo} -r $rev`;
39 if ($message=~/$svn_webcommit/) {
42 + $user=defined $2 ? "$2" : "$3";
47 Index: IkiWiki/Rcs/git.pm
48 ===================================================================
49 --- IkiWiki/Rcs/git.pm (revision 904)
50 +++ IkiWiki/Rcs/git.pm (working copy)
52 my $master_branch = 'master'; # working branch
53 my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums
54 my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes
55 -my $web_commit_msg = qr/^web commit by (\w+):?(.*)/; # pattern for web commits
56 +my $web_commit_msg = qr/^web commit (by (\w+)|from (\d+\.\d+\.\d+\.\d+)):?(.*)/;
58 sub _safe_git (&@) { #{{{
59 # Start a child process safely without resorting /bin/sh.
62 if (defined $message[0] &&
63 $message[0]->{line} =~ m/$web_commit_msg/) {
65 - $message[0]->{line} = $2;
66 + $user=defined $2 ? "$2" : "$3";
67 + $message[0]->{line}=$4;
70 $user = $ci->{'author_username'};
74 if (@{ $ci->{'comment'} }[0] =~ m/$web_commit_msg/) {
77 + $user = defined $2 ? "$2" : "$3";
80 $user = $ci->{'author_username'};
81 $message = join "\n", @{ $ci->{'comment'} };