Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b1f4aaa5
Commit
b1f4aaa5
authored
Oct 27, 2015
by
Michael Chmielewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trying to incorporate suggestions from comments on Merge Request 1661
parent
8e8fb87d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
app/models/repository.rb
app/models/repository.rb
+5
-4
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+2
-2
No files found.
app/models/repository.rb
View file @
b1f4aaa5
...
@@ -87,10 +87,11 @@ class Repository
...
@@ -87,10 +87,11 @@ class Repository
commits
commits
end
end
def
commits_with_log_matching
(
query
)
def
find_commits_with_matching_log
(
query
)
list
=
Gitlab
::
Git
::
Commit
.
where
(
repo:
raw_repository
,
limit:
1000
)
# Limited to 1000 commits for now, could be parameterized?
list
=
Commit
.
decorate
(
list
,
@project
)
if
list
.
present?
args
=
%W(git log --pretty=%H --max-count 1000 --grep=
#{
query
}
)
list
.
select!
{
|
c
|
c
.
message
.
match
/
#{
query
}
/i
}
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
)
end
end
def
find_branch
(
name
)
def
find_branch
(
name
)
...
...
lib/gitlab/project_search_results.rb
View file @
b1f4aaa5
...
@@ -77,7 +77,7 @@ module Gitlab
...
@@ -77,7 +77,7 @@ module Gitlab
end
end
def
commits
def
commits
project
.
repository
.
commits_with_log_matchin
g
(
query
)
project
.
repository
.
find_commits_with_matching_lo
g
(
query
)
end
end
def
limit_project_ids
def
limit_project_ids
...
...
spec/models/repository_spec.rb
View file @
b1f4aaa5
...
@@ -26,8 +26,8 @@ describe Repository do
...
@@ -26,8 +26,8 @@ describe Repository do
it
{
is_expected
.
to
eq
(
'c1acaa58bbcbc3eafe538cb8274ba387047b69f8'
)
}
it
{
is_expected
.
to
eq
(
'c1acaa58bbcbc3eafe538cb8274ba387047b69f8'
)
}
end
end
describe
:
commits_with_log_matchin
g
do
describe
:
find_commits_with_matching_lo
g
do
subject
{
repository
.
commits_with_log_matchin
g
(
'submodule'
).
map
{
|
k
|
k
.
id
}
}
subject
{
repository
.
find_commits_with_matching_lo
g
(
'submodule'
).
map
{
|
k
|
k
.
id
}
}
it
{
is_expected
.
to
include
(
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
}
it
{
is_expected
.
to
include
(
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
}
it
{
is_expected
.
to
include
(
'6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
)
}
it
{
is_expected
.
to
include
(
'6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment