]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4004-diff-rename-symlink.sh
gitweb: correctly store previous rev in javascript-actions mode
[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'
12. ./test-lib.sh
bfdbee98 13. "$TEST_DIRECTORY"/diff-lib.sh
60896c7b 14
f6c1998f 15test_expect_success SYMLINKS \
60896c7b
JH
16 'prepare reference tree' \
17 'echo xyzzy | tr -d '\\\\'012 >yomin &&
18 ln -s xyzzy frotz &&
5be60078
JH
19 git update-index --add frotz yomin &&
20 tree=$(git write-tree) &&
60896c7b
JH
21 echo $tree'
22
f6c1998f 23test_expect_success SYMLINKS \
60896c7b
JH
24 'prepare work tree' \
25 'mv frotz rezrov &&
26 rm -f yomin &&
27 ln -s xyzzy nitfol &&
28 ln -s xzzzy bozbar &&
5be60078 29 git update-index --add --remove frotz rezrov nitfol bozbar yomin'
60896c7b
JH
30
31# tree has frotz pointing at xyzzy, and yomin that contains xyzzy to
32# confuse things. work tree has rezrov (xyzzy) nitfol (xyzzy) and
33# bozbar (xzzzy).
34# rezrov and nitfol are rename/copy of frotz and bozbar should be
35# a new creation.
36
f6c1998f 37test_expect_success SYMLINKS 'setup diff output' "
0940e5f2 38 GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current &&
f6c1998f 39 cat >expected <<\EOF
25d5ea41
JH
40diff --git a/bozbar b/bozbar
41new file mode 120000
42--- /dev/null
43+++ b/bozbar
44@@ -0,0 +1 @@
45+xzzzy
46\ No newline at end of file
60896c7b
JH
47diff --git a/frotz b/nitfol
48similarity index 100%
49copy from frotz
50copy to nitfol
51diff --git a/frotz b/rezrov
52similarity index 100%
dc938417
LT
53rename from frotz
54rename to rezrov
60896c7b
JH
55diff --git a/yomin b/yomin
56deleted file mode 100644
57--- a/yomin
58+++ /dev/null
59@@ -1 +0,0 @@
60-xyzzy
61\ No newline at end of file
60896c7b 62EOF
f6c1998f 63"
60896c7b 64
f6c1998f 65test_expect_success SYMLINKS \
60896c7b 66 'validate diff output' \
ec1fcc16 67 'compare_diff_patch current expected'
60896c7b
JH
68
69test_done