Fixes for option parsing
[gitweb.git] / log-tree.c
index 04a68e0f570dee3701c1879c4190473880aa540b..af36f702e16daace6781a3b044c456062692aad4 100644 (file)
@@ -43,7 +43,7 @@ static int diff_root_tree(struct rev_info *opt,
        return retval;
 }
 
-static const char *generate_header(struct rev_info *opt,
+static const char *get_header(struct rev_info *opt,
                                   const unsigned char *commit_sha1,
                                   const unsigned char *parent_sha1,
                                   const struct commit *commit)
@@ -54,6 +54,9 @@ static const char *generate_header(struct rev_info *opt,
        int abbrev = opt->diffopt.abbrev;
        const char *msg = commit->buffer;
 
+       if (opt->use_precomputed_header)
+               return opt->use_precomputed_header;
+
        if (!opt->verbose_header)
                return sha1_to_hex(commit_sha1);
 
@@ -72,11 +75,21 @@ static const char *generate_header(struct rev_info *opt,
        offset += pretty_print_commit(opt->commit_format, commit, len,
                                      this_header + offset,
                                      sizeof(this_header) - offset, abbrev);
+       return this_header;
+}
+
+static const char *generate_header(struct rev_info *opt,
+                                       const unsigned char *commit_sha1,
+                                       const unsigned char *parent_sha1,
+                                       const struct commit *commit)
+{
+       const char *header = get_header(opt, commit_sha1, parent_sha1, commit);
+
        if (opt->always_show_header) {
-               puts(this_header);
-               return NULL;
+               puts(header);
+               header = NULL;
        }
-       return this_header;
+       return header;
 }
 
 static int do_diff_combined(struct rev_info *opt, struct commit *commit)