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