From: Thomas Gummerer <t.gummerer@gmail.com>
To: git@vger.kernel.org
Cc: peff@peff.net, bturner@atlassian.com, gitster@pobox.com,
pedrorijo91@gmail.com, Thomas Gummerer <t.gummerer@gmail.com>
Subject: [PATCH v3 0/5] ls-remote: introduce symref argument
Date: Tue, 19 Jan 2016 00:20:45 +0100 [thread overview]
Message-ID: <1453159250-21298-1-git-send-email-t.gummerer@gmail.com> (raw)
In-Reply-To: <1453136238-19448-1-git-send-email-t.gummerer@gmail.com>
The previous rounds are at $gmane/284248. Thanks to Peff and Junio
for reviewing and suggestions on the previous round.
Changes from the previous round:
- Slightly reworded the documentation for the --refs option
- Small fix in the commit message of patch 4.
- use <<-\EOF instead of <<-EOF in the tests
- added a note about upload-pack only showing the HEAD symref
- squashed in tests by peff
- changed --symrefs option to --symref
- reworded description and documentation of the option according to
comments from junio.
Interdiff below:
diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index 9356df2..5f2628c 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -11,7 +11,7 @@ SYNOPSIS
[verse]
'git ls-remote' [--heads] [--tags] [--refs] [--upload-pack=<exec>]
[-q | --quiet] [--exit-code] [--get-url]
- [--symrefs] [<repository> [<refs>...]]
+ [--symref] [<repository> [<refs>...]]
DESCRIPTION
-----------
@@ -31,8 +31,7 @@ OPTIONS
displayed.
--refs::
- Do not show peeled tags or pseudo-refs like HEAD or MERGE_HEAD
- in the output.
+ Do not show peeled tags or pseudorefs like HEAD in the output.
-q::
--quiet::
@@ -55,8 +54,11 @@ OPTIONS
"url.<base>.insteadOf" config setting (See linkgit:git-config[1]) and
exit without talking to the remote.
---symrefs::
- Show the symrefs in addition to the other refs.
+--symref::
+ In addition to the object pointed by it, show the underlying
+ ref pointed by it when showing a symbolic ref. Currently,
+ upload-pack only shows the symref HEAD, so it will be the only
+ one shown by ls-remote.
<repository>::
The "remote" repository to query. This parameter can be
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index ea73d53..66cdd45 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -6,7 +6,7 @@
static const char * const ls_remote_usage[] = {
N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
" [-q | --quiet] [--exit-code] [--get-url]\n"
- " [--symrefs] [<repository> [<refs>...]]"),
+ " [--symref] [<repository> [<refs>...]]"),
NULL
};
@@ -38,7 +38,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
int get_url = 0;
int quiet = 0;
int status = 0;
- int symrefs = 0;
+ int show_symref_target = 0;
const char *uploadpack = NULL;
const char **pattern = NULL;
@@ -60,7 +60,8 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
N_("take url.<base>.insteadOf into account")),
OPT_SET_INT(0, "exit-code", &status,
N_("exit with exit code 2 if no matching refs are found"), 2),
- OPT_BOOL(0, "symrefs", &symrefs, N_("show symrefs")),
+ OPT_BOOL(0, "symref", &show_symref_target,
+ N_("show underlying ref in addition to the object pointed by it")),
OPT_END()
};
@@ -104,7 +105,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
continue;
if (!tail_match(pattern, ref->name))
continue;
- if (symrefs && ref->symref)
+ if (show_symref_target && ref->symref)
printf("ref: %s\t%s\n", ref->symref, ref->name);
printf("%s\t%s\n", oid_to_hex(&ref->old_oid), ref->name);
status = 0; /* we found something */
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 3edbc9e..819b9dd 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -163,8 +163,8 @@ test_expect_success 'overrides work between mixed transfer/upload-pack hideRefs'
grep refs/tags/magic actual
'
-test_expect_success 'ls-remote --symrefs' '
- cat >expect <<-EOF &&
+test_expect_success 'ls-remote --symref' '
+ cat >expect <<-\EOF &&
ref: refs/heads/master HEAD
1bd44cb9d13204b0fe1958db0082f5028a16eb3a HEAD
1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/master
@@ -172,17 +172,40 @@ test_expect_success 'ls-remote --symrefs' '
1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/remotes/origin/master
1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark
EOF
- git ls-remote --symrefs >actual &&
+ git ls-remote --symref >actual &&
test_cmp expect actual
'
-test_expect_success 'ls-remote with filtered symrefs' '
- cat >expect <<-EOF &&
+test_expect_success 'ls-remote with filtered symref (refname)' '
+ cat >expect <<-\EOF &&
ref: refs/heads/master HEAD
1bd44cb9d13204b0fe1958db0082f5028a16eb3a HEAD
EOF
- git ls-remote --symrefs . HEAD >actual &&
+ git ls-remote --symref . HEAD >actual &&
test_cmp expect actual
'
+test_expect_failure 'ls-remote with filtered symref (--heads)' '
+ git symbolic-ref refs/heads/foo refs/tags/mark &&
+ cat >expect <<-\EOF &&
+ ref: refs/tags/mark refs/heads/foo
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/foo
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/master
+ EOF
+ git ls-remote --symref --heads . >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'ls-remote --symref omits filtered-out matches' '
+ cat >expect <<-\EOF &&
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/foo
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/heads/master
+ EOF
+ git ls-remote --symref --heads . >actual &&
+ test_cmp expect actual &&
+ git ls-remote --symref . "refs/heads/*" >actual &&
+ test_cmp expect actual
+'
+
+
test_done
Thomas Gummerer (5):
ls-remote: document --quiet option
ls-remote: document --refs option
ls-remote: fix synopsis
ls-remote: use parse-options api
ls-remote: add support for showing symrefs
Documentation/git-ls-remote.txt | 16 +++++++-
builtin/ls-remote.c | 90 +++++++++++++++++------------------------
t/t5512-ls-remote.sh | 45 +++++++++++++++++++++
3 files changed, 95 insertions(+), 56 deletions(-)
--
2.7.0.30.g56a8654.dirty
next prev parent reply other threads:[~2016-01-18 23:21 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-17 11:03 [PATCH 0/4] ls-remote: introduce symref argument Thomas Gummerer
2016-01-17 11:03 ` [PATCH 1/4] ls-remote: document --quiet option Thomas Gummerer
2016-01-17 14:47 ` Jeff King
2016-01-17 17:13 ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 2/4] ls-remote: fix synopsis Thomas Gummerer
2016-01-17 11:04 ` [PATCH 3/4] ls-remote: use parse-options api Thomas Gummerer
2016-01-17 14:44 ` Jeff King
2016-01-17 17:27 ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 4/4] builtin/ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-17 11:16 ` Thomas Gummerer
2016-01-17 11:04 ` [PATCH 4/4] ls-remote: " Thomas Gummerer
2016-01-17 15:15 ` Jeff King
2016-01-17 17:38 ` Thomas Gummerer
2016-01-17 22:14 ` Junio C Hamano
2016-01-17 11:14 ` [PATCH 0/4] ls-remote: introduce symref argument Thomas Gummerer
2016-01-17 15:16 ` Jeff King
2016-01-17 17:39 ` Thomas Gummerer
2016-01-17 22:15 ` Junio C Hamano
2016-01-18 16:57 ` [PATCH v2 0/5] ls-remote: introduce symrefs argument Thomas Gummerer
2016-01-18 16:57 ` [PATCH v2 1/5] ls-remote: document --quiet option Thomas Gummerer
2016-01-18 16:57 ` [PATCH v2 2/5] ls-remote: document --refs option Thomas Gummerer
2016-01-18 19:31 ` Jeff King
2016-01-18 20:01 ` Junio C Hamano
2016-01-18 21:39 ` Thomas Gummerer
2016-01-18 16:57 ` [PATCH v2 3/5] ls-remote: fix synopsis Thomas Gummerer
2016-01-18 16:57 ` [PATCH v2 4/5] ls-remote: use parse-options api Thomas Gummerer
2016-01-18 19:33 ` Jeff King
2016-01-18 16:57 ` [PATCH v2 5/5] ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-18 19:52 ` Jeff King
2016-01-18 19:53 ` Jeff King
2016-01-18 22:09 ` Thomas Gummerer
2016-01-18 22:09 ` Thomas Gummerer
2016-01-18 22:20 ` Jeff King
2016-01-18 22:35 ` Thomas Gummerer
2016-01-18 20:09 ` Junio C Hamano
2016-01-18 21:48 ` Thomas Gummerer
2016-01-18 19:53 ` [PATCH v2 0/5] ls-remote: introduce symrefs argument Jeff King
2016-01-18 23:20 ` Thomas Gummerer [this message]
2016-01-18 23:20 ` [PATCH v3 1/5] ls-remote: document --quiet option Thomas Gummerer
2016-01-18 23:20 ` [PATCH v3 2/5] ls-remote: document --refs option Thomas Gummerer
2016-01-18 23:20 ` [PATCH v3 3/5] ls-remote: fix synopsis Thomas Gummerer
2016-01-18 23:20 ` [PATCH v3 4/5] ls-remote: use parse-options api Thomas Gummerer
2016-01-18 23:20 ` [PATCH v3 5/5] ls-remote: add support for showing symrefs Thomas Gummerer
2016-01-19 18:14 ` [PATCH v3 0/5] ls-remote: introduce symref argument 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=1453159250-21298-1-git-send-email-t.gummerer@gmail.com \
--to=t.gummerer@gmail.com \
--cc=bturner@atlassian.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pedrorijo91@gmail.com \
--cc=peff@peff.net \
/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).