3 test_description
='Revision traversal vs grafts and path limiter'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 TEST_PASSES_SANITIZE_LEAK
=true
11 test_expect_success setup
'
14 echo >subdir/fileB fileB &&
15 git add fileA subdir/fileB &&
16 git commit -a -m "Initial in one history." &&
17 A0=$(git rev-parse --verify HEAD) &&
19 echo >fileA fileA modified &&
20 git commit -a -m "Second in one history." &&
21 A1=$(git rev-parse --verify HEAD) &&
23 echo >subdir/fileB fileB modified &&
24 git commit -a -m "Third in one history." &&
25 A2=$(git rev-parse --verify HEAD) &&
27 git update-ref -d refs/heads/main &&
30 echo >fileA fileA again &&
31 echo >subdir/fileB fileB again &&
32 git add fileA subdir/fileB &&
33 git commit -a -m "Initial in alternate history." &&
34 B0=$(git rev-parse --verify HEAD) &&
36 echo >fileA fileA modified in alternate history &&
37 git commit -a -m "Second in alternate history." &&
38 B1=$(git rev-parse --verify HEAD) &&
40 echo >subdir/fileB fileB modified in alternate history &&
41 git commit -a -m "Third in alternate history." &&
42 B2=$(git rev-parse --verify HEAD) &&
61 if test "$which" = arg
66 if test "$type" = basic
70 if test "z$child" != z
77 if test "$type" != basic
&& test "z$child" != z
79 echo >>test.expect
$child
83 git rev-list
$arg >test.actual
84 elif test $type = parents
86 git rev-list
--parents $arg >test.actual
87 elif test $type = parents-raw
89 git rev-list
--parents --pretty=raw
$arg |
90 sed -n -e 's/^commit //p' >test.actual
92 test_cmp
test.expect
test.actual
95 for type in basic parents parents-raw
97 test_expect_success
'without grafts' "
98 rm -f .git/info/grafts &&
99 check $type $B2 -- $B2 $B1 $B0
102 test_expect_success
'with grafts' "
103 mkdir -p .git/info &&
104 echo '$B0 $A2' >.git/info/grafts &&
105 check $type $B2 -- $B2 $B1 $B0 $A2 $A1 $A0
108 test_expect_success
'without grafts, with pathlimit' "
109 rm -f .git/info/grafts &&
110 check $type $B2 subdir -- $B2 $B0
113 test_expect_success
'with grafts, with pathlimit' "
114 echo '$B0 $A2' >.git/info/grafts &&
115 check $type $B2 subdir -- $B2 $B0 $A2 $A0
120 test_expect_success
'show advice that grafts are deprecated' '
121 git show HEAD 2>err &&
122 test_grep "git replace" err &&
123 test_config advice.graftFileDeprecated false &&
124 git show HEAD 2>err &&
125 test_grep ! "git replace" err