gollum/gollum-lib — pull request #57 by timcase (2014-01-20 07:02:53+00:00)
Title: prevent update_page with a rename from clobbering existing files with th...

Hi, I noticed that if I create a new page with the same name and format as an already existing page, Gollum::DuplicatePageError is raised. However, if I update a page with a rename and set the new name to an already existing page, it clobbers the already existing page and this was surprising, I expected instead that Gollum::DuplicatePageError would be raised again. This pull request changes the behavior of Wiki#update_page to raise Gollum::DuplicatePageError when it tries to rename to an already existing page name. I noticed that the same problem seems to exist with Wiki#rename but I didn't fix it because I'm waiting to see if you guys consider this a bug or not. The way update_page was coded with an :allow_same_ext getting passed to Comitter#add_to_index leads me to believe perhaps not raising an error is intentional. If it turns out that it's a bug, let me know and I'd be willing to go back and write the tests to fix rename. Gollum is awesome! https://twitter.com/timcase/status/422840677127290881.