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 | ' |
Ævar Arnfjörð Bjarmason | 16d4bd4 | 2021-10-31 00:24:19 +0200 | [diff] [blame] | 12 | |
| 13 | TEST_PASSES_SANITIZE_LEAK=true |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 14 | . ./test-lib.sh |
Ævar Arnfjörð Bjarmason | ebd73f5 | 2021-02-12 14:29:40 +0100 | [diff] [blame] | 15 | . "$TEST_DIRECTORY"/lib-diff.sh |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 16 | |
John Cai | 93fc423 | 2023-05-18 20:03:17 +0000 | [diff] [blame] | 17 | test_expect_success SYMLINKS 'prepare reference tree' ' |
| 18 | echo xyzzy | tr -d '\\\\'012 >yomin && |
| 19 | ln -s xyzzy frotz && |
| 20 | git update-index --add frotz yomin && |
| 21 | tree=$(git write-tree) && |
| 22 | echo $tree |
| 23 | ' |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 24 | |
John Cai | 93fc423 | 2023-05-18 20:03:17 +0000 | [diff] [blame] | 25 | test_expect_success SYMLINKS 'prepare work tree' ' |
| 26 | mv frotz rezrov && |
| 27 | rm -f yomin && |
| 28 | ln -s xyzzy nitfol && |
| 29 | ln -s xzzzy bozbar && |
| 30 | git update-index --add --remove frotz rezrov nitfol bozbar yomin |
| 31 | ' |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 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 | |
John Cai | 93fc423 | 2023-05-18 20:03:17 +0000 | [diff] [blame] | 39 | test_expect_success SYMLINKS 'setup diff output' ' |
| 40 | GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current && |
| 41 | cat >expected <<\EOF |
Junio C Hamano | 25d5ea4 | 2005-05-24 01:10:48 -0700 | [diff] [blame] | 42 | diff --git a/bozbar b/bozbar |
| 43 | new file mode 120000 |
| 44 | --- /dev/null |
| 45 | +++ b/bozbar |
| 46 | @@ -0,0 +1 @@ |
| 47 | +xzzzy |
| 48 | \ No newline at end of file |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 49 | diff --git a/frotz b/nitfol |
| 50 | similarity index 100% |
| 51 | copy from frotz |
| 52 | copy to nitfol |
| 53 | diff --git a/frotz b/rezrov |
| 54 | similarity index 100% |
Linus Torvalds | dc93841 | 2005-06-05 15:31:52 -0700 | [diff] [blame] | 55 | rename from frotz |
| 56 | rename to rezrov |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 57 | diff --git a/yomin b/yomin |
| 58 | deleted file mode 100644 |
| 59 | --- a/yomin |
| 60 | +++ /dev/null |
| 61 | @@ -1 +0,0 @@ |
| 62 | -xyzzy |
| 63 | \ No newline at end of file |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 64 | EOF |
John Cai | 93fc423 | 2023-05-18 20:03:17 +0000 | [diff] [blame] | 65 | ' |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 66 | |
John Cai | 93fc423 | 2023-05-18 20:03:17 +0000 | [diff] [blame] | 67 | test_expect_success SYMLINKS 'validate diff output' ' |
| 68 | compare_diff_patch current expected |
| 69 | ' |
Junio C Hamano | 60896c7 | 2005-05-22 21:24:49 -0700 | [diff] [blame] | 70 | |
| 71 | test_done |