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

[RFC 04/11] remote: use the new functions for handling --prune options

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Dec 4, 2013, 05:44 UTC
Message-ID
<1386135890-13954-5-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1386135890-13954-1-git-send-email-mhagger@alum.mit.edu>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 builtin/remote.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/builtin/remote.c b/builtin/remote.c
index c08dfa8..09b965a 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1372,10 +1372,12 @@ static int get_remote_default(const char *key, const char *value, void *priv)
 
 static int update(int argc, const char **argv)
 {
-	int i, prune = -1;
+	int i;
+	struct prune_option prune_option = PRUNE_OPTION_INIT;
 	struct option options[] = {
-		OPT_BOOL('p', "prune", &prune,
-			 N_("prune remotes after fetching")),
+		{ OPTION_CALLBACK, 'p', "prune", &prune_option, N_("pattern"),
+			N_("prune remotes after fetching"),
+			PARSE_OPT_NOARG, prune_option_parse },
 		OPT_END()
 	};
 	struct argv_array fetch_argv = ARGV_ARRAY_INIT;
@@ -1387,8 +1389,7 @@ static int update(int argc, const char **argv)
 
 	argv_array_push(&fetch_argv, "fetch");
 
-	if (prune != -1)
-		argv_array_push(&fetch_argv, prune ? "--prune" : "--no-prune");
+	argv_push_prune_option(&fetch_argv, &prune_option);
 	if (verbose)
 		argv_array_push(&fetch_argv, "-v");
 	argv_array_push(&fetch_argv, "--multiple");
-- 
1.8.4.3
Previous: Michael HaggertyNext: Michael Haggerty
Message 7 of 15 in “[RFC 00/11] Make reference pruning more configurable”
  1. Michael HaggertyDec 4, 2013
  2. 01/11 get_stale_heads(): allow limiting to refname patternsMichael Haggerty, Dec 4, 2013
  3. 02/11 remote.c: add infrastructure for parsing --prune optionsMichael Haggerty, Dec 4, 2013
  4. Duy NguyenDec 4, 2013
  5. Michael HaggertyDec 4, 2013
  6. 03/11 fetch: use the new functions for handling --prune optionsMichael Haggerty, Dec 4, 2013
  7. 04/11 remote: use the new functions for handling --prune optionsMichael Haggerty, Dec 4, 2013
  8. 05/11 remote.c: add infrastructure to handle --prune=<pattern>Michael Haggerty, Dec 4, 2013
  9. 06/11 fetch --prune: allow refname patterns to be specifiedMichael Haggerty, Dec 4, 2013
  10. 07/11 remote update --prune: allow refname patterns to be specifiedMichael Haggerty, Dec 4, 2013
  11. 08/11 string_list_append_list(): new functionMichael Haggerty, Dec 4, 2013
  12. 09/11 remote prune: allow --prune=<pattern> optionsMichael Haggerty, Dec 4, 2013
  13. 10/11 remote show: allow --prune=<pattern> optionsMichael Haggerty, Dec 4, 2013
  14. 11/11 remote: allow prune patterns to be configuredMichael Haggerty, Dec 4, 2013
  15. Junio C HamanoDec 4, 2013

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.