All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Derrick Stolee <stolee@gmail.com>
Subject: [PATCH 08/15] refs: remove `PACK_REFS_ALL` flag
Date: Mon, 18 Mar 2024 11:52:59 +0100	[thread overview]
Message-ID: <919abe8eb993dbfab36136c7d9a4fd5987270519.1710706118.git.ps@pks.im> (raw)
In-Reply-To: <cover.1710706118.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 2464 bytes --]

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 4fe42f326e (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 <ps@pks.im>
---
 builtin/pack-refs.c | 5 +++--
 refs.h              | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c
index bcf383cac9..97921beef2 100644
--- a/builtin/pack-refs.c
+++ b/builtin/pack-refs.c
@@ -21,9 +21,10 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
 						 .flags = flags };
 	static struct string_list option_excluded_refs = STRING_LIST_INIT_NODUP;
 	struct string_list_item *item;
+	int pack_all = 0;
 
 	struct option opts[] = {
-		OPT_BIT(0, "all",   &pack_refs_opts.flags, N_("pack everything"), PACK_REFS_ALL),
+		OPT_BOOL(0, "all",   &pack_all, N_("pack everything")),
 		OPT_BIT(0, "prune", &pack_refs_opts.flags, N_("prune loose refs (default)"), PACK_REFS_PRUNE),
 		OPT_STRING_LIST(0, "include", pack_refs_opts.includes, N_("pattern"),
 			N_("references to include")),
@@ -38,7 +39,7 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
 	for_each_string_list_item(item, &option_excluded_refs)
 		add_ref_exclusion(pack_refs_opts.exclusions, item->string);
 
-	if (pack_refs_opts.flags & PACK_REFS_ALL)
+	if (pack_all)
 		string_list_append(pack_refs_opts.includes, "*");
 
 	if (!pack_refs_opts.includes->nr)
diff --git a/refs.h b/refs.h
index 139ce7113b..8c8994cb29 100644
--- a/refs.h
+++ b/refs.h
@@ -422,10 +422,8 @@ void warn_dangling_symrefs(FILE *fp, const char *msg_fmt,
 /*
  * Flags for controlling behaviour of pack_refs()
  * PACK_REFS_PRUNE: Prune loose refs after packing
- * PACK_REFS_ALL:   Pack _all_ refs, not just tags and already packed refs
  */
 #define PACK_REFS_PRUNE 0x0001
-#define PACK_REFS_ALL   0x0002
 
 struct pack_refs_opts {
 	unsigned int flags;
-- 
2.44.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2024-03-18 10:53 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 10:52 [PATCH 00/15] refs: introduce `--auto` to pack refs as needed Patrick Steinhardt
2024-03-18 10:52 ` [PATCH 01/15] reftable/stack: fix error handling in `reftable_stack_init_addition()` Patrick Steinhardt
2024-03-20 21:50   ` Karthik Nayak
2024-03-25  9:10     ` Patrick Steinhardt
2024-03-18 10:52 ` [PATCH 02/15] reftable/error: discern locked/outdated errors Patrick Steinhardt
2024-03-18 10:52 ` [PATCH 03/15] reftable/stack: use error codes when locking fails during compaction Patrick Steinhardt
2024-03-20 22:14   ` Karthik Nayak
2024-03-25  9:10     ` Patrick Steinhardt
2024-03-18 10:52 ` [PATCH 04/15] reftable/stack: gracefully handle failed auto-compaction due to locks Patrick Steinhardt
2024-03-20 22:22   ` Karthik Nayak
2024-03-25  9:10     ` Patrick Steinhardt
2024-03-18 10:52 ` [PATCH 05/15] refs/reftable: print errors on compaction failure Patrick Steinhardt
2024-03-18 10:52 ` [PATCH 06/15] t/helper: drop pack-refs wrapper Patrick Steinhardt
2024-03-18 10:52 ` [PATCH 07/15] refs: move `struct pack_refs_opts` to where it's used Patrick Steinhardt
2024-03-18 10:52 ` Patrick Steinhardt [this message]
2024-03-18 10:53 ` [PATCH 09/15] refs/reftable: expose auto compaction via new flag Patrick Steinhardt
2024-03-18 10:53 ` [PATCH 10/15] builtin/pack-refs: release allocated memory Patrick Steinhardt
2024-03-20 23:23   ` Karthik Nayak
2024-03-25  9:10     ` Patrick Steinhardt
2024-03-18 10:53 ` [PATCH 11/15] builtin/pack-refs: introduce new "--auto" flag Patrick Steinhardt
2024-03-18 10:53 ` [PATCH 12/15] builtin/gc: move `struct maintenance_run_opts` Patrick Steinhardt
2024-03-18 10:53 ` [PATCH 13/15] t6500: extract objects with "17" prefix Patrick Steinhardt
2024-03-18 10:53 ` [PATCH 14/15] builtin/gc: forward git-gc(1)'s `--auto` flag when packing refs Patrick Steinhardt
2024-03-20 23:56   ` Karthik Nayak
2024-03-25  9:10     ` Patrick Steinhardt
2024-03-18 10:53 ` [PATCH 15/15] builtin/gc: pack refs when using `git maintenance run --auto` Patrick Steinhardt
2024-03-20 23:59   ` Karthik Nayak
2024-03-25  9:10     ` Patrick Steinhardt
2024-03-20 19:30 ` [PATCH 00/15] refs: introduce `--auto` to pack refs as needed Karthik Nayak
2024-03-25  9:10   ` Patrick Steinhardt
2024-03-25 10:02 ` [PATCH v2 " Patrick Steinhardt
2024-03-25 10:02   ` [PATCH v2 01/15] reftable/stack: fix error handling in `reftable_stack_init_addition()` Patrick Steinhardt
2024-03-25 10:02   ` [PATCH v2 02/15] reftable/error: discern locked/outdated errors Patrick Steinhardt
2024-03-25 10:02   ` [PATCH v2 03/15] reftable/stack: use error codes when locking fails during compaction Patrick Steinhardt
2024-03-25 10:02   ` [PATCH v2 04/15] reftable/stack: gracefully handle failed auto-compaction due to locks Patrick Steinhardt
2024-03-25 11:22     ` Patrick Steinhardt
2024-03-25 10:02   ` [PATCH v2 05/15] refs/reftable: print errors on compaction failure Patrick Steinhardt
2024-03-25 10:02   ` [PATCH v2 06/15] t/helper: drop pack-refs wrapper Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 07/15] refs: move `struct pack_refs_opts` to where it's used Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 08/15] refs: remove `PACK_REFS_ALL` flag Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 09/15] refs/reftable: expose auto compaction via new flag Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 10/15] builtin/pack-refs: release allocated memory Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 11/15] builtin/pack-refs: introduce new "--auto" flag Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 12/15] builtin/gc: move `struct maintenance_run_opts` Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 13/15] t6500: extract objects with "17" prefix Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 14/15] builtin/gc: forward git-gc(1)'s `--auto` flag when packing refs Patrick Steinhardt
2024-03-25 10:03   ` [PATCH v2 15/15] builtin/gc: pack refs when using `git maintenance run --auto` Patrick Steinhardt
2024-03-25 11:23   ` [PATCH v2 00/15] refs: introduce `--auto` to pack refs as needed Karthik Nayak
2024-03-25 16:56     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=919abe8eb993dbfab36136c7d9a4fd5987270519.1710706118.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.