3 Match 'web commit from' in SVN and git, these are web
4 commits too. Show the IP instead of the user 'www-data' (which is kind
5 of security fix too, since the user Apache is running as was visible).
7 Note that the git backend patch is untested.
8 Recai, could you test it? (if Joey finds the change acceptable that is).
10 Index: IkiWiki/Rcs/svn.pm
11 ===================================================================
12 --- IkiWiki/Rcs/svn.pm (revision 904)
13 +++ IkiWiki/Rcs/svn.pm (working copy)
18 -my $svn_webcommit=qr/^web commit by (\w+):?(.*)/;
19 +my $svn_webcommit=qr/^web commit (by (\w+)|from (\d+\.\d+\.\d+\.\d+)):?(.*)/;
21 sub svn_info ($$) { #{{{
25 if (defined $message[0] &&
26 $message[0]->{line}=~/$svn_webcommit/) {
28 - $message[0]->{line}=$2;
29 + $user=defined $2 ? "$2" : "$3";
30 + $message[0]->{line}=$4;
36 my $message=`svnlook log $config{svnrepo} -r $rev`;
37 if ($message=~/$svn_webcommit/) {
40 + $user=defined $2 ? "$2" : "$3";
45 Index: IkiWiki/Rcs/git.pm
46 ===================================================================
47 --- IkiWiki/Rcs/git.pm (revision 904)
48 +++ IkiWiki/Rcs/git.pm (working copy)
50 my $master_branch = 'master'; # working branch
51 my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums
52 my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes
53 -my $web_commit_msg = qr/^web commit by (\w+):?(.*)/; # pattern for web commits
54 +my $web_commit_msg = qr/^web commit (by (\w+)|from (\d+\.\d+\.\d+\.\d+)):?(.*)/;
56 sub _safe_git (&@) { #{{{
57 # Start a child process safely without resorting /bin/sh.
60 if (defined $message[0] &&
61 $message[0]->{line} =~ m/$web_commit_msg/) {
63 - $message[0]->{line} = $2;
64 + $user=defined $2 ? "$2" : "$3";
65 + $message[0]->{line}=$4;
68 $user = $ci->{'author_username'};
72 if (@{ $ci->{'comment'} }[0] =~ m/$web_commit_msg/) {
75 + $user = defined $2 ? "$2" : "$3";
78 $user = $ci->{'author_username'};
79 $message = join "\n", @{ $ci->{'comment'} };