Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Documentation/git-multi-pack-index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git-multi-pack-index - Write and verify multi-pack-indexes
SYNOPSIS
--------
[verse]
'git multi-pack-index' [--object-dir=<dir>] <verb>
'git multi-pack-index' [--object-dir=<dir>] <subcommand>

DESCRIPTION
-----------
Expand All @@ -23,13 +23,18 @@ OPTIONS
`<dir>/packs/multi-pack-index` for the current MIDX file, and
`<dir>/packs` for the pack-files to index.

The following subcommands are available:

write::
When given as the verb, write a new MIDX file to
`<dir>/packs/multi-pack-index`.
Write a new MIDX file.

verify::
When given as the verb, verify the contents of the MIDX file
at `<dir>/packs/multi-pack-index`.
Verify the contents of the MIDX file.

expire::
Delete the pack-files that are tracked by the MIDX file, but
have no objects referenced by the MIDX. Rewrite the MIDX file
afterward to remove all references to these pack-files.


EXAMPLES
Expand Down
4 changes: 3 additions & 1 deletion builtin/multi-pack-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "trace2.h"

static char const * const builtin_multi_pack_index_usage[] = {
N_("git multi-pack-index [--object-dir=<dir>] (write|verify)"),
N_("git multi-pack-index [--object-dir=<dir>] (write|verify|expire)"),
NULL
};

Expand Down Expand Up @@ -47,6 +47,8 @@ int cmd_multi_pack_index(int argc, const char **argv,
return write_midx_file(opts.object_dir);
if (!strcmp(argv[0], "verify"))
return verify_midx_file(the_repository, opts.object_dir);
if (!strcmp(argv[0], "expire"))
return expire_midx_packs(the_repository, opts.object_dir);

die(_("unrecognized verb: %s"), argv[0]);
}
14 changes: 2 additions & 12 deletions builtin/repack.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,9 @@ static void get_non_kept_pack_filenames(struct string_list *fname_list,

static void remove_redundant_pack(const char *dir_name, const char *base_name)
{
const char *exts[] = {".pack", ".idx", ".keep", ".bitmap", ".promisor"};
int i;
struct strbuf buf = STRBUF_INIT;
size_t plen;

strbuf_addf(&buf, "%s/%s", dir_name, base_name);
plen = buf.len;

for (i = 0; i < ARRAY_SIZE(exts); i++) {
strbuf_setlen(&buf, plen);
strbuf_addstr(&buf, exts[i]);
unlink(buf.buf);
}
strbuf_addf(&buf, "%s/%s.pack", dir_name, base_name);
unlink_pack_path(buf.buf, 1);
strbuf_release(&buf);
}

Expand Down
Loading