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

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-06-17 13:53:37 +0300
committerJunio C Hamano <gitster@pobox.com>2021-06-28 19:33:06 +0300
commit4465690cd838017208d297a7f77d00ec51ccf7fd (patch)
treeb29d8151acaf639d85609480ce00815a9ea2b84a /builtin/show-branch.c
parent9b6e74a9c0133c4e34f6ec56cc93a6a83eba2c3c (diff)
show-branch: don't <COLOR></RESET> for space characters
Change the colored output introduced in ab07ba2a24 (show-branch: color the commit status signs, 2009-04-22) to not color and reset each individual space character we use for padding. The intent is to color just the "!", "+" etc. characters. This makes the output easier to test, so let's do that now. The test would be much more verbose without a color/reset for each space character. Since the coloring cycles through colors we previously had a "rainbow of space characters". In theory this breaks things for anyone who's relying on the exact colored output of show-branch, in practice I'd think anyone parsing it isn't actively turning on the colored output. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/show-branch.c')
-rw-r--r--builtin/show-branch.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index d6d2dabeca..d77ce7aeb3 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -939,9 +939,12 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
mark = '*';
else
mark = '+';
- printf("%s%c%s",
- get_color_code(i),
- mark, get_color_reset_code());
+ if (mark == ' ')
+ putchar(mark);
+ else
+ printf("%s%c%s",
+ get_color_code(i),
+ mark, get_color_reset_code());
}
putchar(' ');
}