aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/git.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-10-23 17:13:04 -0400
committerJoey Hess <joey@kitenet.net>2010-10-23 17:19:48 -0400
commit5db2d6f6b224872b119535d57e675d12a2c7dfe1 (patch)
tree0862beb5190bb7d7e5f54a0c0a19fb9b92a057e7 /IkiWiki/Plugin/git.pm
parent0cc2a36f593fd14b6345ad2c0b446edb2bafbe2e (diff)
downloadikiwiki-5db2d6f6b224872b119535d57e675d12a2c7dfe1.tar
ikiwiki-5db2d6f6b224872b119535d57e675d12a2c7dfe1.tar.gz
nice message if someone tries to revert a merge commit
Diffstat (limited to 'IkiWiki/Plugin/git.pm')
-rw-r--r--IkiWiki/Plugin/git.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm
index f8e16859b..f5101d904 100644
--- a/IkiWiki/Plugin/git.pm
+++ b/IkiWiki/Plugin/git.pm
@@ -848,9 +848,20 @@ sub rcs_preprevert ($) {
# in order to see all changes.
my ($subdir, $rootdir) = git_find_root();
$git_dir=$rootdir;
- my @ret=git_parse_changes(git_commit_info($sha1, 1));
+ my @commits=git_commit_info($sha1, 1);
$git_dir=undef;
- return @ret;
+
+ if (! @commits) {
+ error "unknown commit"; # just in case
+ }
+
+ # git revert will fail on merge commits. Add a nice message.
+ if (exists $commits[0]->{parents} &&
+ @{$commits[0]->{parents}} > 1) {
+ error gettext("you are not allowed to revert a merge");
+ }
+
+ return git_parse_changes(@commits);
}
sub rcs_revert ($) {