it does not assume you want to revert the parent of the first sha when reverting 2 shas
This commit is contained in:
@@ -89,16 +89,11 @@ module Precious
|
|||||||
shas = params[:splat].first.split("/")
|
shas = params[:splat].first.split("/")
|
||||||
sha1 = shas.shift
|
sha1 = shas.shift
|
||||||
sha2 = shas.shift
|
sha2 = shas.shift
|
||||||
sha1 = "#{sha1}^" if sha2
|
|
||||||
|
|
||||||
if wiki.revert_page(@page, sha1, sha2, commit_message)
|
if wiki.revert_page(@page, sha1, sha2, commit_message)
|
||||||
redirect "/#{CGI.escape(@name)}"
|
redirect "/#{CGI.escape(@name)}"
|
||||||
else
|
else
|
||||||
if sha2
|
sha2, sha1 = sha1, "#{sha1}^" if !sha2
|
||||||
sha1.chomp!('^')
|
|
||||||
else
|
|
||||||
sha2, sha1 = sha1, "#{sha1}^"
|
|
||||||
end
|
|
||||||
@versions = [sha1, sha2]
|
@versions = [sha1, sha2]
|
||||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||||
@diff = diffs.first
|
@diff = diffs.first
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@ context "Frontend" do
|
|||||||
test "reverts multiple commits" do
|
test "reverts multiple commits" do
|
||||||
page1 = @wiki.page('A')
|
page1 = @wiki.page('A')
|
||||||
|
|
||||||
post "/revert/A/302a5491a9a5ba12c7652ac831a44961afa312d2/b26b791cb7917c4f37dd9cb4d1e0efb24ac4d26f"
|
post "/revert/A/fc66539528eb96f21b2bbdbf557788fe8a1196ac/b26b791cb7917c4f37dd9cb4d1e0efb24ac4d26f"
|
||||||
follow_redirect!
|
follow_redirect!
|
||||||
assert last_response.ok?
|
assert last_response.ok?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user