for-each-ref: cope with tags with incomplete lines
If you have a tag with a single, incomplete line as its payload, asking git-for-each-ref for its %(body) element accessed a NULL pointer. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -459,8 +459,10 @@ static void find_subpos(const char *buf, unsigned long sz, const char **sub, con
|
||||
return;
|
||||
*sub = buf; /* first non-empty line */
|
||||
buf = strchr(buf, '\n');
|
||||
if (!buf)
|
||||
if (!buf) {
|
||||
*body = "";
|
||||
return; /* no body */
|
||||
}
|
||||
while (*buf == '\n')
|
||||
buf++; /* skip blank between subject and body */
|
||||
*body = buf;
|
||||
|
||||
Reference in New Issue
Block a user