]> sipb.mit.edu Git - ikiwiki.git/commitdiff
change how web commits are specified
authorJoey Hess <joey@kodama.kitenet.net>
Thu, 17 Jul 2008 20:35:18 +0000 (16:35 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Thu, 17 Jul 2008 20:35:18 +0000 (16:35 -0400)
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

index f71b577742e9f595d01ac344f3135e544b3240f4..c816d1bb5ca3234c2ad502da45386455c091efd0 100644 (file)
@@ -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,