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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
a0d0a017
Commit
a0d0a017
authored
Oct 28, 2015
by
Michael Chmielewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually converted code to following suggestions.
parent
7b62791a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
app/models/repository.rb
app/models/repository.rb
+3
-6
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+1
-1
No files found.
app/models/repository.rb
View file @
a0d0a017
...
@@ -91,12 +91,9 @@ class Repository
...
@@ -91,12 +91,9 @@ class Repository
# Limited to 1000 commits for now, could be parameterized?
# Limited to 1000 commits for now, could be parameterized?
args
=
%W(git log --pretty=%H --max-count 1000 --grep=
#{
query
}
)
args
=
%W(git log --pretty=%H --max-count 1000 --grep=
#{
query
}
)
git_log_results
=
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
)
git_log_results
=
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
).
first
.
lines
.
map
{
|
l
|
l
.
chomp
}
commits
=
git_log_results
.
map
{
|
c
|
commit
(
c
)
}
# 1. Get result, which is 1-element array
commits
# 2. Split on lines
# 3. Recreate array, but remove trailing newline characters on each element
git_log_results
.
first
.
lines
.
map
{
|
l
|
l
.
chomp
}
end
end
def
find_branch
(
name
)
def
find_branch
(
name
)
...
...
spec/models/repository_spec.rb
View file @
a0d0a017
...
@@ -27,7 +27,7 @@ describe Repository do
...
@@ -27,7 +27,7 @@ describe Repository do
end
end
describe
:find_commits_with_matching_log
do
describe
:find_commits_with_matching_log
do
subject
{
repository
.
find_commits_with_matching_log
(
'submodule'
)
}
subject
{
repository
.
find_commits_with_matching_log
(
'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