summaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2020-11-16 16:08:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-11-16 23:59:02 (GMT)
commit0cb8939fb6795c9f94f9184935b6a83aebdfc47a (patch)
tree5e55e4a83284bb33fd9f35dcd5344b4f85d81766 /git-add--interactive.perl
parentafae3cb6b036e8fb218e5699c8ad3c18b6d4b992 (diff)
downloadgit-0cb8939fb6795c9f94f9184935b6a83aebdfc47a.zip
git-0cb8939fb6795c9f94f9184935b6a83aebdfc47a.tar.gz
git-0cb8939fb6795c9f94f9184935b6a83aebdfc47a.tar.bz2
add -i (Perl version): color header to match the C version
Both versions of `add -i` indent non-flat lists by five spaces. However when using color the C version prints these spaces after the ANSI color codes whereas the Perl version prints them before the color codes. Change the Perl version to match the C version to allow for introducing a test that verifies that both versions produce the exact same output. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl6
1 files changed, 2 insertions, 4 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 8a72018..b42e15a 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -483,10 +483,8 @@ sub list_and_choose {
my $last_lf = 0;
if ($opts->{HEADER}) {
- if (!$opts->{LIST_FLAT}) {
- print " ";
- }
- print colored $header_color, "$opts->{HEADER}\n";
+ my $indent = $opts->{LIST_FLAT} ? "" : " ";
+ print colored $header_color, "$indent$opts->{HEADER}\n";
}
for ($i = 0; $i < @stuff; $i++) {
my $chosen = $chosen[$i] ? '*' : ' ';