From f32f6411ff604a879151ab329907afca351ea3b6 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 26 Dec 2016 18:21:37 +0000 Subject: [PATCH] git: do not fail to commit if committer is anonymous (cherry picked from commit c86046090e1dc31035e4db12e4f29562634d621e) --- IkiWiki/Plugin/git.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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(); -- 2.39.5