diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2016-04-25 12:16:05 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2016-04-25 12:18:32 +0200 |
commit | eb39284babba00c763911b93aa9219803612b965 (patch) | |
tree | f34949b3e3a53b513c8cffb57d971a83dcda78a4 /src | |
parent | 512bd2c78f700186f92271e502b123ea27f75614 (diff) | |
download | libgit2-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.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; |