Fixed: RepositoriesController#revision may show wrong revision (#3779).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2898 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
e89d4825dd
commit
30ad78e57d
8 files changed
+38
-6
No files matched your search
@@ -130,7 +130,7 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def revision
|
||||
@changeset = @repository.changesets.find(:first, :conditions => ["revision LIKE ?", @rev + '%'])
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
raise ChangesetNotFound unless @changeset
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
@@ -92,6 +92,11 @@ class Repository < ActiveRecord::Base
|
||||
path
|
||||
end
|
||||
|
||||
# Finds and returns a revision with a number or the beginning of a hash
|
||||
def find_changeset_by_name(name)
|
||||
changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_i] : ["revision LIKE ?", name + '%']))
|
||||
end
|
||||
|
||||
def latest_changeset
|
||||
@latest_changeset ||= changesets.find(:first)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user