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
Léo-Paul Géneau
gitlab-ce
Commits
ac2cb65a
Commit
ac2cb65a
authored
Jan 04, 2018
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the Commit#tree method
parent
1e950e31
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
9 deletions
+10
-9
app/models/commit.rb
app/models/commit.rb
+1
-1
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+2
-2
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+5
-2
spec/lib/gitlab/git/blob_spec.rb
spec/lib/gitlab/git/blob_spec.rb
+2
-2
spec/lib/gitlab/git/commit_spec.rb
spec/lib/gitlab/git/commit_spec.rb
+0
-1
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+0
-1
No files found.
app/models/commit.rb
View file @
ac2cb65a
...
...
@@ -371,7 +371,7 @@ class Commit
#
# Returns a symbol
def
uri_type
(
path
)
entry
=
@raw
.
tree
.
path
(
path
)
entry
=
@raw
.
rugged_tree_entry
(
path
)
if
entry
[
:type
]
==
:blob
blob
=
::
Blob
.
decorate
(
Gitlab
::
Git
::
Blob
.
new
(
name:
entry
[
:name
]),
@project
)
blob
.
image?
||
blob
.
video?
?
:raw
:
:blob
...
...
lib/gitlab/git/blob.rb
View file @
ac2cb65a
...
...
@@ -154,8 +154,8 @@ module Gitlab
end
def
find_by_rugged
(
repository
,
sha
,
path
,
limit
:)
commit
=
repository
.
lookup
(
sha
)
root_tree
=
commit
.
tree
rugged_
commit
=
repository
.
lookup
(
sha
)
root_tree
=
rugged_
commit
.
tree
blob_entry
=
find_entry_by_path
(
repository
,
root_tree
.
oid
,
path
)
...
...
lib/gitlab/git/commit.rb
View file @
ac2cb65a
...
...
@@ -15,8 +15,6 @@ module Gitlab
attr_accessor
*
SERIALIZE_KEYS
# rubocop:disable Lint/AmbiguousOperator
delegate
:tree
,
to: :rugged_commit
def
==
(
other
)
return
false
unless
other
.
is_a?
(
Gitlab
::
Git
::
Commit
)
...
...
@@ -452,6 +450,11 @@ module Gitlab
)
end
# Is this the same as Blob.find_entry_by_path ?
def
rugged_tree_entry
(
path
)
rugged_commit
.
tree
.
path
(
path
)
end
private
def
init_from_hash
(
hash
)
...
...
spec/lib/gitlab/git/blob_spec.rb
View file @
ac2cb65a
...
...
@@ -146,7 +146,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
context
'when sha references a tree'
do
it
'returns nil'
do
tree
=
Gitlab
::
Git
::
Commit
.
find
(
repository
,
'master'
).
tree
tree
=
repository
.
rugged
.
rev_parse
(
'master^{tree}'
)
blob
=
Gitlab
::
Git
::
Blob
.
raw
(
repository
,
tree
.
oid
)
...
...
@@ -237,7 +237,7 @@ describe Gitlab::Git::Blob, seed_helper: true do
end
describe
'.batch_lfs_pointers'
do
let
(
:tree_object
)
{
Gitlab
::
Git
::
Commit
.
find
(
repository
,
'master'
).
tree
}
let
(
:tree_object
)
{
repository
.
rugged
.
rev_parse
(
'master^{tree}'
)
}
let
(
:non_lfs_blob
)
do
Gitlab
::
Git
::
Blob
.
find
(
...
...
spec/lib/gitlab/git/commit_spec.rb
View file @
ac2cb65a
...
...
@@ -55,7 +55,6 @@ describe Gitlab::Git::Commit, seed_helper: true do
it
{
expect
(
@commit
.
parents
).
to
eq
(
@gitlab_parents
)
}
it
{
expect
(
@commit
.
parent_id
).
to
eq
(
@parents
.
first
.
oid
)
}
it
{
expect
(
@commit
.
no_commit_message
).
to
eq
(
"--no commit message"
)
}
it
{
expect
(
@commit
.
tree
).
to
eq
(
@tree
)
}
after
do
# Erase the new commit so other tests get the original repo
...
...
spec/models/commit_spec.rb
View file @
ac2cb65a
...
...
@@ -181,7 +181,6 @@ eos
it
{
is_expected
.
to
respond_to
(
:parents
)
}
it
{
is_expected
.
to
respond_to
(
:date
)
}
it
{
is_expected
.
to
respond_to
(
:diffs
)
}
it
{
is_expected
.
to
respond_to
(
:tree
)
}
it
{
is_expected
.
to
respond_to
(
:id
)
}
it
{
is_expected
.
to
respond_to
(
:to_patch
)
}
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