diff options
author | Simon McVittie <smcv@debian.org> | 2015-11-30 20:46:12 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2015-11-30 20:46:58 +0000 |
commit | 1f635c6dcaeff8f869f874f659da875c4e7f1863 (patch) | |
tree | 35fe60ff21c54eae1572a902aaa6dc646904fb8b /IkiWiki | |
parent | 8550c397016bd66095f24de64b077526e08bbab2 (diff) | |
download | ikiwiki-1f635c6dcaeff8f869f874f659da875c4e7f1863.tar ikiwiki-1f635c6dcaeff8f869f874f659da875c4e7f1863.tar.gz |
ensure_committer: don't do anything if we have the environment variables
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/git.pm | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 12e79f3dd..f963f06ba 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -221,15 +221,18 @@ sub run_or_cry ($@) { safe_git(sub { warn @_ }, undef, @_) } sub run_or_non ($@) { safe_git(undef, undef, @_) } sub ensure_committer { - my $name = join('', run_or_non("git", "config", "user.name")); - my $email = join('', run_or_non("git", "config", "user.email")); - - if (! length $name) { - run_or_die("git", "config", "user.name", "IkiWiki"); + if (! length $ENV{GIT_AUTHOR_NAME} || ! length $ENV{GIT_COMMITTER_NAME}) { + my $name = join('', run_or_non("git", "config", "user.name")); + if (! length $name) { + run_or_die("git", "config", "user.name", "IkiWiki"); + } } - if (! length $email) { - run_or_die("git", "config", "user.email", "ikiwiki.info"); + if (! length $ENV{GIT_AUTHOR_EMAIL} || ! length $ENV{GIT_COMMITTER_EMAIL}) { + my $email = join('', run_or_non("git", "config", "user.email")); + if (! length $email) { + run_or_die("git", "config", "user.email", "ikiwiki.info"); + } } } @@ -585,8 +588,6 @@ sub rcs_commit_helper (@) { my %env=%ENV; - ensure_committer(); - if (defined $params{session}) { # Set the commit author and email based on web session info. my $u; @@ -610,6 +611,8 @@ sub rcs_commit_helper (@) { } } + ensure_committer(); + $params{message} = IkiWiki::possibly_foolish_untaint($params{message}); my @opts; if ($params{message} !~ /\S/) { |