summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/rev-list.c1
-rw-r--r--log-tree.c10
-rw-r--r--log-tree.h1
-rwxr-xr-xt/t4202-log.sh12
4 files changed, 16 insertions, 8 deletions
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 0aa93d5891..8833f029aa 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -107,6 +107,7 @@ static void show_commit(struct commit *commit, void *data)
children = children->next;
}
}
+ show_source(revs, commit);
show_decorations(revs, commit);
if (revs->commit_format == CMIT_FMT_ONELINE)
putchar(' ');
diff --git a/log-tree.c b/log-tree.c
index 3bf88182e2..9ca3e8c1ce 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -279,12 +279,16 @@ void format_decorations_extended(struct strbuf *sb,
strbuf_addstr(sb, color_reset);
}
+void show_source(struct rev_info *opt, struct commit *commit)
+{
+ if (opt->show_source && commit->util)
+ fprintf(opt->diffopt.file, "\t%s", (char *) commit->util);
+}
+
void show_decorations(struct rev_info *opt, struct commit *commit)
{
struct strbuf sb = STRBUF_INIT;
- if (opt->show_source && commit->util)
- fprintf(opt->diffopt.file, "\t%s", (char *) commit->util);
if (!opt->show_decorations)
return;
format_decorations(&sb, commit, opt->diffopt.use_color);
@@ -556,6 +560,7 @@ void show_log(struct rev_info *opt)
show_parents(commit, abbrev_commit, opt->diffopt.file);
if (opt->children.name)
show_children(opt, commit, abbrev_commit);
+ show_source(opt, commit);
show_decorations(opt, commit);
if (opt->graph && !graph_is_commit_finished(opt->graph)) {
putc('\n', opt->diffopt.file);
@@ -622,6 +627,7 @@ void show_log(struct rev_info *opt)
find_unique_abbrev(parent->object.oid.hash,
abbrev_commit));
fputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), opt->diffopt.file);
+ show_source(opt, commit);
if (opt->commit_format == CMIT_FMT_ONELINE) {
/* Not at end of line, but.. */
if (opt->reflog_info)
diff --git a/log-tree.h b/log-tree.h
index c8116e60cd..33d4158203 100644
--- a/log-tree.h
+++ b/log-tree.h
@@ -20,6 +20,7 @@ void format_decorations_extended(struct strbuf *sb, const struct commit *commit,
const char *suffix);
#define format_decorations(strbuf, commit, color) \
format_decorations_extended((strbuf), (commit), (color), " (", ", ", ")")
+void show_source(struct rev_info *opt, struct commit *commit);
void show_decorations(struct rev_info *opt, struct commit *commit);
void log_write_email_headers(struct rev_info *opt, struct commit *commit,
const char **subject_p,
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index dea2d449ab..48b55bfd27 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -1353,9 +1353,9 @@ test_expect_success 'set up --source tests' '
test_expect_success 'log --source paints branch names' '
cat >expect <<-\EOF &&
- 09e12a9 three source-b
- 8e393e1 two source-a
- 1ac6c77 one source-b
+ 09e12a9 source-b three
+ 8e393e1 source-a two
+ 1ac6c77 source-b one
EOF
git log --oneline --source source-a source-b >actual &&
test_cmp expect actual
@@ -1364,9 +1364,9 @@ test_expect_success 'log --source paints branch names' '
test_expect_success 'log --source paints tag names' '
git tag -m tagged source-tag &&
cat >expect <<-\EOF &&
- 09e12a9 three source-tag
- 8e393e1 two source-a
- 1ac6c77 one source-tag
+ 09e12a9 source-tag three
+ 8e393e1 source-a two
+ 1ac6c77 source-tag one
EOF
git log --oneline --source source-tag source-a >actual &&
test_cmp expect actual