Merge branch 'jk/forbid-lf-in-git-url' into maint
[git] / t / t9304-fast-import-marks.sh
1 #!/bin/sh
2
3 test_description='test exotic situations with marks'
4 . ./test-lib.sh
5
6 test_expect_success 'setup dump of basic history' '
7         test_commit one &&
8         git fast-export --export-marks=marks HEAD >dump
9 '
10
11 test_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
19                 echo ":$i $blob"
20         done >>marks
21 '
22
23 test_expect_success 'import with large marks file' '
24         git fast-import --import-marks=marks <dump
25 '
26
27 test_expect_success 'setup dump with submodule' '
28         git submodule add "$PWD" sub &&
29         git commit -m "add submodule" &&
30         git fast-export HEAD >dump
31 '
32
33 test_expect_success 'setup submodule mapping with large id' '
34         old=$(git rev-parse HEAD:sub) &&
35         new=$(echo $old | sed s/./a/g) &&
36         echo ":12345 $old" >from &&
37         echo ":12345 $new" >to
38 '
39
40 test_expect_success 'import with submodule mapping' '
41         git init dst &&
42         git -C dst fast-import \
43                 --rewrite-submodules-from=sub:../from \
44                 --rewrite-submodules-to=sub:../to \
45                 <dump &&
46         git -C dst rev-parse HEAD:sub >actual &&
47         echo "$new" >expect &&
48         test_cmp expect actual
49 '
50
51 test_done