Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t5351-unpack-large-objects.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t5351-unpack-large-objects.sh` 102 lines ยท 2821 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2022 Han Xin 4 # 5 6 test_description='git unpack-objects with large objects' 7 8 . ./test-lib.sh 9 10 prepare_dest () { 11 test_when_finished "rm -rf dest.git" && 12 git init --bare dest.git && 13 git -C dest.git config core.bigFileThreshold "$1" 14 } 15 16 test_expect_success "create large objects (1.5 MB) and PACK" ' 17 test-tool genrandom foo `1500000` >big-blob && 18 test_commit --append foo big-blob && 19 test-tool genrandom bar `1500000` >big-blob && 20 test_commit --append bar big-blob && 21 PACK=$(echo HEAD | git pack-objects --revs pack) && 22 git verify-pack -v pack-$PACK.pack >out && 23 sed -n -e "s/^\([0-9a-f][0-9a-f]*\).*\(commit\|tree\|blob\).*/\1/p" \ 24 obj-list 25 ' 26 27 test_expect_success 'set memory limitation to 1MB' ' 28 GIT_ALLOC_LIMIT=1m && 29 export GIT_ALLOC_LIMIT 30 ' 31 32 test_expect_success 'unpack-objects failed under memory limitation' ' 33 prepare_dest 2m && 34 test_must_fail git -C dest.git unpack-objects err && 35 test_grep "fatal: attempting to allocate" err 36 ' 37 38 test_expect_success 'unpack-objects works with memory limitation in dry-run mode' ' 39 prepare_dest 2m && 40 git -C dest.git unpack-objects -n expect && 56 sed -n \ 57 -e '/^{"event":"counter",.*"category":"fsync",/ { 58 s/.*"category":"fsync",//; 59 s/}$//; 60 p; 61 }' \ 62 <"$trace" >actual && 63 test_cmp expect actual 64 } 65 66 BATCH_CONFIGURATION='-c core.fsync=loose-object -c core.fsyncmethod=batch' 67 68 test_expect_success 'unpack big object in stream (core.fsyncmethod=batch)' ' 69 prepare_dest 1m && 70 GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \ 71 GIT_TEST_FSYNC=true \ 72 git -C dest.git $BATCH_CONFIGURATION unpack-objects current && 86 cmp obj-list current 87 ' 88 89 test_expect_success 'do not unpack existing large objects' ' 90 prepare_dest 1m && 91 git -C dest.git index-pack --stdin