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
Jérome Perrin
gitlab-ce
Commits
7363aa0b
Commit
7363aa0b
authored
Jan 24, 2018
by
Jacob Vosmaer (GitLab)
Committed by
Jacob Vosmaer
Jan 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'remove-rugged-walk' into 'master'"
This reverts merge request !16525
parent
dcb79741
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
1 deletion
+64
-1
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+26
-1
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+38
-0
No files found.
lib/gitlab/git/repository.rb
View file @
7363aa0b
...
@@ -490,7 +490,11 @@ module Gitlab
...
@@ -490,7 +490,11 @@ module Gitlab
return
[]
return
[]
end
end
log_by_shell
(
sha
,
options
)
if
log_using_shell?
(
options
)
log_by_shell
(
sha
,
options
)
else
log_by_walk
(
sha
,
options
)
end
end
end
def
count_commits
(
options
)
def
count_commits
(
options
)
...
@@ -1517,6 +1521,27 @@ module Gitlab
...
@@ -1517,6 +1521,27 @@ module Gitlab
end
end
end
end
def
log_using_shell?
(
options
)
options
[
:path
].
present?
||
options
[
:disable_walk
]
||
options
[
:skip_merges
]
||
options
[
:after
]
||
options
[
:before
]
end
def
log_by_walk
(
sha
,
options
)
walk_options
=
{
show:
sha
,
sort:
Rugged
::
SORT_NONE
,
limit:
options
[
:limit
],
offset:
options
[
:offset
]
}
Rugged
::
Walker
.
walk
(
rugged
,
walk_options
).
to_a
end
# Gitaly note: JV: although #log_by_shell shells out to Git I think the
# complexity is such that we should migrate it as Ruby before trying to
# do it in Go.
def
log_by_shell
(
sha
,
options
)
def
log_by_shell
(
sha
,
options
)
limit
=
options
[
:limit
].
to_i
limit
=
options
[
:limit
].
to_i
offset
=
options
[
:offset
].
to_i
offset
=
options
[
:offset
].
to_i
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
7363aa0b
...
@@ -899,6 +899,44 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -899,6 +899,44 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
end
end
context
"compare results between log_by_walk and log_by_shell"
do
let
(
:options
)
{
{
ref:
"master"
}
}
let
(
:commits_by_walk
)
{
repository
.
log
(
options
).
map
(
&
:id
)
}
let
(
:commits_by_shell
)
{
repository
.
log
(
options
.
merge
({
disable_walk:
true
})).
map
(
&
:id
)
}
it
{
expect
(
commits_by_walk
).
to
eq
(
commits_by_shell
)
}
context
"with limit"
do
let
(
:options
)
{
{
ref:
"master"
,
limit:
1
}
}
it
{
expect
(
commits_by_walk
).
to
eq
(
commits_by_shell
)
}
end
context
"with offset"
do
let
(
:options
)
{
{
ref:
"master"
,
offset:
1
}
}
it
{
expect
(
commits_by_walk
).
to
eq
(
commits_by_shell
)
}
end
context
"with skip_merges"
do
let
(
:options
)
{
{
ref:
"master"
,
skip_merges:
true
}
}
it
{
expect
(
commits_by_walk
).
to
eq
(
commits_by_shell
)
}
end
context
"with path"
do
let
(
:options
)
{
{
ref:
"master"
,
path:
"encoding"
}
}
it
{
expect
(
commits_by_walk
).
to
eq
(
commits_by_shell
)
}
context
"with follow"
do
let
(
:options
)
{
{
ref:
"master"
,
path:
"encoding"
,
follow:
true
}
}
it
{
expect
(
commits_by_walk
).
to
eq
(
commits_by_shell
)
}
end
end
end
context
"where provides 'after' timestamp"
do
context
"where provides 'after' timestamp"
do
options
=
{
after:
Time
.
iso8601
(
'2014-03-03T20:15:01+00:00'
)
}
options
=
{
after:
Time
.
iso8601
(
'2014-03-03T20:15:01+00:00'
)
}
...
...
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