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
10 test_expect_success setup '
13 echo >subdir/fileB fileB &&
14 git add fileA subdir/fileB &&
15 git commit -a -m "Initial in one history." &&
16 A0=$(git rev-parse --verify HEAD) &&
18 echo >fileA fileA modified &&
19 git commit -a -m "Second in one history." &&
20 A1=$(git rev-parse --verify HEAD) &&
22 echo >subdir/fileB fileB modified &&
23 git commit -a -m "Third in one history." &&
24 A2=$(git rev-parse --verify HEAD) &&
26 rm -f .git/refs/heads/main .git/index &&
28 echo >fileA fileA again &&
29 echo >subdir/fileB fileB again &&
30 git add fileA subdir/fileB &&
31 git commit -a -m "Initial in alternate history." &&
32 B0=$(git rev-parse --verify HEAD) &&
34 echo >fileA fileA modified in alternate history &&
35 git commit -a -m "Second in alternate history." &&
36 B1=$(git rev-parse --verify HEAD) &&
38 echo >subdir/fileB fileB modified in alternate history &&
39 git commit -a -m "Third in alternate history." &&
40 B2=$(git rev-parse --verify HEAD) &&
59 if test "$which" = arg
64 if test "$type" = basic
68 if test "z$child" != z
75 if test "$type" != basic && test "z$child" != z
77 echo >>test.expect $child
81 git rev-list $arg >test.actual
82 elif test $type = parents
84 git rev-list --parents $arg >test.actual
85 elif test $type = parents-raw
87 git rev-list --parents --pretty=raw $arg |
88 sed -n -e 's/^commit //p' >test.actual
90 test_cmp test.expect test.actual
93 for type in basic parents parents-raw
95 test_expect_success 'without grafts' "
96 rm -f .git/info/grafts &&
97 check $type $B2 -- $B2 $B1 $B0
100 test_expect_success 'with grafts' "
101 echo '$B0 $A2' >.git/info/grafts &&
102 check $type $B2 -- $B2 $B1 $B0 $A2 $A1 $A0
105 test_expect_success 'without grafts, with pathlimit' "
106 rm -f .git/info/grafts &&
107 check $type $B2 subdir -- $B2 $B0
110 test_expect_success 'with grafts, with pathlimit' "
111 echo '$B0 $A2' >.git/info/grafts &&
112 check $type $B2 subdir -- $B2 $B0 $A2 $A0
117 test_expect_success 'show advice that grafts are deprecated' '
118 git show HEAD 2>err &&
119 test_i18ngrep "git replace" err &&
120 test_config advice.graftFileDeprecated false &&
121 git show HEAD 2>err &&
122 test_i18ngrep ! "git replace" err