Skip to content

Commit 15d354c

Browse files
committed
Merge branch 'ds/add-i-color-configuration-fix' into next
The reimplemented "git add -i" did not honor color.ui configuration. * ds/add-i-color-configuration-fix: add: test use of brackets when color is disabled add: check color.ui for interactive add
2 parents c16a464 + 6f74648 commit 15d354c

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static int add_config(const char *var, const char *value, void *cb)
274274
return 0;
275275
}
276276

277-
return git_default_config(var, value, cb);
277+
return git_color_default_config(var, value, cb);
278278
}
279279

280280
static const char embedded_advice[] = N_(

t/t3701-add-interactive.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,44 @@ test_expect_success 'colors can be overridden' '
734734
test_cmp expect actual
735735
'
736736

737+
test_expect_success 'brackets appear without color' '
738+
git reset --hard &&
739+
test_when_finished "git rm -f bracket-test" &&
740+
test_write_lines context old more-context >bracket-test &&
741+
git add bracket-test &&
742+
test_write_lines context new more-context another-one >bracket-test &&
743+
744+
test_write_lines quit >input &&
745+
git add -i >actual <input &&
746+
747+
sed "s/^|//" >expect <<-\EOF &&
748+
| staged unstaged path
749+
| 1: +3/-0 +2/-1 bracket-test
750+
|
751+
|*** Commands ***
752+
| 1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
753+
| 5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
754+
|What now> Bye.
755+
EOF
756+
757+
test_cmp expect actual
758+
'
759+
760+
test_expect_success 'colors can be skipped with color.ui=false' '
761+
git reset --hard &&
762+
test_when_finished "git rm -f color-test" &&
763+
test_write_lines context old more-context >color-test &&
764+
git add color-test &&
765+
test_write_lines context new more-context another-one >color-test &&
766+
767+
test_write_lines help quit >input &&
768+
force_color git \
769+
-c color.ui=false \
770+
add -i >actual.raw <input &&
771+
test_decode_color <actual.raw >actual &&
772+
test_cmp actual.raw actual
773+
'
774+
737775
test_expect_success 'colorized diffs respect diff.wsErrorHighlight' '
738776
git reset --hard &&
739777

0 commit comments

Comments
 (0)