Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
e2e3943d
Commit
e2e3943d
authored
Oct 07, 2017
by
Edward Thomson
Committed by
GitHub
Oct 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4367 from pks-t/pks/peel-peeled-to-tag
refs: do not use peeled OID if peeling to a tag
parents
62ac3931
b112b1e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletions
+19
-1
src/refs.c
+7
-1
tests/refs/peel.c
+12
-0
No files found.
src/refs.c
View file @
e2e3943d
...
...
@@ -1360,7 +1360,13 @@ int git_reference_peel(
return
peel_error
(
error
,
ref
,
"Cannot resolve reference"
);
}
if
(
!
git_oid_iszero
(
&
resolved
->
peel
))
{
/*
* If we try to peel an object to a tag, we cannot use
* the fully peeled object, as that will always resolve
* to a commit. So we only want to use the peeled value
* if it is not zero and the target is not a tag.
*/
if
(
target_type
!=
GIT_OBJ_TAG
&&
!
git_oid_iszero
(
&
resolved
->
peel
))
{
error
=
git_object_lookup
(
&
target
,
git_reference_owner
(
ref
),
&
resolved
->
peel
,
GIT_OBJ_ANY
);
}
else
{
...
...
tests/refs/peel.c
View file @
e2e3943d
...
...
@@ -117,3 +117,15 @@ void test_refs_peel__can_peel_fully_peeled_packed_refs(void)
"0df1a5865c8abfc09f1f2182e6a31be550e99f07"
,
GIT_OBJ_COMMIT
);
}
void
test_refs_peel__can_peel_fully_peeled_tag_to_tag
(
void
)
{
assert_peel_generic
(
g_peel_repo
,
"refs/tags/tag-inside-tags"
,
GIT_OBJ_TAG
,
"c2596aa0151888587ec5c0187f261e63412d9e11"
,
GIT_OBJ_TAG
);
assert_peel_generic
(
g_peel_repo
,
"refs/foo/tag-outside-tags"
,
GIT_OBJ_TAG
,
"c2596aa0151888587ec5c0187f261e63412d9e11"
,
GIT_OBJ_TAG
);
}
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