summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2016-04-25 12:16:05 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2016-04-25 12:18:32 +0200
commiteb39284babba00c763911b93aa9219803612b965 (patch)
treef34949b3e3a53b513c8cffb57d971a83dcda78a4 /src
parent512bd2c78f700186f92271e502b123ea27f75614 (diff)
downloadlibgit2-eb39284babba00c763911b93aa9219803612b965.tar.gz
tag: ignore extra header fieldscmn/silly-tags
While no extra header fields are defined for tags, git accepts them by ignoring them and continuing the search for the message. There are a few tags like this in the wild which git parses just fine, so we should do the same.
Diffstat (limited to 'src')
-rw-r--r--src/tag.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tag.c b/src/tag.c
index c4bce1f22..fe840fe82 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -137,8 +137,14 @@ static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
tag->message = NULL;
if (buffer < buffer_end) {
- if( *buffer != '\n' )
- return tag_error("No new line before message");
+ /* If we're not at the end of the header, search for it */
+ 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;