]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4004-diff-rename-symlink.sh
Merge branch 'en/fetch-negotiation-default-fix'
[thirdparty/git.git] / t / t4004-diff-rename-symlink.sh
CommitLineData
60896c7b
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='More rename detection tests.
7
8The rename detection logic should be able to detect pure rename or
9copy of symbolic links, but should not produce rename/copy followed
10by an edit for them.
11'
16d4bd4f
ÆAB
12
13TEST_PASSES_SANITIZE_LEAK=true
60896c7b 14. ./test-lib.sh
ebd73f50 15. "$TEST_DIRECTORY"/lib-diff.sh
60896c7b 16
f6c1998f 17test_expect_success SYMLINKS \
60896c7b
JH
18 'prepare reference tree' \
19 'echo xyzzy | tr -d '\\\\'012 >yomin &&
20 ln -s xyzzy frotz &&
5be60078
JH
21 git update-index --add frotz yomin &&
22 tree=$(git write-tree) &&
60896c7b
JH
23 echo $tree'
24
f6c1998f 25test_expect_success SYMLINKS \
60896c7b
JH
26 'prepare work tree' \
27 'mv frotz rezrov &&
28 rm -f yomin &&
29 ln -s xyzzy nitfol &&
30 ln -s xzzzy bozbar &&
5be60078 31 git update-index --add --remove frotz rezrov nitfol bozbar yomin'
60896c7b
JH
32
33# tree has frotz pointing at xyzzy, and yomin that contains xyzzy to
34# confuse things. work tree has rezrov (xyzzy) nitfol (xyzzy) and
35# bozbar (xzzzy).
36# rezrov and nitfol are rename/copy of frotz and bozbar should be
37# a new creation.
38
f6c1998f 39test_expect_success SYMLINKS 'setup diff output' "
0940e5f2 40 GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current &&
f6c1998f 41 cat >expected <<\EOF
25d5ea41
JH
42diff --git a/bozbar b/bozbar
43new file mode 120000
44--- /dev/null
45+++ b/bozbar
46@@ -0,0 +1 @@
47+xzzzy
48\ No newline at end of file
60896c7b
JH
49diff --git a/frotz b/nitfol
50similarity index 100%
51copy from frotz
52copy to nitfol
53diff --git a/frotz b/rezrov
54similarity index 100%
dc938417
LT
55rename from frotz
56rename to rezrov
60896c7b
JH
57diff --git a/yomin b/yomin
58deleted file mode 100644
59--- a/yomin
60+++ /dev/null
61@@ -1 +0,0 @@
62-xyzzy
63\ No newline at end of file
60896c7b 64EOF
f6c1998f 65"
60896c7b 66
f6c1998f 67test_expect_success SYMLINKS \
60896c7b 68 'validate diff output' \
ec1fcc16 69 'compare_diff_patch current expected'
60896c7b
JH
70
71test_done