On Fri, Dec 3, 2021 at 9:59 PM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > > > On Fri, Dec 03 2021, Han Xin wrote: > > > diff --git a/t/t5590-unpack-non-delta-objects.sh b/t/t5590-unpack-non-delta-objects.sh > > new file mode 100755 > > index 0000000000..01d950d119 > > --- /dev/null > > +++ b/t/t5590-unpack-non-delta-objects.sh > > @@ -0,0 +1,76 @@ > > +#!/bin/sh > > +# > > +# Copyright (c) 2021 Han Xin > > +# > > + > > +test_description='Test unpack-objects when receive pack' > > + > > +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main > > +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME > > + > > +. ./test-lib.sh > > + > > +test_expect_success "create commit with big blobs (1.5 MB)" ' > > + test-tool genrandom foo 1500000 >big-blob && > > + test_commit --append foo big-blob && > > + test-tool genrandom bar 1500000 >big-blob && > > + test_commit --append bar big-blob && > > + ( > > + cd .git && > > + find objects/?? -type f | sort > > ...are thse... > > > + ) >expect && > > + PACK=$(echo main | git pack-objects --progress --revs test) > > Is --progress needed? > "--progress" is not necessary. > > +' > > + > > +test_expect_success 'setup GIT_ALLOC_LIMIT to 1MB' ' > > + GIT_ALLOC_LIMIT=1m && > > + export GIT_ALLOC_LIMIT > > +' > > + > > +test_expect_success 'prepare dest repository' ' > > + git init --bare dest.git && > > + git -C dest.git config core.bigFileThreshold 2m && > > + git -C dest.git config receive.unpacklimit 100 > > I think it would be better to just (could roll this into a function): > > test_when_finished "rm -rf dest.git" && > git init dest.git && > git -C dest.git config ... > > Then you can use it with e.g. --run=3-4 and not have it error out > because of skipped setup. > > A lot of our tests fail like that, but in this case fixing it seems > trivial. > > OK, I will take it. > > > +' > > + > > +test_expect_success 'fail to unpack-objects: cannot allocate' ' > > + test_must_fail git -C dest.git unpack-objects <test-$PACK.pack 2>err && > > + test_i18ngrep "fatal: attempting to allocate" err && > > nit: just "grep", not "test_i18ngrep" > > > + ( > > + cd dest.git && > > + find objects/?? -type f | sort > > ..."find" needed over just globbing?: > > obj=$(echo objects/*/*) > > ? I tried to use "echo" instead of "find". It works well on my personal computer, but fails due to the "info/commit-graph" generated when CI on Github. So it seems that ".git/objects/??" will be more rigorous?