diff options
author | Ciro Santilli <ciro.santilli@gmail.com> | 2014-10-19 18:09:38 +0400 |
---|---|---|
committer | Ciro Santilli <ciro.santilli@gmail.com> | 2014-12-29 01:53:27 +0300 |
commit | cd688a60111853f63413a87ad6632ad57368e886 (patch) | |
tree | 7213f737fa99bc91141e53a637ba95530dfcfdaf /app/services/git_push_service.rb | |
parent | c8bb171664de94778d4e6eba7773596b265f9efb (diff) |
Replace regex methods by string ones since faster
and more readable.
Diffstat (limited to 'app/services/git_push_service.rb')
-rw-r--r-- | app/services/git_push_service.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index 529af1970f6..91c91fb31e7 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -170,23 +170,23 @@ class GitPushService ref_parts = ref.split('/') # Return if this is not a push to a branch (e.g. new commits) - ref_parts[1] =~ /heads/ && oldrev != Gitlab::Git::BLANK_SHA + ref_parts[1].include?('heads') && oldrev != Gitlab::Git::BLANK_SHA end def push_to_new_branch?(ref, oldrev) ref_parts = ref.split('/') - ref_parts[1] =~ /heads/ && oldrev == Gitlab::Git::BLANK_SHA + ref_parts[1].include?('heads') && oldrev == Gitlab::Git::BLANK_SHA end def push_remove_branch?(ref, newrev) ref_parts = ref.split('/') - ref_parts[1] =~ /heads/ && newrev == Gitlab::Git::BLANK_SHA + ref_parts[1].include?('heads') && newrev == Gitlab::Git::BLANK_SHA end def push_to_branch?(ref) - ref =~ /refs\/heads/ + ref.include?('refs/heads') end def is_default_branch?(ref) |