t7300-clean: demonstrate deleting nested repo with an ignored file breakage
commit502c386ff944898c1327a5b5a0fefcd4f62d613a
authorSZEDER Gábor <szeder.dev@gmail.com>
Sun, 25 Aug 2019 18:59:18 +0000 (25 20:59 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Aug 2019 19:01:33 +0000 (26 12:01 -0700)
tree960bfc4bb9e99c17ced1dcaeaa9c9de57a0f4181
parent75b2f01a0f642b39b0f29b6218515df9b5eb798e
t7300-clean: demonstrate deleting nested repo with an ignored file breakage

'git clean -fd' must not delete an untracked directory if it belongs
to a different Git repository or worktree.  Unfortunately, if a
'.gitignore' rule in the outer repository happens to match a file in a
nested repository or worktree, then something goes awry and 'git clean
-fd' does delete the content of the nested repository's worktree
except that ignored file, potentially leading to data loss.

Add a test to 't7300-clean.sh' to demonstrate this breakage.

This issue is a regression introduced in 6b1db43109 (clean: teach
clean -d to preserve ignored paths, 2017-05-23).

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7300-clean.sh