Skip to content

Commit d0410af

Browse files
committed
Merge branch 'jk/maint-show-tag'
* jk/maint-show-tag: show: add space between multiple items show: suppress extra newline when showing annotated tag
2 parents e3e9af5 + ae03ee6 commit d0410af

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

builtin-log.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static void show_tagger(char *buf, int len, struct rev_info *rev)
257257
pp_user_info("Tagger", rev->commit_format, &out, buf, rev->date_mode,
258258
git_log_output_encoding ?
259259
git_log_output_encoding: git_commit_encoding);
260-
printf("%s\n", out.buf);
260+
printf("%s", out.buf);
261261
strbuf_release(&out);
262262
}
263263

@@ -329,11 +329,14 @@ int cmd_show(int argc, const char **argv, const char *prefix)
329329
case OBJ_TAG: {
330330
struct tag *t = (struct tag *)o;
331331

332+
if (rev.shown_one)
333+
putchar('\n');
332334
printf("%stag %s%s\n",
333335
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
334336
t->tag,
335337
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
336338
ret = show_object(o->sha1, 1, &rev);
339+
rev.shown_one = 1;
337340
if (ret)
338341
break;
339342
o = parse_object(t->tagged->sha1);
@@ -345,12 +348,15 @@ int cmd_show(int argc, const char **argv, const char *prefix)
345348
break;
346349
}
347350
case OBJ_TREE:
351+
if (rev.shown_one)
352+
putchar('\n');
348353
printf("%stree %s%s\n\n",
349354
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
350355
name,
351356
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
352357
read_tree_recursive((struct tree *)o, "", 0, 0, NULL,
353358
show_tree_object, NULL);
359+
rev.shown_one = 1;
354360
break;
355361
case OBJ_COMMIT:
356362
rev.pending.nr = rev.pending.alloc = 0;

0 commit comments

Comments
 (0)