git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Michael Haggerty <mhagger@alum.mit.edu>
Subject: [RFC 04/11] remote: use the new functions for handling --prune options
Date: Wed,  4 Dec 2013 06:44:43 +0100	[thread overview]
Message-ID: <1386135890-13954-5-git-send-email-mhagger@alum.mit.edu> (raw)
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

  parent reply	other threads:[~2013-12-04  5:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04  5:44 [RFC 00/11] Make reference pruning more configurable Michael Haggerty
2013-12-04  5:44 ` [RFC 01/11] get_stale_heads(): allow limiting to refname patterns Michael Haggerty
2013-12-04  5:44 ` [RFC 02/11] remote.c: add infrastructure for parsing --prune options Michael Haggerty
2013-12-04 12:57   ` Duy Nguyen
2013-12-04 17:04     ` Michael Haggerty
2013-12-04  5:44 ` [RFC 03/11] fetch: use the new functions for handling " Michael Haggerty
2013-12-04  5:44 ` Michael Haggerty [this message]
2013-12-04  5:44 ` [RFC 05/11] remote.c: add infrastructure to handle --prune=<pattern> Michael Haggerty
2013-12-04  5:44 ` [RFC 06/11] fetch --prune: allow refname patterns to be specified Michael Haggerty
2013-12-04  5:44 ` [RFC 07/11] remote update " Michael Haggerty
2013-12-04  5:44 ` [RFC 08/11] string_list_append_list(): new function Michael Haggerty
2013-12-04  5:44 ` [RFC 09/11] remote prune: allow --prune=<pattern> options Michael Haggerty
2013-12-04  5:44 ` [RFC 10/11] remote show: " Michael Haggerty
2013-12-04  5:44 ` [RFC 11/11] remote: allow prune patterns to be configured Michael Haggerty
2013-12-04 20:25 ` [RFC 00/11] Make reference pruning more configurable Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386135890-13954-5-git-send-email-mhagger@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).