From e2fbac96cb362db54e703a035b9ba1c3e4482bae Mon Sep 17 00:00:00 2001 From: rick Date: Wed, 8 Dec 2010 15:55:35 -0800 Subject: [PATCH] sometimes reverts fail, yo --- lib/gollum/wiki.rb | 1 + test/test_page.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/gollum/wiki.rb b/lib/gollum/wiki.rb index 309aebcf..11a20923 100644 --- a/lib/gollum/wiki.rb +++ b/lib/gollum/wiki.rb @@ -320,6 +320,7 @@ module Gollum patch = full_reverse_diff_for(page, sha1, sha2) commit[:parent] = [pcommit] commit[:tree] = @repo.git.apply_patch(pcommit.sha, patch) + return false unless commit[:tree] index = nil sha1 = commit_index(commit) { |i| index = i } diff --git a/test/test_page.rb b/test/test_page.rb index 0502215b..87ba3a89 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -161,4 +161,9 @@ context "Page Reverting" do assert_equal sha, page2.version.sha assert_equal "INITIAL", page2.raw_data.strip end + + test "cannot revert conflicting commit" do + page1 = @wiki.page('A') + assert_equal false, @wiki.revert_page(page1, '302a5491a9a5ba12c7652ac831a44961afa312d2') + end end