]>
Commit | Line | Data |
---|---|---|
8bf2c69c AR |
1 | #!/bin/sh |
2 | ||
3 | test_description='git-mv in subdirs' | |
4 | . ./test-lib.sh | |
5 | ||
6 | test_expect_success \ | |
7 | 'prepare reference tree' \ | |
8 | 'mkdir path0 path1 && | |
9 | cp ../../COPYING path0/COPYING && | |
10 | git-add path0/COPYING && | |
11 | git-commit -m add -a' | |
12 | ||
13 | test_expect_success \ | |
90924d55 | 14 | 'moving the file out of subdirectory' \ |
8bf2c69c AR |
15 | 'cd path0 && git-mv COPYING ../path1/COPYING' |
16 | ||
17 | # in path0 currently | |
18 | test_expect_success \ | |
19 | 'commiting the change' \ | |
90924d55 | 20 | 'cd .. && git-commit -m move-out -a' |
8bf2c69c AR |
21 | |
22 | test_expect_success \ | |
23 | 'checking the commit' \ | |
24 | 'git-diff-tree -r -M --name-status HEAD^ HEAD | \ | |
25 | grep -E "^R100.+path0/COPYING.+path1/COPYING"' | |
26 | ||
90924d55 JW |
27 | test_expect_success \ |
28 | 'moving the file back into subdirectory' \ | |
29 | 'cd path0 && git-mv ../path1/COPYING COPYING' | |
30 | ||
31 | # in path0 currently | |
32 | test_expect_success \ | |
33 | 'commiting the change' \ | |
34 | 'cd .. && git-commit -m move-in -a' | |
35 | ||
36 | test_expect_success \ | |
37 | 'checking the commit' \ | |
38 | 'git-diff-tree -r -M --name-status HEAD^ HEAD | \ | |
39 | grep -E "^R100.+path1/COPYING.+path0/COPYING"' | |
40 | ||
afd22296 JW |
41 | test_expect_success \ |
42 | 'adding another file' \ | |
43 | 'cp ../../README path0/README && | |
44 | git-add path0/README && | |
45 | git-commit -m add2 -a' | |
46 | ||
47 | test_expect_success \ | |
48 | 'moving whole subdirectory' \ | |
49 | 'git-mv path0 path2' | |
50 | ||
51 | test_expect_success \ | |
52 | 'commiting the change' \ | |
53 | 'git-commit -m dir-move -a' | |
54 | ||
55 | test_expect_success \ | |
56 | 'checking the commit' \ | |
57 | 'git-diff-tree -r -M --name-status HEAD^ HEAD | \ | |
58 | grep -E "^R100.+path0/COPYING.+path2/COPYING" && | |
59 | git-diff-tree -r -M --name-status HEAD^ HEAD | \ | |
60 | grep -E "^R100.+path0/README.+path2/README"' | |
61 | ||
a1dad607 JS |
62 | test_expect_success \ |
63 | 'moving whole subdirectory into subdirectory' \ | |
64 | 'git-mv path2 path1' | |
65 | ||
66 | test_expect_success \ | |
67 | 'commiting the change' \ | |
68 | 'git-commit -m dir-move -a' | |
69 | ||
70 | test_expect_success \ | |
71 | 'checking the commit' \ | |
72 | 'git-diff-tree -r -M --name-status HEAD^ HEAD | \ | |
73 | grep -E "^R100.+path2/COPYING.+path1/path2/COPYING" && | |
74 | git-diff-tree -r -M --name-status HEAD^ HEAD | \ | |
75 | grep -E "^R100.+path2/README.+path1/path2/README"' | |
76 | ||
8bf2c69c | 77 | test_done |