t6042: Add a testcase where git deletes an untracked file

Current git will nuke an untracked file during a rename/delete conflict if (a) there is an untracked file whose name matches the source of a rename and (b) the merge is done in a certain direction. Add a simple testcase demonstrating this bug. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Aug 11, 2011 at 23:19 UTC 695576fddd039b2fdc3cad52bbaab4d89e27b71c
2 files changed +37 -1
t/t6036-recursive-corner-cases.sh
+1 -1
@@ -1,6 +1,6 @@
1 #!/bin/sh
2
3 -test_description='recursive merge corner cases'
3 +test_description='recursive merge corner cases involving criss-cross merges'
4
5 . ./test-lib.sh
6
t/t6042-merge-rename-corner-cases.sh new
+36
@@ -0,0 +1,36 @@
1 +#!/bin/sh
2 +
3 +test_description="recursive merge corner cases w/ renames but not criss-crosses"
4 +# t6036 has corner cases that involve both criss-cross merges and renames
5 +
6 +. ./test-lib.sh
7 +
8 +test_expect_success 'setup rename/delete + untracked file' '
9 + echo "A pretty inscription" >ring &&
10 + git add ring &&
11 + test_tick &&
12 + git commit -m beginning &&
13 +
14 + git branch people &&
15 + git checkout -b rename-the-ring &&
16 + git mv ring one-ring-to-rule-them-all &&
17 + test_tick &&
18 + git commit -m fullname &&
19 +
20 + git checkout people &&
21 + git rm ring &&
22 + echo gollum >owner &&
23 + git add owner &&
24 + test_tick &&
25 + git commit -m track-people-instead-of-objects &&
26 + echo "Myyy PRECIOUSSS" >ring
27 +'
28 +
29 +test_expect_failure "Does git preserve Gollum's precious artifact?" '
30 + test_must_fail git merge -s recursive rename-the-ring &&
31 +
32 + # Make sure git did not delete an untracked file
33 + test -f ring
34 +'
35 +
36 +test_done