git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] gc: rename keep_base_pack variable for --keep-largest-pack

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 20, 2020, 11:55 UTC
Message-ID
<20201120115522.23617-2-avarab@gmail.com>
In-Reply-To
<20200806214929.22qgjg3o2noosjuo@ltop.local>

As noted in an earlier change the keep_base_pack variable name is a relic from an earlier on-list version of ae4e89e549 ("gc: add --keep-largest-pack option", 2018-04-15) before it was renamed to --keep-largest-pack.

Let's change the variable name to avoid that confusion, it's easier to read the code if there's a 1=1 mapping between the variable name and option name.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/gc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index 5cd2a43f9f..07c15e4b64 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -533,7 +533,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 	const char *name;
 	pid_t pid;
 	int daemonized = 0;
-	int keep_base_pack = -1;
+	int keep_largest_pack = -1;
 	timestamp_t dummy;
 
 	struct option builtin_gc_options[] = {
@@ -547,7 +547,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 		OPT_BOOL_F(0, "force", &force,
 			   N_("force running gc even if there may be another gc running"),
 			   PARSE_OPT_NOCOMPLETE),
-		OPT_BOOL(0, "keep-largest-pack", &keep_base_pack,
+		OPT_BOOL(0, "keep-largest-pack", &keep_largest_pack,
 			 N_("repack all other packs except the largest pack")),
 		OPT_END()
 	};
@@ -624,8 +624,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 	} else {
 		struct string_list keep_pack = STRING_LIST_INIT_NODUP;
 
-		if (keep_base_pack != -1) {
-			if (keep_base_pack)
+		if (keep_largest_pack != -1) {
+			if (keep_largest_pack)
 				find_base_packs(&keep_pack, 0);
 		} else if (big_pack_threshold) {
 			find_base_packs(&keep_pack, big_pack_threshold);
-- 
2.29.2.222.g5d2a92d10f8
Previous: Ævar Arnfjörð Bjarmason
Message 5 of 5 in “gc docs: git gc --keep-base-pack ?”
  1. Luc Van OostenryckAug 6, 2020
  2. 1/2 gc docs: change --keep-base-pack to --keep-largest-packÆvar Arnfjörð Bjarmason, Nov 20, 2020
  3. Junio C HamanoNov 21, 2020
  4. Ævar Arnfjörð BjarmasonNov 23, 2020
  5. 2/2 gc: rename keep_base_pack variable for --keep-largest-packÆvar Arnfjörð Bjarmason, Nov 20, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.