Skip to content

Commit 0cb8939

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent afae3cb commit 0cb8939

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

git-add--interactive.perl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,8 @@ sub list_and_choose {
483483
my $last_lf = 0;
484484

485485
if ($opts->{HEADER}) {
486-
if (!$opts->{LIST_FLAT}) {
487-
print " ";
488-
}
489-
print colored $header_color, "$opts->{HEADER}\n";
486+
my $indent = $opts->{LIST_FLAT} ? "" : " ";
487+
print colored $header_color, "$indent$opts->{HEADER}\n";
490488
}
491489
for ($i = 0; $i < @stuff; $i++) {
492490
my $chosen = $chosen[$i] ? '*' : ' ';

0 commit comments

Comments
 (0)