From: Junio C Hamano <gitster@pobox.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: Karthik Nayak <Karthik.188@gmail.com>,
Git mailing list <git@vger.kernel.org>
Subject: Re: What's cooking in git.git (Feb 2017, #02; Mon, 6)
Date: Tue, 07 Feb 2017 12:01:33 -0800 [thread overview]
Message-ID: <xmqqlgthzs6a.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAM0VKjmhO9NQLz9TDv5M3OhxSBt-JdjaouVT0pTA-a6mGaF4_A@mail.gmail.com> ("SZEDER =?utf-8?Q?G=C3=A1bor=22's?= message of "Tue, 7 Feb 2017 01:24:09 +0100")
SZEDER Gábor <szeder.dev@gmail.com> writes:
> All failing tests fail with the same error:
>
> fatal: unrecognized %(refname:strip=2) argument: strip=2
>
> That's because of this topic:
>
>> * kn/ref-filter-branch-list (2017-01-31) 20 commits
Ahh, of course.
Let's make sure the series won't escape to 'master' before the
"strip" breakage is fixed. How about queuing this on top of the
ref-filter topic?
It seems to unblock your completion-refs-speedup topic and makes the
test pass ;-)
Thanks.
-- >8 --
Subject: [PATCH] ref-filter: resurrect "strip" as a synonym to "lstrip"
We forgot that "strip" was introduced at 0571979bd6 ("tag: do not
show ambiguous tag names as "tags/foo"", 2016-01-25) as part of Git
2.8 (and 2.7.1), yet in the update to ref-filter, we started calling
it "lstrip" to make it easier to explain the new "rstrip" operation.
We shouldn't have renamed the existing one; "lstrip" should have
been a new synonym that means the same thing as "strip". Scripts
in the wild are surely using the original form already.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Documentation/git-for-each-ref.txt | 2 ++
ref-filter.c | 3 ++-
t/t6300-for-each-ref.sh | 12 ++++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
index 2008600e7e..111e1be6f5 100644
--- a/Documentation/git-for-each-ref.txt
+++ b/Documentation/git-for-each-ref.txt
@@ -107,6 +107,8 @@ refname::
enough components, the result becomes an empty string if
stripping with positive <N>, or it becomes the full refname if
stripping with negative <N>. Neither is an error.
++
+`strip` can be used as a synomym to `lstrip`.
objecttype::
The type of the object (`blob`, `tree`, `commit`, `tag`).
diff --git a/ref-filter.c b/ref-filter.c
index 01b5c18ef0..2a94d6da98 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -112,7 +112,8 @@ static void refname_atom_parser_internal(struct refname_atom *atom,
atom->option = R_NORMAL;
else if (!strcmp(arg, "short"))
atom->option = R_SHORT;
- else if (skip_prefix(arg, "lstrip=", &arg)) {
+ else if (skip_prefix(arg, "lstrip=", &arg) ||
+ skip_prefix(arg, "strip=", &arg)) {
atom->option = R_LSTRIP;
if (strtol_i(arg, 10, &atom->lstrip))
die(_("Integer value expected refname:lstrip=%s"), arg);
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 25a9973ce9..c87dc1f8bc 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -59,18 +59,26 @@ test_atom head refname:rstrip=1 refs/heads
test_atom head refname:rstrip=2 refs
test_atom head refname:rstrip=-1 refs
test_atom head refname:rstrip=-2 refs/heads
+test_atom head refname:strip=1 heads/master
+test_atom head refname:strip=2 master
+test_atom head refname:strip=-1 master
+test_atom head refname:strip=-2 heads/master
test_atom head upstream refs/remotes/origin/master
test_atom head upstream:short origin/master
test_atom head upstream:lstrip=2 origin/master
test_atom head upstream:lstrip=-2 origin/master
test_atom head upstream:rstrip=2 refs/remotes
test_atom head upstream:rstrip=-2 refs/remotes
+test_atom head upstream:strip=2 origin/master
+test_atom head upstream:strip=-2 origin/master
test_atom head push refs/remotes/myfork/master
test_atom head push:short myfork/master
test_atom head push:lstrip=1 remotes/myfork/master
test_atom head push:lstrip=-1 master
test_atom head push:rstrip=1 refs/remotes/myfork
test_atom head push:rstrip=-1 refs
+test_atom head push:strip=1 remotes/myfork/master
+test_atom head push:strip=-1 master
test_atom head objecttype commit
test_atom head objectsize 171
test_atom head objectname $(git rev-parse refs/heads/master)
@@ -636,6 +644,10 @@ EOF
test_expect_success 'Verify usage of %(symref:lstrip) atom' '
git for-each-ref --format="%(symref:lstrip=2)" refs/heads/sym > actual &&
git for-each-ref --format="%(symref:lstrip=-2)" refs/heads/sym >> actual &&
+ test_cmp expected actual &&
+
+ git for-each-ref --format="%(symref:strip=2)" refs/heads/sym > actual &&
+ git for-each-ref --format="%(symref:strip=-2)" refs/heads/sym >> actual &&
test_cmp expected actual
'
--
2.12.0-rc0-144-g99fe1a5456
next prev parent reply other threads:[~2017-02-07 20:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 22:34 What's cooking in git.git (Feb 2017, #02; Mon, 6) Junio C Hamano
2017-02-07 0:24 ` SZEDER Gábor
2017-02-07 1:17 ` Jacob Keller
2017-02-07 20:01 ` Junio C Hamano [this message]
2017-02-09 0:25 ` Stefan Beller
2017-02-09 1:01 ` Junio C Hamano
2017-02-09 3:46 ` Jeff King
2017-02-09 5:09 ` Junio C Hamano
2017-02-10 21:17 ` Junio C Hamano
2017-02-09 12:29 ` Johannes Schindelin
2017-02-09 17:20 ` Junio C Hamano
2017-02-09 20:37 ` Johannes Schindelin
2017-02-09 22:02 ` Junio C Hamano
2017-02-09 22:32 ` Johannes Schindelin
2017-02-09 16:08 ` Michael Haggerty
2017-02-09 19:18 ` Junio C Hamano
2017-02-09 19:24 ` 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=xmqqlgthzs6a.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Karthik.188@gmail.com \
--cc=git@vger.kernel.org \
--cc=szeder.dev@gmail.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).