Let core.attributesfile default to $XDG_CONFIG_HOME/git/attributes
[gitweb.git] / pretty.c
index 2c1417fe56118b406e1278440beff97df2ed227f..8b1ea9ffad2a0b5c5cb5c15cc5057a8a7132da07 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -439,12 +439,14 @@ static char *get_header(const struct commit *commit, const char *key)
        int key_len = strlen(key);
        const char *line = commit->buffer;
 
-       for (;;) {
+       while (line) {
                const char *eol = strchr(line, '\n'), *next;
 
                if (line == eol)
                        return NULL;
                if (!eol) {
+                       warning("malformed commit (header is missing newline): %s",
+                               sha1_to_hex(commit->object.sha1));
                        eol = line + strlen(line);
                        next = NULL;
                } else
@@ -456,6 +458,7 @@ static char *get_header(const struct commit *commit, const char *key)
                }
                line = next;
        }
+       return NULL;
 }
 
 static char *replace_encoding_header(char *buf, const char *encoding)
@@ -1012,6 +1015,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
                                get_reflog_selector(sb,
                                                    c->pretty_ctx->reflog_info,
                                                    c->pretty_ctx->date_mode,
+                                                   c->pretty_ctx->date_mode_explicit,
                                                    (placeholder[1] == 'd'));
                        return 2;
                case 's':       /* reflog message */