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
1cf2b9a6
Commit
1cf2b9a6
authored
Oct 10, 2016
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make searching for commits case insensitive.
Fixes #21800.
parent
4e963fed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
7 deletions
+18
-7
CHANGELOG
CHANGELOG
+1
-0
app/models/repository.rb
app/models/repository.rb
+4
-2
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+13
-5
No files found.
CHANGELOG
View file @
1cf2b9a6
...
@@ -64,6 +64,7 @@ v 8.13.0 (unreleased)
...
@@ -64,6 +64,7 @@ v 8.13.0 (unreleased)
- Fix unnecessary escaping of reserved HTML characters in milestone title. !6533
- Fix unnecessary escaping of reserved HTML characters in milestone title. !6533
- Add organization field to user profile
- Add organization field to user profile
- Fix deploy status responsiveness error !6633
- Fix deploy status responsiveness error !6633
- Make searching for commits case insensitive
- Fix resolved discussion display in side-by-side diff view !6575
- Fix resolved discussion display in side-by-side diff view !6575
- Optimize GitHub importing for speed and memory
- Optimize GitHub importing for speed and memory
- API: expose pipeline data in builds API (!6502, Guilherme Salazar)
- API: expose pipeline data in builds API (!6502, Guilherme Salazar)
...
...
app/models/repository.rb
View file @
1cf2b9a6
...
@@ -111,8 +111,10 @@ class Repository
...
@@ -111,8 +111,10 @@ class Repository
def
find_commits_by_message
(
query
,
ref
=
nil
,
path
=
nil
,
limit
=
1000
,
offset
=
0
)
def
find_commits_by_message
(
query
,
ref
=
nil
,
path
=
nil
,
limit
=
1000
,
offset
=
0
)
ref
||=
root_ref
ref
||=
root_ref
# Limited to 1000 commits for now, could be parameterized?
args
=
%W(
args
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
log
#{
ref
}
--pretty=%H --skip
#{
offset
}
--max-count
#{
limit
}
--grep=
#{
query
}
)
#{
Gitlab
.
config
.
git
.
bin_path
}
log
#{
ref
}
--pretty=%H --skip
#{
offset
}
--max-count
#{
limit
}
--grep=
#{
query
}
--regexp-ignore-case
)
args
=
args
.
concat
(
%W(--
#{
path
}
)
)
if
path
.
present?
args
=
args
.
concat
(
%W(--
#{
path
}
)
)
if
path
.
present?
git_log_results
=
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
).
first
.
lines
.
map
(
&
:chomp
)
git_log_results
=
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
).
first
.
lines
.
map
(
&
:chomp
)
...
...
spec/models/repository_spec.rb
View file @
1cf2b9a6
...
@@ -97,12 +97,20 @@ describe Repository, models: true do
...
@@ -97,12 +97,20 @@ describe Repository, models: true do
end
end
describe
'#find_commits_by_message'
do
describe
'#find_commits_by_message'
do
subject
{
repository
.
find_commits_by_message
(
'submodule'
).
map
{
|
k
|
k
.
id
}
}
it
'returns commits with messages containing a given string'
do
commit_ids
=
repository
.
find_commits_by_message
(
'submodule'
).
map
(
&
:id
)
it
{
is_expected
.
to
include
(
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
}
expect
(
commit_ids
).
to
include
(
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
it
{
is_expected
.
to
include
(
'6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
)
}
expect
(
commit_ids
).
to
include
(
'6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
)
it
{
is_expected
.
to
include
(
'cfe32cf61b73a0d5e9f13e774abde7ff789b1660'
)
}
expect
(
commit_ids
).
to
include
(
'cfe32cf61b73a0d5e9f13e774abde7ff789b1660'
)
it
{
is_expected
.
not_to
include
(
'913c66a37b4a45b9769037c55c2d238bd0942d2e'
)
}
expect
(
commit_ids
).
not_to
include
(
'913c66a37b4a45b9769037c55c2d238bd0942d2e'
)
end
it
'is case insensitive'
do
commit_ids
=
repository
.
find_commits_by_message
(
'SUBMODULE'
).
map
(
&
:id
)
expect
(
commit_ids
).
to
include
(
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
end
end
end
describe
'#blob_at'
do
describe
'#blob_at'
do
...
...
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