Skip to content

Bug: Protected Branch Name Must be Unique Across Projects (with fix) #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wilsoc5 opened this issue Apr 3, 2015 · 1 comment
Closed
Assignees
Labels
Milestone

Comments

@wilsoc5
Copy link

wilsoc5 commented Apr 3, 2015

We have multiple Xitolite repos across multiple projects hosted on the same Redmine instance. I'm starting to roll out protected branches to ensure no one clobbers the master or the release branches of the git repo. This works for one project. However, as soon as a protected branch name, e.g. master, is used in one project it cannot be used in others.

The fix:
in app/models/repository_protected_branche.rb
The lines:

  ## Validations
  validates :repository_id, presence: true
  validates :path,          presence: true, uniqueness: { scope: :permissions }
  validates :permissions,   presence: true, inclusion: { in: VALID_PERMS }
  validates :user_list,     presence: true

validates :path should be updated

  validates :path,          presence: true, uniqueness: { scope: [:permissions, :repository_id] }
@n-rodriguez
Copy link
Contributor

Merged! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants