Thread (6 messages) flat view 6 messages, 2 authors, 2016-06-15
DORMANTno replies

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

From: Brandon Casey <hidden>
Date: 2016-06-15 22:43:40
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help