@@ -633,125 +633,4 @@ test_expect_success '-n overrides repack.updateServerInfo=true' '
633
633
test_server_info_missing
634
634
'
635
635
636
- test_expect_success ' --expire-to stores pruned objects (now)' '
637
- git init expire-to-now &&
638
- (
639
- cd expire-to-now &&
640
-
641
- git branch -M main &&
642
-
643
- test_commit base &&
644
-
645
- git checkout -b cruft &&
646
- test_commit --no-tag cruft &&
647
-
648
- git rev-list --objects --no-object-names main..cruft >moved.raw &&
649
- sort moved.raw >moved.want &&
650
-
651
- git rev-list --all --objects --no-object-names >expect.raw &&
652
- sort expect.raw >expect &&
653
-
654
- git checkout main &&
655
- git branch -D cruft &&
656
- git reflog expire --all --expire=all &&
657
-
658
- git init --bare expired.git &&
659
- git repack -d \
660
- --cruft --cruft-expiration="now" \
661
- --expire-to="expired.git/objects/pack/pack" &&
662
-
663
- expired="$(ls expired.git/objects/pack/pack-*.idx)" &&
664
- test_path_is_file "${expired%.idx}.mtimes" &&
665
-
666
- # Since the `--cruft-expiration` is "now", the effective
667
- # behavior is to move _all_ unreachable objects out to
668
- # the location in `--expire-to`.
669
- git show-index <$expired >expired.raw &&
670
- cut -d" " -f2 expired.raw | sort >expired.objects &&
671
- git rev-list --all --objects --no-object-names \
672
- >remaining.objects &&
673
-
674
- # ...in other words, the combined contents of this
675
- # repository and expired.git should be the same as the
676
- # set of objects we started with.
677
- cat expired.objects remaining.objects | sort >actual &&
678
- test_cmp expect actual &&
679
-
680
- # The "moved" objects (i.e., those in expired.git)
681
- # should be the same as the cruft objects which were
682
- # expired in the previous step.
683
- test_cmp moved.want expired.objects
684
- )
685
- '
686
-
687
- test_expect_success ' --expire-to stores pruned objects (5.minutes.ago)' '
688
- git init expire-to-5.minutes.ago &&
689
- (
690
- cd expire-to-5.minutes.ago &&
691
-
692
- git branch -M main &&
693
-
694
- test_commit base &&
695
-
696
- # Create two classes of unreachable objects, one which
697
- # is older than 5 minutes (stale), and another which is
698
- # newer (recent).
699
- for kind in stale recent
700
- do
701
- git checkout -b $kind main &&
702
- test_commit --no-tag $kind || return 1
703
- done &&
704
-
705
- git rev-list --objects --no-object-names main..stale >in &&
706
- stale="$(git pack-objects $objdir/pack/pack <in)" &&
707
- mtime="$(test-tool chmtime --get =-600 $objdir/pack/pack-$stale.pack)" &&
708
-
709
- # expect holds the set of objects we expect to find in
710
- # this repository after repacking
711
- git rev-list --objects --no-object-names recent >expect.raw &&
712
- sort expect.raw >expect &&
713
-
714
- # moved.want holds the set of objects we expect to find
715
- # in expired.git
716
- git rev-list --objects --no-object-names main..stale >out &&
717
- sort out >moved.want &&
718
-
719
- git checkout main &&
720
- git branch -D stale recent &&
721
- git reflog expire --all --expire=all &&
722
- git prune-packed &&
723
-
724
- git init --bare expired.git &&
725
- git repack -d \
726
- --cruft --cruft-expiration=5.minutes.ago \
727
- --expire-to="expired.git/objects/pack/pack" &&
728
-
729
- # Some of the remaining objects in this repository are
730
- # unreachable, so use `cat-file --batch-all-objects`
731
- # instead of `rev-list` to get their names
732
- git cat-file --batch-all-objects --batch-check="%(objectname)" \
733
- >remaining.objects &&
734
- sort remaining.objects >actual &&
735
- test_cmp expect actual &&
736
-
737
- (
738
- cd expired.git &&
739
-
740
- expired="$(ls objects/pack/pack-*.mtimes)" &&
741
- test-tool pack-mtimes $(basename $expired) >out &&
742
- cut -d" " -f1 out | sort >../moved.got &&
743
-
744
- # Ensure that there are as many objects with the
745
- # expected mtime as were moved to expired.git.
746
- #
747
- # In other words, ensure that the recorded
748
- # mtimes of any moved objects was written
749
- # correctly.
750
- grep " $mtime$" out >matching &&
751
- test_line_count = $(wc -l <../moved.want) matching
752
- ) &&
753
- test_cmp moved.want moved.got
754
- )
755
- '
756
-
757
636
test_done
0 commit comments