BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
bf0590b3
Commit
bf0590b3
authored
Mar 30, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'allow-multiple-paths-in-repository-log' into 'master'
Support >1 path in Gitlab::Git::Repository#log See merge request !10291
parents
ecfbfbf4
53819c5a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
repository.rb
lib/gitlab/git/repository.rb
+6
-1
repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+23
-4
No files found.
lib/gitlab/git/repository.rb
View file @
bf0590b3
...
...
@@ -346,7 +346,12 @@ module Gitlab
cmd
<<
"--after=
#{
options
[
:after
].
iso8601
}
"
if
options
[
:after
]
cmd
<<
"--before=
#{
options
[
:before
].
iso8601
}
"
if
options
[
:before
]
cmd
<<
sha
cmd
+=
%W[--
#{
options
[
:path
]
}
]
if
options
[
:path
].
present?
# :path can be a string or an array of strings
if
options
[
:path
].
present?
cmd
<<
'--'
cmd
+=
Array
(
options
[
:path
])
end
raw_output
=
IO
.
popen
(
cmd
)
{
|
io
|
io
.
read
}
lines
=
offset_in_ruby
?
raw_output
.
lines
.
drop
(
offset
)
:
raw_output
.
lines
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
bf0590b3
...
...
@@ -771,8 +771,8 @@ describe Gitlab::Git::Repository, seed_helper: true do
commits
=
repository
.
log
(
options
)
expect
(
commits
.
size
).
to
be
>
0
satisfy
do
commits
.
all?
{
|
commit
|
commit
.
created_at
>=
options
[
:after
]
}
expect
(
commits
).
to
satisfy
do
|
commits
|
commits
.
all?
{
|
commit
|
commit
.
time
>=
options
[
:after
]
}
end
end
end
...
...
@@ -784,8 +784,27 @@ describe Gitlab::Git::Repository, seed_helper: true do
commits
=
repository
.
log
(
options
)
expect
(
commits
.
size
).
to
be
>
0
satisfy
do
commits
.
all?
{
|
commit
|
commit
.
created_at
<=
options
[
:before
]
}
expect
(
commits
).
to
satisfy
do
|
commits
|
commits
.
all?
{
|
commit
|
commit
.
time
<=
options
[
:before
]
}
end
end
end
context
'when multiple paths are provided'
do
let
(
:options
)
{
{
ref:
'master'
,
path:
[
'PROCESS.md'
,
'README.md'
]
}
}
def
commit_files
(
commit
)
commit
.
diff
(
commit
.
parent_ids
.
first
).
deltas
.
flat_map
do
|
delta
|
[
delta
.
old_file
[
:path
],
delta
.
new_file
[
:path
]].
uniq
.
compact
end
end
it
'only returns commits matching at least one path'
do
commits
=
repository
.
log
(
options
)
expect
(
commits
.
size
).
to
be
>
0
expect
(
commits
).
to
satisfy
do
|
commits
|
commits
.
none?
{
|
commit
|
(
commit_files
(
commit
)
&
options
[
:path
]).
empty?
}
end
end
end
...
...
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