| # Copyright (c) 2005 Junio C Hamano |
| test_description='Test rename detection in diff engine. |
| . "$TEST_DIRECTORY"/diff-lib.sh |
| 'update-index --add a file.' \ |
| 'git update-index --add path0' |
| 'tree=$(git write-tree) && echo $tree' |
| sed -e 's/line/Line/' <path0 >path1 |
| 'renamed and edited the file.' \ |
| 'git update-index --add --remove path0 path1' |
| 'git diff-index -p -M after rename and editing.' \ |
| 'git diff-index -p -M $tree >current' |
| diff --git a/path0 b/path1 |
| 'compare_diff_patch current expected' |
| test_expect_success 'favour same basenames over different ones' ' |
| git mv another-path subdir/path1 && |
| git status | grep "renamed: .*path1 -> subdir/path1"' |
| test_expect_success 'favour same basenames even with minor differences' ' |
| git show HEAD:path1 | sed "s/15/16/" > subdir/path1 && |
| git status | grep "renamed: .*path1 -> subdir/path1"' |