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

[PATCH] git-gc --auto: simplify "repack" command line building

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Oct 11, 2007, 01:00 UTC
Message-ID
<470D75AB.2050404@nrlssc.navy.mil>
In-Reply-To
<Pine.LNX.4.64.0710110149100.4174@racer.site>

Since "-a" is removed from the base repack command line, we can simplify how we add additional options to this command line when using --auto.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 builtin-gc.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/builtin-gc.c b/builtin-gc.c
index 6323e0d..956c32d 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -143,8 +143,6 @@ static int too_many_packs(void)
 
 static int need_to_gc(void)
 {
-	int ac = 0;
-
 	/*
 	 * Setting gc.auto and gc.autopacklimit to 0 or negative can
 	 * disable the automatic gc.
@@ -158,14 +156,10 @@ static int need_to_gc(void)
 	 * we run "repack -A -d -l".  Otherwise we tell the caller
 	 * there is no need.
 	 */
-	argv_repack[ac++] = "repack";
 	if (too_many_packs())
-		argv_repack[ac++] = "-A";
+		append_option(argv_repack, "-A", MAX_ADD);
 	else if (!too_many_loose_objects())
 		return 0;
-	argv_repack[ac++] = "-d";
-	argv_repack[ac++] = "-l";
-	argv_repack[ac++] = NULL;
 	return 1;
 }
 
-- 
1.5.3.4.208.g729c0
Previous: Brandon Casey
Message 6 of 6 in “git-gc: by default use safer "-A" option to repack when not --prune'ing”
  1. git-gc: by default use safer "-A" option to repack when not --prune'ingBrandon Casey, Oct 10, 2007
  2. Johannes SchindelinOct 11, 2007
  3. Brandon CaseyOct 11, 2007
  4. Johannes SchindelinOct 11, 2007
  5. Brandon CaseyOct 11, 2007
  6. git-gc --auto: simplify "repack" command line buildingBrandon Casey, Oct 11, 2007

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.