]>
Commit | Line | Data |
---|---|---|
8641fb24 EW |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006 Eric Wong | |
4 | # | |
5 | ||
6 | test_description='git-apply should not get confused with type changes. | |
7 | ||
8 | ' | |
9 | ||
10 | . ./test-lib.sh | |
11 | ||
12 | test_expect_success 'setup repository and commits' ' | |
13 | echo "hello world" > foo && | |
14 | echo "hi planet" > bar && | |
15 | git update-index --add foo bar && | |
16 | git commit -m initial && | |
17 | git branch initial && | |
18 | rm -f foo && | |
19 | ln -s bar foo && | |
20 | git update-index foo && | |
21 | git commit -m "foo symlinked to bar" && | |
22 | git branch foo-symlinked-to-bar && | |
23 | rm -f foo && | |
24 | echo "how far is the sun?" > foo && | |
25 | git update-index foo && | |
26 | git commit -m "foo back to file" && | |
27 | git branch foo-back-to-file && | |
28 | rm -f foo && | |
29 | git update-index --remove foo && | |
30 | mkdir foo && | |
31 | echo "if only I knew" > foo/baz && | |
32 | git update-index --add foo/baz && | |
33 | git commit -m "foo becomes a directory" && | |
34 | git branch "foo-becomes-a-directory" && | |
35 | echo "hello world" > foo/baz && | |
36 | git update-index foo/baz && | |
37 | git commit -m "foo/baz is the original foo" && | |
38 | git branch foo-baz-renamed-from-foo | |
39 | ' | |
40 | ||
41 | test_expect_success 'file renamed from foo to foo/baz' ' | |
42 | git checkout -f initial && | |
43 | git diff-tree -M -p HEAD foo-baz-renamed-from-foo > patch && | |
44 | git apply --index < patch | |
45 | ' | |
46 | test_debug 'cat patch' | |
47 | ||
48 | ||
49 | test_expect_success 'file renamed from foo/baz to foo' ' | |
50 | git checkout -f foo-baz-renamed-from-foo && | |
51 | git diff-tree -M -p HEAD initial > patch && | |
52 | git apply --index < patch | |
53 | ' | |
54 | test_debug 'cat patch' | |
55 | ||
56 | ||
57 | test_expect_success 'directory becomes file' ' | |
58 | git checkout -f foo-becomes-a-directory && | |
59 | git diff-tree -p HEAD initial > patch && | |
60 | git apply --index < patch | |
61 | ' | |
62 | test_debug 'cat patch' | |
63 | ||
64 | ||
65 | test_expect_success 'file becomes directory' ' | |
66 | git checkout -f initial && | |
67 | git diff-tree -p HEAD foo-becomes-a-directory > patch && | |
68 | git apply --index < patch | |
69 | ' | |
70 | test_debug 'cat patch' | |
71 | ||
72 | ||
73 | test_expect_success 'file becomes symlink' ' | |
74 | git checkout -f initial && | |
75 | git diff-tree -p HEAD foo-symlinked-to-bar > patch && | |
76 | git apply --index < patch | |
77 | ' | |
78 | test_debug 'cat patch' | |
79 | ||
80 | ||
81 | test_expect_success 'symlink becomes file' ' | |
82 | git checkout -f foo-symlinked-to-bar && | |
83 | git diff-tree -p HEAD foo-back-to-file > patch && | |
84 | git apply --index < patch | |
85 | ' | |
86 | test_debug 'cat patch' | |
87 | ||
88 | ||
89 | test_expect_success 'symlink becomes directory' ' | |
90 | git checkout -f foo-symlinked-to-bar && | |
91 | git diff-tree -p HEAD foo-becomes-a-directory > patch && | |
92 | git apply --index < patch | |
93 | ' | |
94 | test_debug 'cat patch' | |
95 | ||
96 | ||
97 | test_expect_success 'directory becomes symlink' ' | |
98 | git checkout -f foo-becomes-a-directory && | |
99 | git diff-tree -p HEAD foo-symlinked-to-bar > patch && | |
100 | git apply --index < patch | |
101 | ' | |
102 | test_debug 'cat patch' | |
103 | ||
104 | ||
105 | test_done |