From: Simon McVittie Date: Mon, 26 Dec 2016 18:21:37 +0000 (+0000) Subject: git: do not fail to commit if committer is anonymous X-Git-Tag: debian/3.20120629.2+deb7u2~25 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/f32f6411ff604a879151ab329907afca351ea3b6?ds=inline git: do not fail to commit if committer is anonymous (cherry picked from commit c86046090e1dc31035e4db12e4f29562634d621e) --- diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 5ec68b0ce..5d7415ffa 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -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();