@@ -126,6 +126,11 @@ depth is 4095.
a larger and slower repository; see the discussion in
`pack.packSizeLimit`.
+--filter=<filter-spec>::
+ Omits certain objects (usually blobs) from the resulting
+ packfile. See linkgit:git-rev-list[1] for valid
+ `<filter-spec>` forms.
+
-b::
--write-bitmap-index::
Write a reachability bitmap index as part of the repack. This
@@ -152,6 +152,7 @@ struct pack_objects_args {
const char *depth;
const char *threads;
const char *max_pack_size;
+ const char *filter;
int no_reuse_delta;
int no_reuse_object;
int quiet;
@@ -172,6 +173,8 @@ static void prepare_pack_objects(struct child_process *cmd,
strvec_pushf(&cmd->args, "--threads=%s", args->threads);
if (args->max_pack_size)
strvec_pushf(&cmd->args, "--max-pack-size=%s", args->max_pack_size);
+ if (args->filter)
+ strvec_pushf(&cmd->args, "--filter=%s", args->filter);
if (args->no_reuse_delta)
strvec_pushf(&cmd->args, "--no-reuse-delta");
if (args->no_reuse_object)
@@ -238,6 +241,13 @@ static unsigned populate_pack_exts(char *name)
return ret;
}
+static void write_promisor_file_1(char *p)
+{
+ char *promisor_name = mkpathdup("%s-%s.promisor", packtmp, p);
+ write_promisor_file(promisor_name, NULL, 0);
+ free(promisor_name);
+}
+
static void repack_promisor_objects(const struct pack_objects_args *args,
struct string_list *names)
{
@@ -269,7 +279,6 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
out = xfdopen(cmd.out, "r");
while (strbuf_getline_lf(&line, out) != EOF) {
struct string_list_item *item;
- char *promisor_name;
if (line.len != the_hash_algo->hexsz)
die(_("repack: Expecting full hex object ID lines only from pack-objects."));
@@ -286,13 +295,8 @@ static void repack_promisor_objects(const struct pack_objects_args *args,
* concatenate the contents of all .promisor files instead of
* just creating a new empty file.
*/
- promisor_name = mkpathdup("%s-%s.promisor", packtmp,
- line.buf);
- write_promisor_file(promisor_name, NULL, 0);
-
+ write_promisor_file_1(line.buf);
item->util = (void *)(uintptr_t)populate_pack_exts(item->string);
-
- free(promisor_name);
}
fclose(out);
if (finish_command(&cmd))
@@ -660,6 +664,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
N_("limits the maximum number of threads")),
OPT_STRING(0, "max-pack-size", &po_args.max_pack_size, N_("bytes"),
N_("maximum size of each packfile")),
+ OPT_STRING(0, "filter", &po_args.filter, N_("args"),
+ N_("object filtering")),
OPT_BOOL(0, "pack-kept-objects", &pack_kept_objects,
N_("repack objects in packs marked with .keep")),
OPT_STRING_LIST(0, "keep-pack", &keep_pack_list, N_("name"),
@@ -819,6 +825,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
if (line.len != the_hash_algo->hexsz)
die(_("repack: Expecting full hex object ID lines only from pack-objects."));
string_list_append(&names, line.buf);
+ if (po_args.filter)
+ write_promisor_file_1(line.buf);
}
fclose(out);
ret = finish_command(&cmd);