From: Harald Nordgren <haraldnordgren@gmail.com>
To: git@vger.kernel.org
Cc: Harald Nordgren <haraldnordgren@gmail.com>
Subject: [PATCH 2/2] ls-remote: create option to sort by versions
Date: Mon, 2 Apr 2018 05:23:00 +0200 [thread overview]
Message-ID: <20180402032300.85020-1-haraldnordgren@gmail.com> (raw)
In-Reply-To: <[PATCH] ls-remote: create option to sort by versions>
Updating tests and documentation
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
---
Documentation/git-ls-remote.txt | 5 +++++
t/t5512-ls-remote.sh | 19 ++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index 5f2628c8f..81c518a90 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -30,6 +30,11 @@ OPTIONS
both, references stored in refs/heads and refs/tags are
displayed.
+-V::
+--version-sort::
+ Sort ref names by version semantics, so that refs/tags/v1.2 is sorted
+ before refs/tags/v1.10.
+
--refs::
Do not show peeled tags or pseudorefs like HEAD in the output.
diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
index 02106c922..680a31223 100755
--- a/t/t5512-ls-remote.sh
+++ b/t/t5512-ls-remote.sh
@@ -10,6 +10,9 @@ test_expect_success setup '
test_tick &&
git commit -m initial &&
git tag mark &&
+ git tag mark1.1 &&
+ git tag mark1.2 &&
+ git tag mark1.10 &&
git show-ref --tags -d | sed -e "s/ / /" >expected.tag &&
(
echo "$(git rev-parse HEAD) HEAD"
@@ -39,6 +42,17 @@ test_expect_success 'ls-remote self' '
test_cmp expected.all actual
'
+test_expect_success 'ls-remote --version-sort --tags self' '
+ cat >expect <<-\EOF &&
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark1.1
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark1.2
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark1.10
+ EOF
+ git ls-remote --version-sort --tags self >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'dies when no remote specified and no default remotes found' '
test_must_fail git ls-remote
'
@@ -131,7 +145,7 @@ test_expect_success 'Report no-match with --exit-code' '
test_expect_success 'Report match with --exit-code' '
git ls-remote --exit-code other.git "refs/tags/*" >actual &&
- git ls-remote . tags/mark >expect &&
+ git ls-remote . tags/mark* >expect &&
test_cmp expect actual
'
@@ -178,6 +192,9 @@ test_expect_success 'ls-remote --symref' '
1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/remotes/origin/HEAD
1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/remotes/origin/master
1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark1.1
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark1.10
+ 1bd44cb9d13204b0fe1958db0082f5028a16eb3a refs/tags/mark1.2
EOF
git ls-remote --symref >actual &&
test_cmp expect actual
--
2.14.3 (Apple Git-98)
next parent reply other threads:[~2018-04-02 3:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <[PATCH] ls-remote: create option to sort by versions>
2018-04-02 3:23 ` Harald Nordgren [this message]
2018-04-02 20:07 ` [PATCH] ls-remote: create '--sort' option Harald Nordgren
2018-04-02 20:12 ` Junio C Hamano
2018-04-02 21:14 ` Harald Nordgren
2018-04-02 21:19 ` Jeff King
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=20180402032300.85020-1-haraldnordgren@gmail.com \
--to=haraldnordgren@gmail.com \
--cc=git@vger.kernel.org \
/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).