mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
9b6e74a9c0
commit
4465690cd8
@@ -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(' ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user