276d7dd2d7494e51a34f7e189aba3d3dc12492e5
1#!/bin/sh
2
3test_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
8test_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
29test_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# Testcase setup for rename/modify/add-source:
37# Commit A: new file: a
38# Commit B: modify a slightly
39# Commit C: rename a->b, add completely different a
40#
41# We should be able to merge B & C cleanly
42
43test_expect_success 'setup rename/modify/add-source conflict' '
44 git rm -rf . &&
45 git clean -fdqx &&
46 rm -rf .git &&
47 git init &&
48
49 printf "1\n2\n3\n4\n5\n6\n7\n" >a &&
50 git add a &&
51 git commit -m A &&
52 git tag A &&
53
54 git checkout -b B A &&
55 echo 8 >>a &&
56 git add a &&
57 git commit -m B &&
58
59 git checkout -b C A &&
60 git mv a b &&
61 echo something completely different >a &&
62 git add a &&
63 git commit -m C
64'
65
66test_expect_failure 'rename/modify/add-source conflict resolvable' '
67 git checkout B^0 &&
68
69 git merge -s recursive C^0 &&
70
71 test $(git rev-parse B:a) = $(git rev-parse b) &&
72 test $(git rev-parse C:a) = $(git rev-parse a)
73'
74
75test_done