GIT 0.99.8f
[git.git] / t / t4004-diff-rename-symlink.sh
blobf59614ae255b33f450a784200716c9fd63b0a054
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
14 test_expect_success \
15 'prepare reference tree' \
16 'echo xyzzy | tr -d '\\\\'012 >yomin &&
17 ln -s xyzzy frotz &&
18 git-update-index --add frotz yomin &&
19 tree=$(git-write-tree) &&
20 echo $tree'
22 test_expect_success \
23 'prepare work tree' \
24 'mv frotz rezrov &&
25 rm -f yomin &&
26 ln -s xyzzy nitfol &&
27 ln -s xzzzy bozbar &&
28 git-update-index --add --remove frotz rezrov nitfol bozbar yomin'
30 # tree has frotz pointing at xyzzy, and yomin that contains xyzzy to
31 # confuse things. work tree has rezrov (xyzzy) nitfol (xyzzy) and
32 # bozbar (xzzzy).
33 # rezrov and nitfol are rename/copy of frotz and bozbar should be
34 # a new creation.
36 GIT_DIFF_OPTS=--unified=0 git-diff-index -M -p $tree >current
37 cat >expected <<\EOF
38 diff --git a/bozbar b/bozbar
39 new file mode 120000
40 --- /dev/null
41 +++ b/bozbar
42 @@ -0,0 +1 @@
43 +xzzzy
44 \ No newline at end of file
45 diff --git a/frotz b/nitfol
46 similarity index 100%
47 copy from frotz
48 copy to nitfol
49 diff --git a/frotz b/rezrov
50 similarity index 100%
51 rename from frotz
52 rename to rezrov
53 diff --git a/yomin b/yomin
54 deleted file mode 100644
55 --- a/yomin
56 +++ /dev/null
57 @@ -1 +0,0 @@
58 -xyzzy
59 \ No newline at end of file
60 EOF
62 test_expect_success \
63 'validate diff output' \
64 'diff -u current expected'
66 test_done