t3701: add a test for the different `add -p` prompts
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 6 Dec 2019 13:08:21 +0000 (13:08 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Dec 2019 16:57:34 +0000 (08:57 -0800)
commit24be352d52f96b2cace4d3e5f01f02917b7d649b
treec933564c7ccbb29558b4bedaf14605c52a5e7f0b
parent8539b465341cc475f219ed46273a1c157bddafa0
t3701: add a test for the different `add -p` prompts

The `git add -p` command offers different prompts for regular diff hunks
vs mode change pseudo hunks vs diffs deleting files.

Let's cover this in the regresion test suite, in preparation for
re-implementing `git add -p` in C.

For the mode change prompt, we use a trick that lets this test case pass
even on systems without executable bit, i.e. where `core.filemode =
false` (such as Windows): we first add the file to the index with `git
add --chmod=+x`, and then call `git add -p` with `core.filemode` forced
to `true`. The file on disk has no executable bit set, therefore we will
see a mode change.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3701-add-interactive.sh