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

[PATCH] Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is set

From
David Bryson <david@statichacks.org>
Date
Sep 30, 2008, 19:05 UTC
Message-ID
<20080930190549.GA9869@eratosthenes.cryptobackpack.org>

Hi all, This is a quick janitor patch and my first patch sent to the git mailing list. Please let me know if I have done any process of the patch submission wrong, and if I got the Janitorial task done in the proper fashion.

Signed-off-by: David Bryson <david@statichacks.org>
---
 builtin-gc.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/builtin-gc.c b/builtin-gc.c
index fac200e..6260652 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -57,15 +57,12 @@ static int gc_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 	if (!strcmp(var, "gc.pruneexpire")) {
-		if (!value)
-			return config_error_nonbool(var);
-		if (strcmp(value, "now")) {
+		if (value && strcmp(value, "now")) {
 			unsigned long now = approxidate("now");
 			if (approxidate(value) >= now)
 				return error("Invalid %s: '%s'", var, value);
 		}
-		prune_expire = xstrdup(value);
-		return 0;
+		return git_config_string(&prune_expire, var, value);
 	}
 	return git_default_config(var, value, cb);
 }
-- 
1.6.0.2
Next: Shawn O. Pearce
Message 1 of 5 in “Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is set”
  1. Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is setDavid Bryson, Sep 30, 2008
  2. Shawn O. PearceSep 30, 2008
  3. Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is setDavid Bryson, Sep 30, 2008
  4. Shawn O. PearceSep 30, 2008
  5. Use "git_config_string" to simplify "builtin-gc.c" code where "prune_expire" is setDavid Bryson, Sep 30, 2008

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.