Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-07-06 12:37:30 +0300
committerTimothy Andrew <mail@timothyandrew.net>2016-07-07 07:37:31 +0300
commitb1c81f849e5e5b03f56e89cdcefba029ed5c0543 (patch)
treeccfad1ee0b534e6a2239f8a51fe4d468d4a14896 /app/models/protected_branch.rb
parentd8d5424d25c1738b170d58657ef71d4dbc89ca5e (diff)
Have `Project#open_branches` return branches that are matched by a wildcard protected branch.
1. The `open_branches` method is used to provide a list of branches while creating a protected branch. 2. It makes sense to include branches which are matched by one or more wildcard protected branches, since the user might want to make exact protected branches from these as well. 3. This also provides a large performance improvement. On my machine, in a project with 5000 branches and 2000 protected branches, the `ProtectedBranches#index` page went from a 40 seconds load time to 4 seconds (10x speedup).
Diffstat (limited to 'app/models/protected_branch.rb')
-rw-r--r--app/models/protected_branch.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index d3d5e1d98b2..b7011d7afdf 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -34,7 +34,7 @@ class ProtectedBranch < ActiveRecord::Base
# Checks if this protected branch contains a wildcard
def wildcard?
- self.name.include?('*')
+ self.name && self.name.include?('*')
end
protected