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");
+ }
}
}
my %env=%ENV;
- ensure_committer();
-
if (defined $params{session}) {
# Set the commit author and email based on web session info.
my $u;
}
}
+ ensure_committer();
+
$params{message} = IkiWiki::possibly_foolish_untaint($params{message});
my @opts;
if ($params{message} !~ /\S/) {
ensure_committer();
- run_or_cry('git', 'add', $file);
+ run_or_cry('git', 'add', '--', $file);
}
sub rcs_remove ($) {
ensure_committer();
- run_or_cry('git', 'rm', '-f', $file);
+ run_or_cry('git', 'rm', '-f', '--', $file);
}
sub rcs_rename ($$) {
ensure_committer();
- run_or_cry('git', 'mv', '-f', $src, $dest);
+ run_or_cry('git', 'mv', '-f', '--', $src, $dest);
}
sub rcs_recentchanges ($) {