Code

Merge git://git.kernel.org/pub/scm/gitk/gitk
[git.git] / log-tree.c
index 2c1f3e673ae7c9441cb171244d3fb91a8dd9fb1b..194ddb13da09668334cd9e1f6eeef517c3346ee9 100644 (file)
@@ -52,11 +52,15 @@ static void show_parents(struct commit *commit, int abbrev)
        }
 }
 
-void show_decorations(struct commit *commit)
+void show_decorations(struct rev_info *opt, struct commit *commit)
 {
        const char *prefix;
        struct name_decoration *decoration;
 
+       if (opt->show_source && commit->util)
+               printf("\t%s", (char *) commit->util);
+       if (!opt->show_decorations)
+               return;
        decoration = lookup_decoration(&name_decoration, &commit->object);
        if (!decoration)
                return;
@@ -252,7 +256,7 @@ void log_write_email_headers(struct rev_info *opt, const char *name,
 
 void show_log(struct rev_info *opt)
 {
-       struct strbuf msgbuf;
+       struct strbuf msgbuf = STRBUF_INIT;
        struct log_info *log = opt->loginfo;
        struct commit *commit = log->commit, *parent = log->parent;
        int abbrev = opt->diffopt.abbrev;
@@ -279,7 +283,7 @@ void show_log(struct rev_info *opt)
                fputs(diff_unique_abbrev(commit->object.sha1, abbrev_commit), stdout);
                if (opt->print_parents)
                        show_parents(commit, abbrev_commit);
-               show_decorations(commit);
+               show_decorations(opt, commit);
                if (opt->graph && !graph_is_commit_finished(opt->graph)) {
                        putchar('\n');
                        graph_show_remainder(opt->graph);
@@ -352,7 +356,7 @@ void show_log(struct rev_info *opt)
                        printf(" (from %s)",
                               diff_unique_abbrev(parent->object.sha1,
                                                  abbrev_commit));
-               show_decorations(commit);
+               show_decorations(opt, commit);
                printf("%s", diff_get_color_opt(&opt->diffopt, DIFF_RESET));
                if (opt->commit_format == CMIT_FMT_ONELINE) {
                        putchar(' ');
@@ -381,7 +385,6 @@ void show_log(struct rev_info *opt)
        /*
         * And then the pretty-printed message itself
         */
-       strbuf_init(&msgbuf, 0);
        if (need_8bit_cte >= 0)
                need_8bit_cte = has_non_ascii(opt->add_signoff);
        pretty_print_commit(opt->commit_format, commit, &msgbuf,