gitlab-org--gitlab-foss/spec
Timothy Andrew f51af49676 Support wildcard matches for protected branches at the model level.
1. The main implementation is in the `ProtectedBranch` model. The
   wildcard is converted to a Regex and compared. This has been tested
   thoroughly.

    - While `Project#protected_branch?` is the main entry point,
      `project#open_branches` and
      `project#developers_can_push_to_protected_branch?`
      have also been modified to work with wildcard protected branches.

    - The regex is memoized (within the `ProtectedBranch` instance)

2. Improve the performance of `Project#protected_branch?`

    -  This method is called from `Project#open_branches` once _per branch_
       in the project, to check if that branch is protected or not.

    -  Before, `#protected_branch?` was making a database call every
       time it was invoked (in the above case, that amounts to once
       per branch), which is expensive.

    -  This commit caches the list of protected branches in memory, which
       reduces the number of database calls down to 1.

    -  A downside to this approach is that `#protected_branch?` _could_
       return a stale value (due to the caching), but this is
       an acceptable tradeoff.

3. Remove the (now) unused `Project#protected_branch_names` method.

    - This was previously used to check for protected branch status.
2016-07-05 10:50:34 +05:30
..
config
controllers Assert against `ActionMailer::Base.deliveries` relatively. 2016-07-05 10:20:32 +05:30
factories Add Todos API 2016-07-01 10:49:34 +02:00
features Merge branch 'explicit-requesters-scope' into 'master' 2016-07-01 22:23:26 +00:00
finders Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
fixtures optimize png images losslessly using zopflipng 2016-06-29 19:22:15 +08:00
helpers Merge branch 'explicit-requesters-scope' into 'master' 2016-07-01 22:23:26 +00:00
initializers Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
javascripts Merge branch 'emoji-menu-stick-search' into 'master' 2016-06-27 18:03:08 +00:00
lib Merge branch 'master' into dev-master 2016-07-02 22:58:21 +02:00
mailers Merge branch 'explicit-requesters-scope' into 'master' 2016-07-01 22:23:26 +00:00
models Support wildcard matches for protected branches at the model level. 2016-07-05 10:50:34 +05:30
requests Use describe rather than context for this: 2016-07-04 23:05:05 +08:00
routing Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
services Handle custom Git hook result in GitLab UI 2016-07-04 20:16:55 +03:00
support Merge branch 'user-avatar-header' into 'master' 2016-07-04 18:51:12 +00:00
tasks/gitlab Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
views Do not show build retry link when build is active 2016-06-30 11:06:19 +02:00
workers Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
factories_spec.rb
rails_helper.rb
spec_helper.rb Remove coveralls lines 2016-06-30 19:52:36 +02:00
teaspoon_env.rb