Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2005 Junio C Hamano |
| 4 | # |
| 5 | |
| 6 | test_description='More rename detection tests. |
| 7 | |
| 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. |
| 11 | ' |
| 12 | . ./test-lib.sh |
Junio C Hamano | bfdbee9 | 2008-08-08 02:26:28 -0700 | [diff] [blame] | 13 | . "$TEST_DIRECTORY"/diff-lib.sh |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 14 | |
Ævar Arnfjörð Bjarmason | f6c1998 | 2010-07-28 10:34:56 +0000 | [diff] [blame] | 15 | test_expect_success SYMLINKS \ |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 16 | 'prepare reference tree' \ |
| 17 | 'echo xyzzy | tr -d '\\\\'012 >yomin && |
| 18 | ln -s xyzzy frotz && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 19 | git update-index --add frotz yomin && |
| 20 | tree=$(git write-tree) && |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 21 | echo $tree' |
| 22 | |
Ævar Arnfjörð Bjarmason | f6c1998 | 2010-07-28 10:34:56 +0000 | [diff] [blame] | 23 | test_expect_success SYMLINKS \ |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 24 | 'prepare work tree' \ |
| 25 | 'mv frotz rezrov && |
| 26 | rm -f yomin && |
| 27 | ln -s xyzzy nitfol && |
| 28 | ln -s xzzzy bozbar && |
Junio C Hamano | 5be6007 | 2007-07-02 22:52:14 -0700 | [diff] [blame] | 29 | git update-index --add --remove frotz rezrov nitfol bozbar yomin' |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 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 | |
Ævar Arnfjörð Bjarmason | f6c1998 | 2010-07-28 10:34:56 +0000 | [diff] [blame] | 37 | test_expect_success SYMLINKS 'setup diff output' " |
Linus Torvalds | 0940e5f | 2011-02-18 20:10:32 -0800 | [diff] [blame] | 38 | GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current && |
Ævar Arnfjörð Bjarmason | f6c1998 | 2010-07-28 10:34:56 +0000 | [diff] [blame] | 39 | cat >expected <<\EOF |
Junio C Hamano | 25d5ea4 | 2005-05-24 01:10:48 -0700 | [diff] [blame] | 40 | diff --git a/bozbar b/bozbar |
| 41 | new file mode 120000 |
| 42 | --- /dev/null |
| 43 | +++ b/bozbar |
| 44 | @@ -0,0 +1 @@ |
| 45 | +xzzzy |
| 46 | \ No newline at end of file |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 47 | diff --git a/frotz b/nitfol |
| 48 | similarity index 100% |
| 49 | copy from frotz |
| 50 | copy to nitfol |
| 51 | diff --git a/frotz b/rezrov |
| 52 | similarity index 100% |
Linus Torvalds | dc93841 | 2005-06-05 15:31:52 -0700 | [diff] [blame] | 53 | rename from frotz |
| 54 | rename to rezrov |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 55 | diff --git a/yomin b/yomin |
| 56 | deleted file mode 100644 |
| 57 | --- a/yomin |
| 58 | +++ /dev/null |
| 59 | @@ -1 +0,0 @@ |
| 60 | -xyzzy |
| 61 | \ No newline at end of file |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 62 | EOF |
Ævar Arnfjörð Bjarmason | f6c1998 | 2010-07-28 10:34:56 +0000 | [diff] [blame] | 63 | " |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 64 | |
Ævar Arnfjörð Bjarmason | f6c1998 | 2010-07-28 10:34:56 +0000 | [diff] [blame] | 65 | test_expect_success SYMLINKS \ |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 66 | 'validate diff output' \ |
Junio C Hamano | ec1fcc1 | 2005-10-07 03:42:00 -0700 | [diff] [blame] | 67 | 'compare_diff_patch current expected' |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 68 | |
| 69 | test_done |