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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-03 13:28:56 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-03 13:28:56 +0300
commitfb2f8be4d7cddc01471b58334c33ecdee4d0b887 (patch)
treef129d9906fb8c1ef11eec09ad182d0a042102f09 /app/models
parentd0e74f49b47e83ebde89be163a9344a0bae14626 (diff)
parent28f6fba97cb9753c43d109ef4f43439413d4eb69 (diff)
Merge branch 'olhado/gitlab-ce-commit-search'
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index c9b36bd8170..9266ba27f0a 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -87,6 +87,15 @@ class Repository
commits
end
+ def find_commits_by_message(query)
+ # Limited to 1000 commits for now, could be parameterized?
+ args = %W(git log --pretty=%H --max-count 1000 --grep=#{query})
+
+ git_log_results = Gitlab::Popen.popen(args, path_to_repo).first.lines.map(&:chomp)
+ commits = git_log_results.map { |c| commit(c) }
+ commits
+ end
+
def find_branch(name)
branches.find { |branch| branch.name == name }
end