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
Kazuhiko Shiozaki
gitlab-ce
Commits
05c2c15c
Commit
05c2c15c
authored
Apr 25, 2013
by
Sato Hiroyuki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Gitlab::Git::Repository#commit returns wrong commit, if commit_id is "tag name".
parent
963ec234
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
lib/extracts_path.rb
lib/extracts_path.rb
+1
-3
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+10
-1
No files found.
lib/extracts_path.rb
View file @
05c2c15c
...
...
@@ -98,9 +98,7 @@ module ExtractsPath
@ref
,
@path
=
extract_ref
(
@id
)
# It is used "@project.repository.commits(@ref, @path, 1, 0)",
# because "@project.repository.commit(@ref)" returns wrong commit when @ref is tag name.
@commit
=
@project
.
repository
.
commits
(
@ref
,
@path
,
1
,
0
).
first
@commit
=
@project
.
repository
.
commit
(
@ref
)
@tree
=
Tree
.
new
(
@project
.
repository
,
@commit
.
id
,
@ref
,
@path
)
...
...
lib/gitlab/git/repository.rb
View file @
05c2c15c
...
...
@@ -49,7 +49,16 @@ module Gitlab
def
commit
(
commit_id
=
nil
)
commit
=
if
commit_id
repo
.
commit
(
commit_id
)
# Find repo.refs first,
# because if commit_id is "tag name",
# repo.commit(commit_id) returns wrong commit sha
# that is git tag object sha.
ref
=
repo
.
refs
.
find
{
|
r
|
r
.
name
==
commit_id
}
if
ref
ref
.
commit
else
repo
.
commit
(
commit_id
)
end
else
repo
.
commits
(
root_ref
).
first
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