Message ID | 316a20ed17950e4e45d7ea13d8f6e8d4e064821e.1705521155.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Group reffiles tests | expand |
On Wed, Jan 17, 2024 at 07:52:35PM +0000, John Cai via GitGitGadget wrote: > From: John Cai <johncai86@gmail.com> > > Move a few tests into t0600 since they specifically test the packed-refs > file and thus are specific to the reffiles backend. > > Signed-off-by: John Cai <johncai86@gmail.com> > --- > t/t0600-reffiles-backend.sh | 30 ++++++++++++++++++++++++++++++ > t/t5312-prune-corruption.sh | 26 -------------------------- > 2 files changed, 30 insertions(+), 26 deletions(-) > > diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh > index c88576dfea5..190155f592d 100755 > --- a/t/t0600-reffiles-backend.sh > +++ b/t/t0600-reffiles-backend.sh > @@ -571,4 +571,34 @@ test_expect_success 'log diagnoses bogus HEAD symref' ' > test_grep broken stderr > ' > > +# we do not want to count on running pack-refs to > +# actually pack it, as it is perfectly reasonable to > +# skip processing a broken ref > +test_expect_success 'create packed-refs file with broken ref' ' > + test_tick && git commit --allow-empty -m one && > + recoverable=$(git rev-parse HEAD) && > + test_tick && git commit --allow-empty -m two && > + missing=$(git rev-parse HEAD) && > + rm -f .git/refs/heads/main && > + cat >.git/packed-refs <<-EOF && > + $missing refs/heads/main > + $recoverable refs/heads/other > + EOF > + echo $missing >expect && > + git rev-parse refs/heads/main >actual && > + test_cmp expect actual > +' > + > +test_expect_success 'pack-refs does not silently delete broken packed ref' ' > + git pack-refs --all --prune && > + git rev-parse refs/heads/main >actual && > + test_cmp expect actual > +' > + > +test_expect_success 'pack-refs does not drop broken refs during deletion' ' > + git update-ref -d refs/heads/other && > + git rev-parse refs/heads/main >actual && > + test_cmp expect actual > +' Should these tests be moved into t0601-reffiles-pack-refs.sh instead? Patrick
diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index c88576dfea5..190155f592d 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -571,4 +571,34 @@ test_expect_success 'log diagnoses bogus HEAD symref' ' test_grep broken stderr ' +# we do not want to count on running pack-refs to +# actually pack it, as it is perfectly reasonable to +# skip processing a broken ref +test_expect_success 'create packed-refs file with broken ref' ' + test_tick && git commit --allow-empty -m one && + recoverable=$(git rev-parse HEAD) && + test_tick && git commit --allow-empty -m two && + missing=$(git rev-parse HEAD) && + rm -f .git/refs/heads/main && + cat >.git/packed-refs <<-EOF && + $missing refs/heads/main + $recoverable refs/heads/other + EOF + echo $missing >expect && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not silently delete broken packed ref' ' + git pack-refs --all --prune && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + +test_expect_success 'pack-refs does not drop broken refs during deletion' ' + git update-ref -d refs/heads/other && + git rev-parse refs/heads/main >actual && + test_cmp expect actual +' + test_done diff --git a/t/t5312-prune-corruption.sh b/t/t5312-prune-corruption.sh index 230cb387122..d8d2e304687 100755 --- a/t/t5312-prune-corruption.sh +++ b/t/t5312-prune-corruption.sh @@ -111,30 +111,4 @@ test_expect_success 'pack-refs does not silently delete broken loose ref' ' test_cmp expect actual ' -# we do not want to count on running pack-refs to -# actually pack it, as it is perfectly reasonable to -# skip processing a broken ref -test_expect_success REFFILES 'create packed-refs file with broken ref' ' - rm -f .git/refs/heads/main && - cat >.git/packed-refs <<-EOF && - $missing refs/heads/main - $recoverable refs/heads/other - EOF - echo $missing >expect && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - -test_expect_success REFFILES 'pack-refs does not silently delete broken packed ref' ' - git pack-refs --all --prune && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - -test_expect_success REFFILES 'pack-refs does not drop broken refs during deletion' ' - git update-ref -d refs/heads/other && - git rev-parse refs/heads/main >actual && - test_cmp expect actual -' - test_done