We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 92ddfaa + a9c7a8a commit 6c22741Copy full SHA for 6c22741
1 file changed
pretty.c
@@ -439,12 +439,14 @@ static char *get_header(const struct commit *commit, const char *key)
439
int key_len = strlen(key);
440
const char *line = commit->buffer;
441
442
- for (;;) {
+ while (line) {
443
const char *eol = strchr(line, '\n'), *next;
444
445
if (line == eol)
446
return NULL;
447
if (!eol) {
448
+ warning("malformed commit (header is missing newline): %s",
449
+ sha1_to_hex(commit->object.sha1));
450
eol = line + strlen(line);
451
next = NULL;
452
} else
@@ -456,6 +458,7 @@ static char *get_header(const struct commit *commit, const char *key)
456
458
}
457
459
line = next;
460
461
+ return NULL;
462
463
464
static char *replace_encoding_header(char *buf, const char *encoding)
0 commit comments