diff options
author | Simon McVittie <smcv@debian.org> | 2016-12-24 14:35:01 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2016-12-28 21:32:12 +0000 |
commit | e193c75b7dd67cee731570c321a121cf79cb3c23 (patch) | |
tree | c7d35a70ebd87ddc79512934a9703bef6e60e4d4 /IkiWiki | |
parent | a67f4d39448e12369426c3509967dc0d4b7afaeb (diff) | |
download | ikiwiki-e193c75b7dd67cee731570c321a121cf79cb3c23.tar ikiwiki-e193c75b7dd67cee731570c321a121cf79cb3c23.tar.gz |
git: do not fail to commit if committer is anonymous
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/git.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 331b48fda..aef0c6cb1 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(IkiWiki::cloak($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(); |