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
79fd4230
Commit
79fd4230
authored
Apr 06, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transport/local: Fix peeling of nested tags
parent
3f46f313
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
src/transports/local.c
+7
-2
tests-clar/network/remotelocal.c
+20
-0
No files found.
src/transports/local.c
View file @
79fd4230
...
...
@@ -27,7 +27,7 @@ static int add_ref(transport_local *t, const char *name)
const
char
peeled
[]
=
"^{}"
;
git_remote_head
*
head
;
git_reference
*
ref
,
*
resolved_ref
;
git_object
*
obj
=
NULL
;
git_object
*
obj
=
NULL
,
*
peeled_tag_target
=
NULL
;
int
error
=
GIT_SUCCESS
,
peel_len
,
ret
;
head
=
git__malloc
(
sizeof
(
git_remote_head
));
...
...
@@ -78,7 +78,11 @@ static int add_ref(transport_local *t, const char *name)
assert
(
ret
<
peel_len
+
1
);
(
void
)
ret
;
git_oid_cpy
(
&
head
->
oid
,
git_tag_target_oid
((
git_tag
*
)
obj
));
error
=
git_tag_peel
(
&
peeled_tag_target
,
(
git_tag
*
)
obj
);
if
(
error
<
0
)
goto
out
;
git_oid_cpy
(
&
head
->
oid
,
git_object_id
(
peeled_tag_target
));
error
=
git_vector_insert
(
&
t
->
refs
,
head
);
if
(
error
<
GIT_SUCCESS
)
...
...
@@ -89,6 +93,7 @@ static int add_ref(transport_local *t, const char *name)
git_reference_free
(
resolved_ref
);
git_object_free
(
obj
);
git_object_free
(
peeled_tag_target
);
if
(
head
&&
error
<
GIT_SUCCESS
)
{
git__free
(
head
->
name
);
git__free
(
head
);
...
...
tests-clar/network/remotelocal.c
View file @
79fd4230
...
...
@@ -71,6 +71,16 @@ static int count_ref__cb(git_remote_head *head, void *payload)
return
GIT_SUCCESS
;
}
static
int
ensure_peeled__cb
(
git_remote_head
*
head
,
void
*
payload
)
{
GIT_UNUSED
(
payload
);
if
(
strcmp
(
head
->
name
,
"refs/tags/test^{}"
)
!=
0
)
return
0
;
return
git_oid_streq
(
&
head
->
oid
,
"e90810b8df3e80c413d903f631643c716887138d"
);
}
static
void
connect_to_local_repository
(
const
char
*
local_repository
)
{
build_local_file_url
(
&
file_path_buf
,
local_repository
);
...
...
@@ -104,5 +114,15 @@ void test_network_remotelocal__retrieve_advertised_references_from_spaced_reposi
cl_assert
(
how_many_refs
==
14
);
/* 1 HEAD + 6 heads + 1 lightweight tag + 3 annotated tags + 3 peeled target */
git_remote_free
(
remote
);
/* Disconnect from the "spaced repo" before the cleanup */
remote
=
NULL
;
cl_fixture_cleanup
(
"spaced testrepo.git"
);
}
void
test_network_remotelocal__nested_tags_are_completely_peeled
(
void
)
{
connect_to_local_repository
(
cl_fixture
(
"testrepo.git"
));
cl_git_pass
(
git_remote_ls
(
remote
,
&
ensure_peeled__cb
,
NULL
));
}
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