]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
git: do not fail to commit if committer is anonymous
authorSimon McVittie <smcv@debian.org>
Mon, 26 Dec 2016 18:21:37 +0000 (18:21 +0000)
committerSimon McVittie <smcv@debian.org>
Wed, 11 Jan 2017 19:55:09 +0000 (19:55 +0000)
(cherry picked from commit c86046090e1dc31035e4db12e4f29562634d621e)

IkiWiki/Plugin/git.pm

index 5ec68b0ce4856f3e0dab7d2b65a00ee73aafd9fe..5d7415ffa6860651d92168ffca9049114e3985ca 100644 (file)
@@ -600,18 +600,24 @@ sub rcs_commit_helper (@) {
                elsif (defined $params{session}->remote_addr()) {
                        $u=$params{session}->remote_addr();
                }
-               if (defined $u) {
+               if (length $u) {
                        $u=encode_utf8($u);
                        $ENV{GIT_AUTHOR_NAME}=$u;
                }
+               else {
+                       $u = 'anonymous';
+               }
                if (defined $params{session}->param("nickname")) {
                        $u=encode_utf8($params{session}->param("nickname"));
                        $u=~s/\s+/_/g;
                        $u=~s/[^-_0-9[:alnum:]]+//g;
                }
-               if (defined $u) {
+               if (length $u) {
                        $ENV{GIT_AUTHOR_EMAIL}="$u\@web";
                }
+               else {
+                       $ENV{GIT_AUTHOR_EMAIL}='anonymous@web';
+               }
        }
 
        ensure_committer();