3 test_description
='test exotic situations with marks'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'setup dump of basic history' '
10 git fast-export --export-marks=marks HEAD >dump
13 test_expect_success
'setup large marks file' '
14 # normally a marks file would have a lot of useful, unique
15 # marks. But for our purposes, just having a lot of nonsense
16 # ones is fine. Start at 1024 to avoid clashing with marks
17 # legitimately used in our tiny dump.
18 blob=$(git rev-parse HEAD:one.t) &&
19 for i in $(test_seq 1024 16384)
21 echo ":$i $blob" || return 1
25 test_expect_success
'import with large marks file' '
26 git fast-import --import-marks=marks <dump
29 test_expect_success
'setup dump with submodule' '
30 test_config_global protocol.file.allow always &&
31 git submodule add "$PWD" sub &&
32 git commit -m "add submodule" &&
33 git fast-export HEAD >dump
36 test_expect_success
'setup submodule mapping with large id' '
37 old=$(git rev-parse HEAD:sub) &&
38 new=$(echo $old | sed s/./a/g) &&
39 echo ":12345 $old" >from &&
40 echo ":12345 $new" >to
43 test_expect_success
'import with submodule mapping' '
45 git -C dst fast-import \
46 --rewrite-submodules-from=sub:../from \
47 --rewrite-submodules-to=sub:../to \
49 git -C dst rev-parse HEAD:sub >actual &&
50 echo "$new" >expect &&
51 test_cmp expect actual
54 test_expect_success
'paths adjusted for relative subdir' '
56 mkdir deep-dst/subdir &&
57 >deep-dst/subdir/empty-marks &&
58 git -C deep-dst/subdir fast-import \
59 --rewrite-submodules-from=sub:../../from \
60 --rewrite-submodules-to=sub:../../to \
61 --import-marks=empty-marks \
62 --export-marks=exported-marks \
63 --export-pack-edges=exported-edges \
65 # we do not bother checking resulting repo; we just care that nothing
66 # complained about failing to open files for reading, and that files
67 # for writing were created in the expected spot
68 test_path_is_file deep-dst/subdir/exported-marks &&
69 test_path_is_file deep-dst/subdir/exported-edges
72 test_expect_success
'relative marks are not affected by subdir' '
73 git init deep-relative &&
74 mkdir deep-relative/subdir &&
75 git -C deep-relative/subdir fast-import \
77 --export-marks=exported-marks \
79 test_path_is_missing deep-relative/subdir/exported-marks &&
80 test_path_is_file deep-relative/.git/info/fast-import/exported-marks