Use prerequisite tags to skip tests that depend on symbolic links
[git/mingw/j6t.git] / t / t4023-diff-rename-typechange.sh
blob5099862ebac7cf381759783c5a3b696edb7ba5bf
1 #!/bin/sh
3 test_description='typechange rename detection'
5 . ./test-lib.sh
7 if ! test_have_prereq SYMLINKS
8 then
9 say 'Symbolic links not supported, skipping tests.'
10 test_done
11 exit
14 test_expect_success setup '
16 rm -f foo bar &&
17 cat "$TEST_DIRECTORY"/../COPYING >foo &&
18 ln -s linklink bar &&
19 git add foo bar &&
20 git commit -a -m Initial &&
21 git tag one &&
23 rm -f foo bar &&
24 cat "$TEST_DIRECTORY"/../COPYING >bar &&
25 ln -s linklink foo &&
26 git add foo bar &&
27 git commit -a -m Second &&
28 git tag two &&
30 rm -f foo bar &&
31 cat "$TEST_DIRECTORY"/../COPYING >foo &&
32 git add foo &&
33 git commit -a -m Third &&
34 git tag three &&
36 mv foo bar &&
37 ln -s linklink foo &&
38 git add foo bar &&
39 git commit -a -m Fourth &&
40 git tag four &&
42 # This is purely for sanity check
44 rm -f foo bar &&
45 cat "$TEST_DIRECTORY"/../COPYING >foo &&
46 cat "$TEST_DIRECTORY"/../Makefile >bar &&
47 git add foo bar &&
48 git commit -a -m Fifth &&
49 git tag five &&
51 rm -f foo bar &&
52 cat "$TEST_DIRECTORY"/../Makefile >foo &&
53 cat "$TEST_DIRECTORY"/../COPYING >bar &&
54 git add foo bar &&
55 git commit -a -m Sixth &&
56 git tag six
60 test_expect_success 'cross renames to be detected for regular files' '
62 git diff-tree five six -r --name-status -B -M | sort >actual &&
64 echo "R100 foo bar"
65 echo "R100 bar foo"
66 } | sort >expect &&
67 test_cmp expect actual
71 test_expect_success 'cross renames to be detected for typechange' '
73 git diff-tree one two -r --name-status -B -M | sort >actual &&
75 echo "R100 foo bar"
76 echo "R100 bar foo"
77 } | sort >expect &&
78 test_cmp expect actual
82 test_expect_success 'moves and renames' '
84 git diff-tree three four -r --name-status -B -M | sort >actual &&
86 echo "R100 foo bar"
87 echo "T100 foo"
88 } | sort >expect &&
89 test_cmp expect actual
93 test_done