Project

General

Profile

Defect #13592 ยป fix-not-unique.patch

Prepend underscores before non-unique commit SHA-1s - Griffin Smith, 2013-03-25 23:44

View differences:

app/models/repository.rb
30 30

  
31 31
  serialize :extra_info
32 32

  
33
  before_create :check_identifier
34

  
33 35
  before_save :check_default
34 36

  
35 37
  # Raw SQL to delete changesets and changes in the database
......
398 400

  
399 401
  protected
400 402

  
403
  def check_identifier
404
    while self.exists?(:conditions => {:identifier => self.identifier})
405
      self.identifier = "_" + self.identifier
406
    end
407
  end
408

  
401 409
  def check_default
402 410
    if !is_default? && set_as_default?
403 411
      self.is_default = true
    (1-1/1)