Merge branch 'jk/close-stderr-of-credential-cache-deamon'
[gitweb.git] / commit.c
index b6ffd623c89da5e800db37bcdb6437f2fb0fe98b..9c4439fed61c3b26d493d0f0306b65a471da9b19 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -584,25 +584,19 @@ define_commit_slab(author_date_slab, unsigned long);
 static void record_author_date(struct author_date_slab *author_date,
                               struct commit *commit)
 {
-       const char *buf, *line_end, *ident_line;
        const char *buffer = get_commit_buffer(commit, NULL);
        struct ident_split ident;
+       const char *ident_line;
+       size_t ident_len;
        char *date_end;
        unsigned long date;
 
-       for (buf = buffer; buf; buf = line_end + 1) {
-               line_end = strchrnul(buf, '\n');
-               if (!skip_prefix(buf, "author ", &ident_line)) {
-                       if (!line_end[0] || line_end[1] == '\n')
-                               return; /* end of header */
-                       continue;
-               }
-               if (split_ident_line(&ident,
-                                    ident_line, line_end - ident_line) ||
-                   !ident.date_begin || !ident.date_end)
-                       goto fail_exit; /* malformed "author" line */
-               break;
-       }
+       ident_line = find_commit_header(buffer, "author", &ident_len);
+       if (!ident_line)
+               goto fail_exit; /* no author line */
+       if (split_ident_line(&ident, ident_line, ident_len) ||
+           !ident.date_begin || !ident.date_end)
+               goto fail_exit; /* malformed "author" line */
 
        date = strtoul(ident.date_begin, &date_end, 10);
        if (date_end != ident.date_end)
@@ -1256,7 +1250,7 @@ static void parse_gpg_output(struct signature_check *sigc)
        }
 }
 
-void check_commit_signature(const struct commitcommit, struct signature_check *sigc)
+void check_commit_signature(const struct commit *commit, struct signature_check *sigc)
 {
        struct strbuf payload = STRBUF_INIT;
        struct strbuf signature = STRBUF_INIT;