diff options
author | Valery Sizov <valery@gitlab.com> | 2016-10-19 19:43:04 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-10-19 19:48:12 +0300 |
commit | 5b17efb4b45dc97621a46d9cec33f3e94b2c7a8c (patch) | |
tree | 0e6510bffd9611ed47769731aecef92fc4e70676 /app/models | |
parent | f0c7e6713f2778a2b52ab8091c398a96982380de (diff) | |
download | gitlab-ce-refactoring_find_commits_method.tar.gz |
Refactoring find_commits functionalityrefactoring_find_commits_method
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/repository.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 72e473871fa..bb1118af907 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -109,6 +109,10 @@ class Repository end def find_commits_by_message(query, ref = nil, path = nil, limit = 1000, offset = 0) + unless exists? && has_visible_content? && query.present? + return [] + end + ref ||= root_ref args = %W( @@ -118,8 +122,7 @@ class Repository args = args.concat(%W(-- #{path})) if path.present? git_log_results = Gitlab::Popen.popen(args, path_to_repo).first.lines.map(&:chomp) - commits = git_log_results.map { |c| commit(c) } - commits + git_log_results.map { |c| commit(c) }.compact end def find_branch(name, fresh_repo: true) |