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
c45d9c46
Commit
c45d9c46
authored
Mar 31, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1451 from nulltoken/topic/support_taggerless_tags
Support tags with no tagger nor message
parents
81b8c9df
24cb87e2
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
36 additions
and
12 deletions
+36
-12
include/git2/tag.h
+2
-2
src/tag.c
+1
-1
tests-clar/network/fetchlocal.c
+2
-2
tests-clar/network/remote/local.c
+2
-2
tests-clar/object/tag/read.c
+23
-0
tests-clar/odb/foreach.c
+3
-3
tests-clar/refs/foreachglob.c
+2
-2
tests-clar/resources/testrepo.git/objects/4a/23e2e65ad4e31c4c9db7dc746650bfad082679
+0
-0
tests-clar/resources/testrepo.git/refs/tags/taggerless
+1
-0
No files found.
include/git2/tag.h
View file @
c45d9c46
...
...
@@ -121,7 +121,7 @@ GIT_EXTERN(const char *) git_tag_name(const git_tag *tag);
* Get the tagger (author) of a tag
*
* @param tag a previously loaded tag.
* @return reference to the tag's author
* @return reference to the tag's author
or NULL when unspecified
*/
GIT_EXTERN
(
const
git_signature
*
)
git_tag_tagger
(
const
git_tag
*
tag
);
...
...
@@ -129,7 +129,7 @@ GIT_EXTERN(const git_signature *) git_tag_tagger(const git_tag *tag);
* Get the message of a tag
*
* @param tag a previously loaded tag.
* @return message of the tag
* @return message of the tag
or NULL when unspecified
*/
GIT_EXTERN
(
const
char
*
)
git_tag_message
(
const
git_tag
*
tag
);
...
...
src/tag.c
View file @
c45d9c46
...
...
@@ -131,7 +131,7 @@ int git_tag__parse_buffer(git_tag *tag, const char *buffer, size_t length)
buffer
=
search
+
1
;
tag
->
tagger
=
NULL
;
if
(
*
buffer
!=
'\n'
)
{
if
(
buffer
<
buffer_end
&&
*
buffer
!=
'\n'
)
{
tag
->
tagger
=
git__malloc
(
sizeof
(
git_signature
));
GITERR_CHECK_ALLOC
(
tag
->
tagger
);
...
...
tests-clar/network/fetchlocal.c
View file @
c45d9c46
...
...
@@ -35,7 +35,7 @@ void test_network_fetchlocal__complete(void)
cl_git_pass
(
git_remote_update_tips
(
origin
));
cl_git_pass
(
git_reference_list
(
&
refnames
,
repo
,
GIT_REF_LISTALL
));
cl_assert_equal_i
(
1
8
,
(
int
)
refnames
.
count
);
cl_assert_equal_i
(
1
9
,
(
int
)
refnames
.
count
);
cl_assert
(
callcount
>
0
);
git_strarray_free
(
&
refnames
);
...
...
@@ -70,7 +70,7 @@ void test_network_fetchlocal__partial(void)
git_strarray_free
(
&
refnames
);
cl_git_pass
(
git_reference_list
(
&
refnames
,
repo
,
GIT_REF_LISTALL
));
cl_assert_equal_i
(
19
,
(
int
)
refnames
.
count
);
/* 18 remote + 1 local */
cl_assert_equal_i
(
20
,
(
int
)
refnames
.
count
);
/* 18 remote + 1 local */
cl_assert
(
callcount
>
0
);
git_strarray_free
(
&
refnames
);
...
...
tests-clar/network/remote/local.c
View file @
c45d9c46
...
...
@@ -72,7 +72,7 @@ void test_network_remote_local__retrieve_advertised_references(void)
cl_git_pass
(
git_remote_ls
(
remote
,
&
count_ref__cb
,
&
how_many_refs
));
cl_assert_equal_i
(
how_many_refs
,
2
6
);
cl_assert_equal_i
(
how_many_refs
,
2
8
);
}
void
test_network_remote_local__retrieve_advertised_references_from_spaced_repository
(
void
)
...
...
@@ -86,7 +86,7 @@ void test_network_remote_local__retrieve_advertised_references_from_spaced_repos
cl_git_pass
(
git_remote_ls
(
remote
,
&
count_ref__cb
,
&
how_many_refs
));
cl_assert_equal_i
(
how_many_refs
,
2
6
);
cl_assert_equal_i
(
how_many_refs
,
2
8
);
git_remote_free
(
remote
);
/* Disconnect from the "spaced repo" before the cleanup */
remote
=
NULL
;
...
...
tests-clar/object/tag/read.c
View file @
c45d9c46
...
...
@@ -9,6 +9,7 @@ static const char *bad_tag_id = "eda9f45a2a98d4c17a09d681d88569fa4ea91755";
static
const
char
*
badly_tagged_commit
=
"e90810b8df3e80c413d903f631643c716887138d"
;
static
const
char
*
short_tag_id
=
"5da7760512a953e3c7c4e47e4392c7a4338fb729"
;
static
const
char
*
short_tagged_commit
=
"4a5ed60bafcf4638b7c8356bd4ce1916bfede93c"
;
static
const
char
*
taggerless
=
"4a23e2e65ad4e31c4c9db7dc746650bfad082679"
;
static
git_repository
*
g_repo
;
...
...
@@ -117,3 +118,25 @@ void test_object_tag_read__parse_without_message(void)
git_commit_free
(
commit
);
git_repository_free
(
short_tag_repo
);
}
void
test_object_tag_read__without_tagger_nor_message
(
void
)
{
git_tag
*
tag
;
git_oid
id
;
git_repository
*
repo
;
cl_git_pass
(
git_repository_open
(
&
repo
,
cl_fixture
(
"testrepo.git"
)));
cl_git_pass
(
git_oid_fromstr
(
&
id
,
taggerless
));
cl_git_pass
(
git_tag_lookup
(
&
tag
,
repo
,
&
id
));
cl_assert_equal_s
(
git_tag_name
(
tag
),
"taggerless"
);
cl_assert
(
git_tag_target_type
(
tag
)
==
GIT_OBJ_COMMIT
);
cl_assert
(
tag
->
message
==
NULL
);
cl_assert
(
tag
->
tagger
==
NULL
);
git_tag_free
(
tag
);
git_repository_free
(
repo
);
}
tests-clar/odb/foreach.c
View file @
c45d9c46
...
...
@@ -28,8 +28,8 @@ static int foreach_cb(const git_oid *oid, void *data)
/*
* $ git --git-dir tests-clar/resources/testrepo.git count-objects --verbose
* count: 4
3
* size:
3
* count: 4
7
* size:
4
* in-pack: 1640
* packs: 3
* size-pack: 425
...
...
@@ -42,7 +42,7 @@ void test_odb_foreach__foreach(void)
git_repository_odb
(
&
_odb
,
_repo
);
cl_git_pass
(
git_odb_foreach
(
_odb
,
foreach_cb
,
NULL
));
cl_assert_equal_i
(
4
6
+
1640
,
nobj
);
/* count + in-pack */
cl_assert_equal_i
(
4
7
+
1640
,
nobj
);
/* count + in-pack */
}
void
test_odb_foreach__one_pack
(
void
)
...
...
tests-clar/refs/foreachglob.c
View file @
c45d9c46
...
...
@@ -48,8 +48,8 @@ static void assert_retrieval(const char *glob, unsigned int flags, int expected_
void
test_refs_foreachglob__retrieve_all_refs
(
void
)
{
/*
8 heads (including one packed head) + 1 note + 2 remotes + 6
tags */
assert_retrieval
(
"*"
,
GIT_REF_LISTALL
,
2
1
);
/*
12 heads (including one packed head) + 1 note + 2 remotes + 7
tags */
assert_retrieval
(
"*"
,
GIT_REF_LISTALL
,
2
2
);
}
void
test_refs_foreachglob__retrieve_remote_branches
(
void
)
...
...
tests-clar/resources/testrepo.git/objects/4a/23e2e65ad4e31c4c9db7dc746650bfad082679
0 → 100644
View file @
c45d9c46
File added
tests-clar/resources/testrepo.git/refs/tags/taggerless
0 → 100644
View file @
c45d9c46
4a23e2e65ad4e31c4c9db7dc746650bfad082679
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