}
ret = write_midx_file(source, opts.preferred_pack,
- opts.refs_snapshot, opts.flags);
+ opts.refs_snapshot, opts.incremental_base,
+ opts.flags);
free(opts.refs_snapshot);
return ret;
unsigned flags = 0;
if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL, 0))
flags |= MIDX_WRITE_INCREMENTAL;
- write_midx_file(existing.source, NULL, NULL, flags);
+ write_midx_file(existing.source, NULL, NULL, NULL, flags);
}
cleanup:
int write_midx_file(struct odb_source *source,
const char *preferred_pack_name,
const char *refs_snapshot,
+ const char *incremental_base,
unsigned flags)
{
struct write_midx_opts opts = {
.source = source,
.preferred_pack_name = preferred_pack_name,
.refs_snapshot = refs_snapshot,
+ .incremental_base = incremental_base,
.flags = flags,
};
*/
int write_midx_file(struct odb_source *source,
const char *preferred_pack_name, const char *refs_snapshot,
- unsigned flags);
+ const char *incremental_base, unsigned flags);
int write_midx_file_only(struct odb_source *source,
struct string_list *packs_to_include,
const char *preferred_pack_name,
test_grep "cannot use --base without --no-write-chain-file" err
'
-test_expect_success 'write MIDX layer with --base=none and --no-write-chain-file' '
+test_expect_failure 'write MIDX layer with --base=none and --no-write-chain-file' '
test_commit base-none &&
git repack -d &&
--no-write-chain-file --base=none)" &&
test_cmp "$midx_chain.bak" "$midx_chain" &&
- test_path_is_file "$midxdir/multi-pack-index-$layer.midx"
+ test_path_is_file "$midxdir/multi-pack-index-$layer.midx" &&
+
+ echo "$layer" >"$midx_chain" &&
+ test-tool read-midx --show-objects "$objdir" "$layer" >midx.objects &&
+ test_grep "^$(git rev-parse 2.2) " midx.objects &&
+ cp "$midx_chain.bak" "$midx_chain"
'
-test_expect_success 'write MIDX layer with --base=<hash> and --no-write-chain-file' '
+test_expect_failure 'write MIDX layer with --base=<hash> and --no-write-chain-file' '
test_commit base-hash &&
git repack -d &&
cp "$midx_chain" "$midx_chain.bak" &&
+ base="$(nth_line 1 "$midx_chain")" &&
layer="$(git multi-pack-index write --bitmap --incremental \
- --no-write-chain-file --base="$(nth_line 1 "$midx_chain")")" &&
+ --no-write-chain-file --base="$base")" &&
test_cmp "$midx_chain.bak" "$midx_chain" &&
- test_path_is_file "$midxdir/multi-pack-index-$layer.midx"
+ test_path_is_file "$midxdir/multi-pack-index-$layer.midx" &&
+
+ {
+ echo "$base" &&
+ echo "$layer"
+ } >"$midx_chain" &&
+ test-tool read-midx --show-objects "$objdir" "$layer" >midx.objects &&
+ test_grep "^$(git rev-parse 2.2) " midx.objects &&
+ cp "$midx_chain.bak" "$midx_chain"
'
for reuse in false single multi