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 $email) {
+ run_or_die("git", "config", "user.email", "ikiwiki.info");
+ }
+
+ $ensured_committer = 1;
+}
sub merge_past ($$$) {
# Unlike with Subversion, Git cannot make a 'svn merge -rN:M file'.
my @undo; # undo stack for cleanup in case of an error
my $conflict; # file content with conflict markers
+ ensure_committer();
+
eval {
# Hide local changes from Git by renaming the modified file.
# Relative paths must be converted to absolute for renaming.
sub rcs_update () {
# Update working directory.
+ ensure_committer();
+
if (length $config{gitorigin_branch}) {
run_or_cry('git', 'pull', '--prune', $config{gitorigin_branch});
}
my %env=%ENV;
+ ensure_committer();
+
if (defined $params{session}) {
# Set the commit author and email based on web session info.
my $u;
my ($file) = @_;
+ ensure_committer();
+
run_or_cry('git', 'add', $file);
}
my ($file) = @_;
+ ensure_committer();
+
run_or_cry('git', 'rm', '-f', $file);
}
sub rcs_rename ($$) {
my ($src, $dest) = @_;
+ ensure_committer();
+
run_or_cry('git', 'mv', '-f', $src, $dest);
}
my $rev = shift;
my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint
+ ensure_committer();
+
if (run_or_non('git', 'revert', '--no-commit', $sha1)) {
return undef;
}
non-git VCSs
* debian/copyright: update for the rename of openid-selector to
login-selector
+ * git: if no committer identity is known, set it to
+ "IkiWiki <ikiwiki.info>" in .git/config. This resolves commit errors
+ in versions of git that require a non-trivial committer identity.
-- Simon McVittie <smcv@debian.org> Mon, 15 Jun 2015 18:13:23 +0100