Re: [PATCH v3 8/9] midx: implement midx_repack()
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Jan 23, 2019, 22:33 UTC
- Message-ID
- <20190123223318.146120-1-jonathantanmy@google.com>
- In-Reply-To
- <a4c2d5a8e16f888f9a3d1090fa92d986919f0162.1547047269.git.gitgitgadget@gmail.com>
Show 7 quoted lines
> From: Derrick Stolee <dstolee@microsoft.com> > > To repack using a multi-pack-index, first sort all pack-files by > their modified time. Second, walk those pack-files from oldest > to newest, adding the packs to a list if they are smaller than the > given pack-size. Finally, collect the objects from the multi-pack- > index that are in those packs and send them to 'git pack-objects'.
Also mention that we stop once the total is at least the batch size.
Show 12 quoted lines
> +test_expect_success 'repack creates a new pack' '
> + (
> + cd dup &&
> + SECOND_SMALLEST_SIZE=$(ls -l .git/objects/pack/*pack | awk "{print \$5;}" | sort -n | head -n 2 | tail -n 1) &&
> + BATCH_SIZE=$(($SECOND_SMALLEST_SIZE + 1)) &&
> + git multi-pack-index repack --batch-size=$BATCH_SIZE &&
> + ls .git/objects/pack/*idx >idx-list &&
> + test_line_count = 5 idx-list &&
> + test-tool read-midx .git/objects | grep idx >midx-list &&
> + test_line_count = 5 midx-list
> + )
> +'Can there be a test_line_count of the output of ls at the beginning, so that we do not have to look at the previous test to indeed see that the 5 is greater than before?
Also add a test to check what happens when we have 3 packs below the batch size, but taking 2 of them together is sufficient to exceed the batch size.
Show 11 quoted lines
> +test_expect_success 'expire removes repacked packs' ' > + ( > + cd dup && > + ls -S .git/objects/pack/*pack | head -n 3 >expect && > + git multi-pack-index expire && > + ls -S .git/objects/pack/*pack >actual && > + test_cmp expect actual && > + test-tool read-midx .git/objects | grep idx >midx-list && > + test_line_count = 3 midx-list > + ) > +'
Same comment as above.