1#!/bin/sh 2 3test_description='typechange rename detection' 4 5. ./test-lib.sh 6. "$TEST_DIRECTORY"/lib-diff.sh 7 8test_expect_success setup ' 9 10 rm -f foo bar && 11 COPYING_test_data >foo && 12 test_ln_s_add linklink bar && 13 git add foo && 14 git commit -a -m Initial && 15 git tag one && 16 17 git rm -f foo bar && 18 COPYING_test_data >bar && 19 test_ln_s_add linklink foo && 20 git add bar && 21 git commit -a -m Second && 22 git tag two && 23 24 git rm -f foo bar && 25 COPYING_test_data >foo && 26 git add foo && 27 git commit -a -m Third && 28 git tag three && 29 30 mv foo bar && 31 test_ln_s_add linklink foo && 32 git add bar && 33 git commit -a -m Fourth && 34 git tag four && 35 36 # This is purely for sanity check 37 38 git rm -f foo bar && 39 COPYING_test_data >foo && 40 cat "$TEST_DIRECTORY"/../Makefile >bar && 41 git add foo bar && 42 git commit -a -m Fifth && 43 git tag five && 44 45 git rm -f foo bar && 46 cat "$TEST_DIRECTORY"/../Makefile >foo && 47 COPYING_test_data >bar && 48 git add foo bar && 49 git commit -a -m Sixth && 50 git tag six 51 52' 53 54test_expect_success 'cross renames to be detected for regular files' ' 55 56 git diff-tree five six -r --name-status -B -M | sort >actual && 57 { 58 echo "R100 foo bar" 59 echo "R100 bar foo" 60 } | sort >expect && 61 test_cmp expect actual 62 63' 64 65test_expect_success 'cross renames to be detected for typechange' ' 66 67 git diff-tree one two -r --name-status -B -M | sort >actual && 68 { 69 echo "R100 foo bar" 70 echo "R100 bar foo" 71 } | sort >expect && 72 test_cmp expect actual 73 74' 75 76test_expect_success 'moves and renames' ' 77 78 git diff-tree three four -r --name-status -B -M | sort >actual && 79 { 80 # see -B -M (#6) in t4008 81 echo "C100 foo bar" 82 echo "T100 foo" 83 } | sort >expect && 84 test_cmp expect actual 85 86' 87 88test_done 89