2007-12-01 09:22:38 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='typechange rename detection'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2013-06-08 00:53:32 +04:00
|
|
|
test_expect_success setup '
|
2007-12-01 09:22:38 +03:00
|
|
|
|
|
|
|
rm -f foo bar &&
|
2008-08-08 13:26:28 +04:00
|
|
|
cat "$TEST_DIRECTORY"/../COPYING >foo &&
|
2013-06-08 00:53:32 +04:00
|
|
|
test_ln_s_add linklink bar &&
|
|
|
|
git add foo &&
|
2007-12-01 09:22:38 +03:00
|
|
|
git commit -a -m Initial &&
|
|
|
|
git tag one &&
|
|
|
|
|
2013-06-08 00:53:32 +04:00
|
|
|
git rm -f foo bar &&
|
2008-08-08 13:26:28 +04:00
|
|
|
cat "$TEST_DIRECTORY"/../COPYING >bar &&
|
2013-06-08 00:53:32 +04:00
|
|
|
test_ln_s_add linklink foo &&
|
|
|
|
git add bar &&
|
2007-12-01 09:22:38 +03:00
|
|
|
git commit -a -m Second &&
|
|
|
|
git tag two &&
|
|
|
|
|
2013-06-08 00:53:32 +04:00
|
|
|
git rm -f foo bar &&
|
2008-08-08 13:26:28 +04:00
|
|
|
cat "$TEST_DIRECTORY"/../COPYING >foo &&
|
2007-12-01 09:22:38 +03:00
|
|
|
git add foo &&
|
|
|
|
git commit -a -m Third &&
|
|
|
|
git tag three &&
|
|
|
|
|
|
|
|
mv foo bar &&
|
2013-06-08 00:53:32 +04:00
|
|
|
test_ln_s_add linklink foo &&
|
|
|
|
git add bar &&
|
2007-12-01 09:22:38 +03:00
|
|
|
git commit -a -m Fourth &&
|
|
|
|
git tag four &&
|
|
|
|
|
|
|
|
# This is purely for sanity check
|
|
|
|
|
2013-06-08 00:53:32 +04:00
|
|
|
git rm -f foo bar &&
|
2008-08-08 13:26:28 +04:00
|
|
|
cat "$TEST_DIRECTORY"/../COPYING >foo &&
|
|
|
|
cat "$TEST_DIRECTORY"/../Makefile >bar &&
|
2007-12-01 09:22:38 +03:00
|
|
|
git add foo bar &&
|
|
|
|
git commit -a -m Fifth &&
|
|
|
|
git tag five &&
|
|
|
|
|
2013-06-08 00:53:32 +04:00
|
|
|
git rm -f foo bar &&
|
2008-08-08 13:26:28 +04:00
|
|
|
cat "$TEST_DIRECTORY"/../Makefile >foo &&
|
|
|
|
cat "$TEST_DIRECTORY"/../COPYING >bar &&
|
2007-12-01 09:22:38 +03:00
|
|
|
git add foo bar &&
|
|
|
|
git commit -a -m Sixth &&
|
|
|
|
git tag six
|
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-06-08 00:53:32 +04:00
|
|
|
test_expect_success 'cross renames to be detected for regular files' '
|
2007-12-01 09:22:38 +03:00
|
|
|
|
|
|
|
git diff-tree five six -r --name-status -B -M | sort >actual &&
|
|
|
|
{
|
|
|
|
echo "R100 foo bar"
|
|
|
|
echo "R100 bar foo"
|
|
|
|
} | sort >expect &&
|
2008-03-13 00:36:36 +03:00
|
|
|
test_cmp expect actual
|
2007-12-01 09:22:38 +03:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-06-08 00:53:32 +04:00
|
|
|
test_expect_success 'cross renames to be detected for typechange' '
|
2007-12-01 09:22:38 +03:00
|
|
|
|
|
|
|
git diff-tree one two -r --name-status -B -M | sort >actual &&
|
|
|
|
{
|
|
|
|
echo "R100 foo bar"
|
|
|
|
echo "R100 bar foo"
|
|
|
|
} | sort >expect &&
|
2008-03-13 00:36:36 +03:00
|
|
|
test_cmp expect actual
|
2007-12-01 09:22:38 +03:00
|
|
|
|
|
|
|
'
|
|
|
|
|
2013-06-08 00:53:32 +04:00
|
|
|
test_expect_success 'moves and renames' '
|
2007-12-01 09:22:38 +03:00
|
|
|
|
|
|
|
git diff-tree three four -r --name-status -B -M | sort >actual &&
|
|
|
|
{
|
|
|
|
echo "R100 foo bar"
|
|
|
|
echo "T100 foo"
|
|
|
|
} | sort >expect &&
|
2008-03-13 00:36:36 +03:00
|
|
|
test_cmp expect actual
|
2007-12-01 09:22:38 +03:00
|
|
|
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|