Git fork
at reftables-rust 70 lines 1.6 kB view raw
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 13. ./test-lib.sh 14. "$TEST_DIRECTORY"/lib-diff.sh 15 16test_expect_success SYMLINKS 'prepare reference tree' ' 17 echo xyzzy | tr -d '\\\\'012 >yomin && 18 ln -s xyzzy frotz && 19 git update-index --add frotz yomin && 20 tree=$(git write-tree) && 21 echo $tree 22' 23 24test_expect_success SYMLINKS 'prepare work tree' ' 25 mv frotz rezrov && 26 rm -f yomin && 27 ln -s xyzzy nitfol && 28 ln -s xzzzy bozbar && 29 git update-index --add --remove frotz rezrov nitfol bozbar yomin 30' 31 32# tree has frotz pointing at xyzzy, and yomin that contains xyzzy to 33# confuse things. work tree has rezrov (xyzzy) nitfol (xyzzy) and 34# bozbar (xzzzy). 35# rezrov and nitfol are rename/copy of frotz and bozbar should be 36# a new creation. 37 38test_expect_success SYMLINKS 'setup diff output' ' 39 GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current && 40 cat >expected <<\EOF 41diff --git a/bozbar b/bozbar 42new file mode 120000 43--- /dev/null 44+++ b/bozbar 45@@ -0,0 +1 @@ 46+xzzzy 47\ No newline at end of file 48diff --git a/frotz b/nitfol 49similarity index 100% 50copy from frotz 51copy to nitfol 52diff --git a/frotz b/rezrov 53similarity index 100% 54rename from frotz 55rename to rezrov 56diff --git a/yomin b/yomin 57deleted file mode 100644 58--- a/yomin 59+++ /dev/null 60@@ -1 +0,0 @@ 61-xyzzy 62\ No newline at end of file 63EOF 64' 65 66test_expect_success SYMLINKS 'validate diff output' ' 67 compare_diff_patch current expected 68' 69 70test_done