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 07/11] remote update --prune: allow refname patterns to be specified
Date: Wed, 4 Dec 2013 06:44:46 +0100 [thread overview]
Message-ID: <1386135890-13954-8-git-send-email-mhagger@alum.mit.edu> (raw)
In-Reply-To: <1386135890-13954-1-git-send-email-mhagger@alum.mit.edu>
Allow optional arguments to be passed to "git remote update --prune"
to choose which references are subject to pruning. The default, if no
argument is specified, is to prune all references as before.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
Documentation/git-remote.txt | 7 +++++--
builtin/remote.c | 9 ++++++---
t/t5505-remote.sh | 13 +++++++++++++
3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 2507c8b..02e50a9 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -20,7 +20,8 @@ SYNOPSIS
'git remote set-url --delete' [--push] <name> <url>
'git remote' [-v | --verbose] 'show' [-n] <name>...
'git remote prune' [-n | --dry-run] <name>...
-'git remote' [-v | --verbose] 'update' [-p | --prune] [(<group> | <remote>)...]
+'git remote' [-v | --verbose] 'update' [-p | --no-prune | --prune[=<pattern>]...]
+ [(<group> | <remote>)...]
DESCRIPTION
-----------
@@ -168,7 +169,9 @@ remotes.default is not defined, all remotes which do not have the
configuration parameter remote.<name>.skipDefaultUpdate set to true will
be updated. (See linkgit:git-config[1]).
+
-With `--prune` option, prune all the remotes that are updated.
+The options `--prune`, `--no-prune`, and `--prune=<pattern>` affect
+whether remote-tracking branches associated with the remotes are
+pruned. See linkgit:git-fetch[1] for more information.
DISCUSSION
diff --git a/builtin/remote.c b/builtin/remote.c
index 09b965a..6aab923 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -16,7 +16,7 @@ static const char * const builtin_remote_usage[] = {
N_("git remote set-head <name> (-a | --auto | -d | --delete |<branch>)"),
N_("git remote [-v | --verbose] show [-n] <name>"),
N_("git remote prune [-n | --dry-run] <name>"),
- N_("git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]"),
+ N_("git remote [-v | --verbose] update [-p | --prune[=<pattern>] | --no-prune] [(<group> | <remote>)...]"),
N_("git remote set-branches [--add] <name> <branch>..."),
N_("git remote set-url [--push] <name> <newurl> [<oldurl>]"),
N_("git remote set-url --add <name> <newurl>"),
@@ -1375,9 +1375,12 @@ static int update(int argc, const char **argv)
int i;
struct prune_option prune_option = PRUNE_OPTION_INIT;
struct option options[] = {
- { OPTION_CALLBACK, 'p', "prune", &prune_option, N_("pattern"),
- N_("prune remotes after fetching"),
+ { OPTION_CALLBACK, 'p', NULL, &prune_option, NULL,
+ N_("prune remote-tracking branches no longer on remote"),
PARSE_OPT_NOARG, prune_option_parse },
+ { OPTION_CALLBACK, 0, "prune", &prune_option, N_("pattern"),
+ N_("prune remote-tracking branches (matching pattern, if specified)"),
+ PARSE_OPT_OPTARG, prune_option_parse },
OPT_END()
};
struct argv_array fetch_argv = ARGV_ARRAY_INIT;
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 8f6e392..0dffe47 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -614,6 +614,19 @@ test_expect_success 'update --prune' '
)
'
+test_expect_success 'update --prune with argument' '
+ git clone one update-prune-arg &&
+ (
+ cd update-prune-arg &&
+ git update-ref refs/remotes/origin/branch1 master &&
+ git update-ref refs/remotes/origin/branch2 master &&
+
+ git remote update --prune="refs/remotes/*1" origin &&
+ test_must_fail git rev-parse origin/branch1 &&
+ git rev-parse origin/branch2
+ )
+'
+
cat >one/expect <<-\EOF
apis/master
apis/side
--
1.8.4.3
next prev parent reply other threads:[~2013-12-04 5:52 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 ` [RFC 04/11] remote: " Michael Haggerty
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 ` Michael Haggerty [this message]
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-8-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).