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
b058297a
Commit
b058297a
authored
Apr 25, 2016
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3752 from libgit2/cmn/silly-tags
tag: ignore extra header fields
parents
512bd2c7
eb39284b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
2 deletions
+45
-2
src/tag.c
+8
-2
tests/object/tag/read.c
+37
-0
No files found.
src/tag.c
View file @
b058297a
...
@@ -137,8 +137,14 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
...
@@ -137,8 +137,14 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
tag
->
message
=
NULL
;
tag
->
message
=
NULL
;
if
(
buffer
<
buffer_end
)
{
if
(
buffer
<
buffer_end
)
{
if
(
*
buffer
!=
'\n'
)
/* If we're not at the end of the header, search for it */
return
tag_error
(
"No new line before message"
);
if
(
*
buffer
!=
'\n'
)
{
search
=
strstr
(
buffer
,
"
\n\n
"
);
if
(
search
)
buffer
=
search
+
1
;
else
return
tag_error
(
"tag contains no message"
);
}
text_len
=
buffer_end
-
++
buffer
;
text_len
=
buffer_end
-
++
buffer
;
...
...
tests/object/tag/read.c
View file @
b058297a
...
@@ -140,3 +140,40 @@ void test_object_tag_read__without_tagger_nor_message(void)
...
@@ -140,3 +140,40 @@ void test_object_tag_read__without_tagger_nor_message(void)
git_tag_free
(
tag
);
git_tag_free
(
tag
);
git_repository_free
(
repo
);
git_repository_free
(
repo
);
}
}
static
const
char
*
silly_tag
=
"object c054ccaefbf2da31c3b19178f9e3ef20a3867924
\n
\
type commit
\n
\
tag v1_0_1
\n
\
tagger Jamis Buck <jamis@37signals.com> 1107717917
\n
\
diff --git a/lib/sqlite3/version.rb b/lib/sqlite3/version.rb
\n
\
index 0b3bf69..4ee8fc2 100644
\n
\
--- a/lib/sqlite3/version.rb
\n
\
+++ b/lib/sqlite3/version.rb
\n
\
@@ -36,7 +36,7 @@ module SQLite3
\n
\
\n
\
MAJOR = 1
\n
\
MINOR = 0
\n
\
- TINY = 0
\n
\
+ TINY = 1
\n
\
\n
\
STRING = [ MAJOR, MINOR, TINY ].join(
\"
.
\"
)
\n
\
\n
\
-0600
\n
\
\n
\
v1_0_1 release
\n
"
;
void
test_object_tag_read__extra_header_fields
(
void
)
{
git_tag
*
tag
;
git_odb
*
odb
;
git_oid
id
;
cl_git_pass
(
git_repository_odb__weakptr
(
&
odb
,
g_repo
));
cl_git_pass
(
git_odb_write
(
&
id
,
odb
,
silly_tag
,
strlen
(
silly_tag
),
GIT_OBJ_TAG
));
cl_git_pass
(
git_tag_lookup
(
&
tag
,
g_repo
,
&
id
));
cl_assert_equal_s
(
"v1_0_1 release
\n
"
,
git_tag_message
(
tag
));
git_tag_free
(
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