Quiet make: do not leave Windows behind
[git/platforms.git] / t / t4004-diff-rename-symlink.sh
blob25a3e1455965d8d71abefdf031502521c57325e4
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='More rename detection tests.
8 The rename detection logic should be able to detect pure rename or
9 copy of symbolic links, but should not produce rename/copy followed
10 by an edit for them.
12 . ./test-lib.sh
13 . "$TEST_DIRECTORY"/diff-lib.sh
15 if test "$no_symlinks"
16 then
17 say 'Symbolic links not supported, skipping tests.'
18 test_done
19 exit
22 test_expect_success \
23 'prepare reference tree' \
24 'echo xyzzy | tr -d '\\\\'012 >yomin &&
25 ln -s xyzzy frotz &&
26 git update-index --add frotz yomin &&
27 tree=$(git write-tree) &&
28 echo $tree'
30 test_expect_success \
31 'prepare work tree' \
32 'mv frotz rezrov &&
33 rm -f yomin &&
34 ln -s xyzzy nitfol &&
35 ln -s xzzzy bozbar &&
36 git update-index --add --remove frotz rezrov nitfol bozbar yomin'
38 # tree has frotz pointing at xyzzy, and yomin that contains xyzzy to
39 # confuse things. work tree has rezrov (xyzzy) nitfol (xyzzy) and
40 # bozbar (xzzzy).
41 # rezrov and nitfol are rename/copy of frotz and bozbar should be
42 # a new creation.
44 GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree >current
45 cat >expected <<\EOF
46 diff --git a/bozbar b/bozbar
47 new file mode 120000
48 --- /dev/null
49 +++ b/bozbar
50 @@ -0,0 +1 @@
51 +xzzzy
52 \ No newline at end of file
53 diff --git a/frotz b/nitfol
54 similarity index 100%
55 copy from frotz
56 copy to nitfol
57 diff --git a/frotz b/rezrov
58 similarity index 100%
59 rename from frotz
60 rename to rezrov
61 diff --git a/yomin b/yomin
62 deleted file mode 100644
63 --- a/yomin
64 +++ /dev/null
65 @@ -1 +0,0 @@
66 -xyzzy
67 \ No newline at end of file
68 EOF
70 test_expect_success \
71 'validate diff output' \
72 'compare_diff_patch current expected'
74 test_done