aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-11-02 13:17:37 -0800
committerJunio C Hamano <gitster@pobox.com>2020-11-02 13:17:37 -0800
commitcd47bbe1644d461dd166a46b905b602a8881ef41 (patch)
tree4b975f1125b7f32922e84b8e01db9f7e0eeea9fc /t
parent6b9f5096eb034cc59a0a71b86ae65eb9433c8ea8 (diff)
parent3f018ec716292b4d757385686f42f57af3bca685 (diff)
downloadgit-cd47bbe1644d461dd166a46b905b602a8881ef41.tar.gz
Merge branch 'jk/fast-import-marks-alloc-fix'
"git fast-import" wasted a lot of memory when many marks were in use. * jk/fast-import-marks-alloc-fix: fast-import: fix over-allocation of marks storage
Diffstat (limited to 't')
-rwxr-xr-xt/t9304-fast-import-marks.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/t/t9304-fast-import-marks.sh b/t/t9304-fast-import-marks.sh
new file mode 100755
index 0000000000..d4359dba21
--- /dev/null
+++ b/t/t9304-fast-import-marks.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+test_description='test exotic situations with marks'
+. ./test-lib.sh
+
+test_expect_success 'setup dump of basic history' '
+ test_commit one &&
+ git fast-export --export-marks=marks HEAD >dump
+'
+
+test_expect_success 'setup large marks file' '
+ # normally a marks file would have a lot of useful, unique
+ # marks. But for our purposes, just having a lot of nonsense
+ # ones is fine. Start at 1024 to avoid clashing with marks
+ # legitimately used in our tiny dump.
+ blob=$(git rev-parse HEAD:one.t) &&
+ for i in $(test_seq 1024 16384)
+ do
+ echo ":$i $blob"
+ done >>marks
+'
+
+test_expect_success 'import with large marks file' '
+ git fast-import --import-marks=marks <dump
+'
+
+test_expect_success 'setup dump with submodule' '
+ git submodule add "$PWD" sub &&
+ git commit -m "add submodule" &&
+ git fast-export HEAD >dump
+'
+
+test_expect_success 'setup submodule mapping with large id' '
+ old=$(git rev-parse HEAD:sub) &&
+ new=$(echo $old | sed s/./a/g) &&
+ echo ":12345 $old" >from &&
+ echo ":12345 $new" >to
+'
+
+test_expect_success 'import with submodule mapping' '
+ git init dst &&
+ git -C dst fast-import \
+ --rewrite-submodules-from=sub:../from \
+ --rewrite-submodules-to=sub:../to \
+ <dump &&
+ git -C dst rev-parse HEAD:sub >actual &&
+ echo "$new" >expect &&
+ test_cmp expect actual
+'
+
+test_done