From: Derrick Stolee Date: Wed, 7 Jun 2023 13:44:48 +0000 (-0400) Subject: add: test use of brackets when color is disabled X-Git-Tag: v2.42.0-rc0~101^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f74648cea1ada4dd0add46b2ae038606bb47395;p=thirdparty%2Fgit.git add: test use of brackets when color is disabled From 02156b81bbb2cafb19d702c55d45714fcf224048 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Wed, 7 Jun 2023 09:39:01 -0400 Subject: [PATCH v2 2/2] add: test use of brackets when color is disabled The interactive add command, 'git add -i', displays a menu of options using full words. When color is enabled, the first letter of each word is changed to a highlight color to signal that the first letter could be used as a command. Without color, brackets ("[]") are used around these first letters. This behavior was not previously tested directly in t3701, so add a test for it now. Since we use 'git add -i >actual Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index 99192d76a3..f22e74e6e4 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -738,6 +738,29 @@ test_expect_success 'colors can be overridden' ' test_cmp expect actual ' +test_expect_success 'brackets appear without color' ' + git reset --hard && + test_when_finished "git rm -f bracket-test" && + test_write_lines context old more-context >bracket-test && + git add bracket-test && + test_write_lines context new more-context another-one >bracket-test && + + test_write_lines quit >input && + git add -i >actual expect <<-\EOF && + | staged unstaged path + | 1: +3/-0 +2/-1 bracket-test + | + |*** Commands *** + | 1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked + | 5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp + |What now> Bye. + EOF + + test_cmp expect actual +' + test_expect_success 'colors can be skipped with color.ui=false' ' git reset --hard && test_when_finished "git rm -f color-test" &&