Skip to content

Commit 35aeabd

Browse files
pks-tgitster
authored andcommitted
refs: remove PACK_REFS_ALL flag
The intent of the `PACK_REFS_ALL` flag is to ask the backend to compact all refs instead of only a subset of them. Thus, this flag gets passed down to `refs_pack_refs()` via `struct pack_refs_opts::flags`. But starting with 4fe42f3 (pack-refs: teach pack-refs --include option, 2023-05-12), the flag's semantics have changed. Instead of being handled by the respective backends, this flag is now getting handled by the callers of `refs_pack_refs()` which will add a single glob ("*") to the list of refs-to-be-packed. Thus, the flag serves no purpose to the ref backends anymore. Remove the flag and replace it with a local variable. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0f65c7a commit 35aeabd

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

builtin/pack-refs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
2121
.flags = flags };
2222
static struct string_list option_excluded_refs = STRING_LIST_INIT_NODUP;
2323
struct string_list_item *item;
24+
int pack_all = 0;
2425

2526
struct option opts[] = {
26-
OPT_BIT(0, "all", &pack_refs_opts.flags, N_("pack everything"), PACK_REFS_ALL),
27+
OPT_BOOL(0, "all", &pack_all, N_("pack everything")),
2728
OPT_BIT(0, "prune", &pack_refs_opts.flags, N_("prune loose refs (default)"), PACK_REFS_PRUNE),
2829
OPT_STRING_LIST(0, "include", pack_refs_opts.includes, N_("pattern"),
2930
N_("references to include")),
@@ -38,7 +39,7 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
3839
for_each_string_list_item(item, &option_excluded_refs)
3940
add_ref_exclusion(pack_refs_opts.exclusions, item->string);
4041

41-
if (pack_refs_opts.flags & PACK_REFS_ALL)
42+
if (pack_all)
4243
string_list_append(pack_refs_opts.includes, "*");
4344

4445
if (!pack_refs_opts.includes->nr)

refs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,8 @@ void warn_dangling_symrefs(FILE *fp, const char *msg_fmt,
422422
/*
423423
* Flags for controlling behaviour of pack_refs()
424424
* PACK_REFS_PRUNE: Prune loose refs after packing
425-
* PACK_REFS_ALL: Pack _all_ refs, not just tags and already packed refs
426425
*/
427426
#define PACK_REFS_PRUNE 0x0001
428-
#define PACK_REFS_ALL 0x0002
429427

430428
struct pack_refs_opts {
431429
unsigned int flags;

0 commit comments

Comments
 (0)