]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9304-fast-import-marks.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t9304-fast-import-marks.sh
CommitLineData
3f018ec7
JK
1#!/bin/sh
2
3test_description='test exotic situations with marks'
4. ./test-lib.sh
5
6test_expect_success 'setup dump of basic history' '
7 test_commit one &&
8 git fast-export --export-marks=marks HEAD >dump
9'
10
11test_expect_success 'setup large marks file' '
12 # normally a marks file would have a lot of useful, unique
13 # marks. But for our purposes, just having a lot of nonsense
14 # ones is fine. Start at 1024 to avoid clashing with marks
15 # legitimately used in our tiny dump.
16 blob=$(git rev-parse HEAD:one.t) &&
17 for i in $(test_seq 1024 16384)
18 do
0c51d6b4 19 echo ":$i $blob" || return 1
3f018ec7
JK
20 done >>marks
21'
22
23test_expect_success 'import with large marks file' '
24 git fast-import --import-marks=marks <dump
25'
26
27test_expect_success 'setup dump with submodule' '
f4a32a55 28 test_config_global protocol.file.allow always &&
3f018ec7
JK
29 git submodule add "$PWD" sub &&
30 git commit -m "add submodule" &&
31 git fast-export HEAD >dump
32'
33
34test_expect_success 'setup submodule mapping with large id' '
35 old=$(git rev-parse HEAD:sub) &&
36 new=$(echo $old | sed s/./a/g) &&
37 echo ":12345 $old" >from &&
38 echo ":12345 $new" >to
39'
40
41test_expect_success 'import with submodule mapping' '
42 git init dst &&
43 git -C dst fast-import \
44 --rewrite-submodules-from=sub:../from \
45 --rewrite-submodules-to=sub:../to \
46 <dump &&
47 git -C dst rev-parse HEAD:sub >actual &&
48 echo "$new" >expect &&
49 test_cmp expect actual
50'
51
9dc607f1
JK
52test_expect_success 'paths adjusted for relative subdir' '
53 git init deep-dst &&
54 mkdir deep-dst/subdir &&
55 >deep-dst/subdir/empty-marks &&
56 git -C deep-dst/subdir fast-import \
57 --rewrite-submodules-from=sub:../../from \
58 --rewrite-submodules-to=sub:../../to \
59 --import-marks=empty-marks \
60 --export-marks=exported-marks \
61 --export-pack-edges=exported-edges \
62 <dump &&
63 # we do not bother checking resulting repo; we just care that nothing
64 # complained about failing to open files for reading, and that files
65 # for writing were created in the expected spot
66 test_path_is_file deep-dst/subdir/exported-marks &&
67 test_path_is_file deep-dst/subdir/exported-edges
68'
69
70test_expect_success 'relative marks are not affected by subdir' '
71 git init deep-relative &&
72 mkdir deep-relative/subdir &&
73 git -C deep-relative/subdir fast-import \
74 --relative-marks \
75 --export-marks=exported-marks \
76 <dump &&
77 test_path_is_missing deep-relative/subdir/exported-marks &&
78 test_path_is_file deep-relative/.git/info/fast-import/exported-marks
79'
80
3f018ec7 81test_done