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 git update-ref -d refs/heads/main &&
29 echo >fileA fileA again &&
30 echo >subdir/fileB fileB again &&
31 git add fileA subdir/fileB &&
32 git commit -a -m "Initial in alternate history." &&
33 B0=$(git rev-parse --verify HEAD) &&
35 echo >fileA fileA modified in alternate history &&
36 git commit -a -m "Second in alternate history." &&
37 B1=$(git rev-parse --verify HEAD) &&
39 echo >subdir/fileB fileB modified in alternate history &&
40 git commit -a -m "Third in alternate history." &&
41 B2=$(git rev-parse --verify HEAD) &&
60 if test "$which" = arg
65 if test "$type" = basic
69 if test "z$child" != z
76 if test "$type" != basic
&& test "z$child" != z
78 echo >>test.expect
$child
82 git rev-list
$arg >test.actual
83 elif test $type = parents
85 git rev-list
--parents $arg >test.actual
86 elif test $type = parents-raw
88 git rev-list
--parents --pretty=raw
$arg |
89 sed -n -e 's/^commit //p' >test.actual
91 test_cmp
test.expect
test.actual
94 for type in basic parents parents-raw
96 test_expect_success
'without grafts' "
97 rm -f .git/info/grafts &&
98 check $type $B2 -- $B2 $B1 $B0
101 test_expect_success
'with grafts' "
102 mkdir -p .git/info &&
103 echo '$B0 $A2' >.git/info/grafts &&
104 check $type $B2 -- $B2 $B1 $B0 $A2 $A1 $A0
107 test_expect_success
'without grafts, with pathlimit' "
108 rm -f .git/info/grafts &&
109 check $type $B2 subdir -- $B2 $B0
112 test_expect_success
'with grafts, with pathlimit' "
113 echo '$B0 $A2' >.git/info/grafts &&
114 check $type $B2 subdir -- $B2 $B0 $A2 $A0
119 test_expect_success
'show advice that grafts are deprecated' '
120 git show HEAD 2>err &&
121 test_i18ngrep "git replace" err &&
122 test_config advice.graftFileDeprecated false &&
123 git show HEAD 2>err &&
124 test_i18ngrep ! "git replace" err