nice message if someone tries to revert a merge commit
authorJoey Hess <joey@kitenet.net>
Sat, 23 Oct 2010 21:13:04 +0000 (17:13 -0400)
committerJoey Hess <joey@kitenet.net>
Sat, 23 Oct 2010 21:19:48 +0000 (17:19 -0400)
IkiWiki/Plugin/git.pm
debian/changelog

index f8e16859bed71d28d3dbd6b5ee3a5877782450a2..f5101d904012b8472c1cf77d143ee218f0e32f59 100644 (file)
@@ -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 ($) {
index cee42dc85b546634436cfbe41adbbfdc697d9ca2..b304e4b8645ffb33017784913787733e4f430bf7 100644 (file)
@@ -1,9 +1,9 @@
-ikiwiki (3.20101020) UNRELEASED; urgency=low
+ikiwiki (3.20101023) unstable; urgency=low
 
   * Fix typo that broke anonymous git push.
-  * fix web reversion when the srcdir is in a subdir of the git repo.
+  * Fix web reversion when the srcdir is in a subdir of the git repo.
 
- -- Joey Hess <joeyh@debian.org>  Sat, 23 Oct 2010 15:25:19 -0400
+ -- Joey Hess <joeyh@debian.org>  Sat, 23 Oct 2010 16:36:50 -0400
 
 ikiwiki (3.20101019) unstable; urgency=low