From 3767a11d21aea98d5d9ba08bf10934752cfe6d49 Mon Sep 17 00:00:00 2001 From: Jeremy McAnally Date: Wed, 4 Jul 2012 12:32:47 -0400 Subject: [PATCH] Rename variables to be more clear and fix reference to non-existent 'ext' variable --- lib/gollum/committer.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/gollum/committer.rb b/lib/gollum/committer.rb index 16fef19b..0f112f11 100644 --- a/lib/gollum/committer.rb +++ b/lib/gollum/committer.rb @@ -96,9 +96,13 @@ module Gollum tree.blobs.each do |blob| next if page_path_scheduled_for_deletion?(index.tree, fullpath) - file = blob.name.downcase.sub(/\.\w+$/, '') - file_ext = ::File.extname(blob.name).sub(/^\./, '') - if downpath == file && !(allow_same_ext && file_ext == ext) + + existing_file = blob.name.downcase.sub(/\.\w+$/, '') + existing_file_ext = ::File.extname(blob.name).sub(/^\./, '') + + new_file_ext = ::File.extname(path).sub(/^\./, '') + + if downpath == existing_file && !(allow_same_ext && new_file_ext == existing_file_ext) raise DuplicatePageError.new(dir, blob.name, path) end end