1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
#!/bin/sh
test_description='Revision traversal vs grafts and path limiter'
. ./test-lib.sh
test_expect_success setup '
mkdir subdir &&
echo >fileA fileA &&
echo >subdir/fileB fileB &&
git add fileA subdir/fileB &&
git commit -a -m "Initial in one history." &&
A0=$(git rev-parse --verify HEAD) &&
echo >fileA fileA modified &&
git commit -a -m "Second in one history." &&
A1=$(git rev-parse --verify HEAD) &&
echo >subdir/fileB fileB modified &&
git commit -a -m "Third in one history." &&
A2=$(git rev-parse --verify HEAD) &&
rm -f .git/refs/heads/master .git/index &&
echo >fileA fileA again &&
echo >subdir/fileB fileB again &&
git add fileA subdir/fileB &&
git commit -a -m "Initial in alternate history." &&
B0=$(git rev-parse --verify HEAD) &&
echo >fileA fileA modified in alternate history &&
git commit -a -m "Second in alternate history." &&
B1=$(git rev-parse --verify HEAD) &&
echo >subdir/fileB fileB modified in alternate history &&
git commit -a -m "Third in alternate history." &&
B2=$(git rev-parse --verify HEAD) &&
: done
'
check () {
type=$1
shift
arg=
which=arg
rm -f test.expect
for a
do
if test "z$a" = z--
then
which=expect
child=
continue
fi
if test "$which" = arg
then
arg="$arg$a "
continue
fi
if test "$type" = basic
then
echo "$a"
else
if test "z$child" != z
then
echo "$child $a"
fi
child="$a"
fi
done >test.expect
if test "$type" != basic && test "z$child" != z
then
echo >>test.expect $child
fi
if test $type = basic
then
git rev-list $arg >test.actual
elif test $type = parents
then
git rev-list --parents $arg >test.actual
elif test $type = parents-raw
then
git rev-list --parents --pretty=raw $arg |
sed -n -e 's/^commit //p' >test.actual
fi
test_cmp test.expect test.actual
}
for type in basic parents parents-raw
do
test_expect_success 'without grafts' "
rm -f .git/info/grafts &&
check $type $B2 -- $B2 $B1 $B0
"
test_expect_success 'with grafts' "
echo '$B0 $A2' >.git/info/grafts &&
check $type $B2 -- $B2 $B1 $B0 $A2 $A1 $A0
"
test_expect_success 'without grafts, with pathlimit' "
rm -f .git/info/grafts &&
check $type $B2 subdir -- $B2 $B0
"
test_expect_success 'with grafts, with pathlimit' "
echo '$B0 $A2' >.git/info/grafts &&
check $type $B2 subdir -- $B2 $B0 $A2 $A0
"
done
test_expect_success 'show advice that grafts are deprecated' '
git show HEAD 2>err &&
test_i18ngrep "git replace" err &&
test_config advice.graftFileDeprecated false &&
git show HEAD 2>err &&
test_i18ngrep ! "git replace" err
'
test_done
|