Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-28 19:01:11 +0300
committerJunio C Hamano <gitster@pobox.com>2016-10-28 19:01:11 +0300
commit76796d424a21b1def8752c686708253a45721381 (patch)
treefb169e712c83491940513d4228aff82984a2c5a2 /pretty.c
parent03969dff8f6ab2e399df7e156c72d5b965388d2f (diff)
parent82b83da8d30fb8d1f04f7dd7ac769ceb6ab431c3 (diff)
Merge branch 'rs/c-auto-resets-attributes' into maint
When "%C(auto)" appears at the very beginning of the pretty format string, it did not need to issue the reset sequence, but it did. This is a small optimization to already graduated topic. * rs/c-auto-resets-attributes: pretty: avoid adding reset for %C(auto) if output is empty pretty: let %C(auto) reset all attributes
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pretty.c b/pretty.c
index 9788bd8f3f0..25efbcac920 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1072,6 +1072,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
case 'C':
if (starts_with(placeholder + 1, "(auto)")) {
c->auto_color = want_color(c->pretty_ctx->color);
+ if (c->auto_color && sb->len)
+ strbuf_addstr(sb, GIT_COLOR_RESET);
return 7; /* consumed 7 bytes, "C(auto)" */
} else {
int ret = parse_color(sb, placeholder, c);