X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/ed1e1ebe70c8aec06a759d8cd0168f242d28ac17..d3c15aed18ef9e67c3e785ac3cc0426c56e59ac7:/IkiWiki/Plugin/git.pm diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 38254d94a..249338d4d 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -220,22 +220,20 @@ sub run_or_die ($@) { safe_git(\&error, undef, @_) } sub run_or_cry ($@) { safe_git(sub { warn @_ }, undef, @_) } sub run_or_non ($@) { safe_git(undef, undef, @_) } -my $ensured_committer; sub ensure_committer { - return if $ensured_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"); + } } - - $ensured_committer = 1; } sub merge_past ($$$) { @@ -471,7 +469,7 @@ sub git_commit_info ($;$) { my @raw_lines = run_or_die('git', 'log', @opts, '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c', - '-r', $sha1, '--', '.'); + '-r', $sha1, '--no-renames', '--', '.'); my @ci; while (my $parsed = parse_diff_tree(\@raw_lines)) { @@ -590,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; @@ -615,6 +611,8 @@ sub rcs_commit_helper (@) { } } + ensure_committer(); + $params{message} = IkiWiki::possibly_foolish_untaint($params{message}); my @opts; if ($params{message} !~ /\S/) { @@ -656,7 +654,7 @@ sub rcs_add ($) { ensure_committer(); - run_or_cry('git', 'add', $file); + run_or_cry('git', 'add', '--', $file); } sub rcs_remove ($) { @@ -666,7 +664,7 @@ sub rcs_remove ($) { ensure_committer(); - run_or_cry('git', 'rm', '-f', $file); + run_or_cry('git', 'rm', '-f', '--', $file); } sub rcs_rename ($$) { @@ -674,7 +672,7 @@ sub rcs_rename ($$) { ensure_committer(); - run_or_cry('git', 'mv', '-f', $src, $dest); + run_or_cry('git', 'mv', '-f', '--', $src, $dest); } sub rcs_recentchanges ($) {