File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -439,12 +439,14 @@ static char *get_header(const struct commit *commit, const char *key)
439439 int key_len = strlen (key );
440440 const char * line = commit -> buffer ;
441441
442- for (;; ) {
442+ while ( line ) {
443443 const char * eol = strchr (line , '\n' ), * next ;
444444
445445 if (line == eol )
446446 return NULL ;
447447 if (!eol ) {
448+ warning ("malformed commit (header is missing newline): %s" ,
449+ sha1_to_hex (commit -> object .sha1 ));
448450 eol = line + strlen (line );
449451 next = NULL ;
450452 } else
@@ -456,6 +458,7 @@ static char *get_header(const struct commit *commit, const char *key)
456458 }
457459 line = next ;
458460 }
461+ return NULL ;
459462}
460463
461464static char * replace_encoding_header (char * buf , const char * encoding )
You can’t perform that action at this time.
0 commit comments