From: Junio C Hamano <gitster@pobox•com>
To: Linus Torvalds <torvalds@linux-foundation•org>
Cc: Tejun Heo <tj@kernel•org>, Git Mailing List <git@vger•kernel.org>,
Jeff King <peff@peff•net>
Subject: Re: Re* [RFC PATCH 2/1] Make request-pull able to take a refspec of form local:remote
Date: Tue, 25 Feb 2014 13:44:46 -0800 [thread overview]
Message-ID: <xmqqob1u6f5d.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CA+55aFyWM+VDa4mdqseNy3tSnp23x=2sPtHf5KpxsfROeHbVGw@mail.gmail.com> (Linus Torvalds's message of "Wed, 29 Jan 2014 16:40:37 -0800")
Linus Torvalds <torvalds@linux-foundation•org> writes:
> Thinking some more about the tag_name issue, I realize that the other
> patch ("Make request-pull able to take a refspec of form
> local:remote") broke another thing.
>
> The first patch pretty-printed the local branch-name, removing "refs/"
> and possibly "heads/" from the local refname. So for a branch, it
> would ask people to just pull from the branch-name, and for a tag it
> would ask people to pull from "tags/name", which is good policy. So if
> you had a tag called "for-linus", it would say so (using
> "tags/for-linus").
>
> But the local:remote syntax thing ends up breaking that nice feature.
> The old find_matching_refs would actually cause us to show the "tags"
> part if it existed on the remote, but that had become pointless and
> counter-productive with the first patch. But with the second patch,
> maybe we should reinstate that logic..
Sorry for back-burnering this topic so long.
I think the following does what you suggested in the message I am
responding to.
Now, hopefully the only thing we need is a documentation update and
the series should be ready to go.
-- >8 --
Subject: request-pull: resurrect "pretty refname" feature
When asking to fetch/pull a branch whose name is B or a tag whose
name is T, we used to show the command to run as:
git pull $URL B
git pull $URL tags/T
even when B and T were spelled in a more qualified way in order to
disambiguate, e.g. heads/B or refs/tags/T, but the recent update
lost this feature. Resurrect it.
Signed-off-by: Junio C Hamano <gitster@pobox•com>
---
git-request-pull.sh | 4 +++-
t/t5150-request-pull.sh | 8 +++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 93b4135..b67513a 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -53,6 +53,8 @@ fi
local=${3%:*}
local=${local:-HEAD}
remote=${3#*:}
+pretty_remote=${remote#refs/}
+pretty_remote=${pretty_remote#heads/}
head=$(git symbolic-ref -q "$local")
head=${head:-$(git show-ref --heads --tags "$local" | cut -d' ' -f2)}
head=${head:-$(git rev-parse --quiet --verify "$local")}
@@ -124,7 +126,7 @@ git show -s --format='The following changes since commit %H:
are available in the git repository at:
' $merge_base &&
-echo " $url $remote" &&
+echo " $url $pretty_remote" &&
git show -s --format='
for you to fetch changes up to %H:
diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh
index 2622057..75d6b38 100755
--- a/t/t5150-request-pull.sh
+++ b/t/t5150-request-pull.sh
@@ -216,8 +216,14 @@ test_expect_success 'pull request format' '
git request-pull initial "$downstream_url" tags/full >../request
) &&
<request sed -nf fuzz.sed >request.fuzzy &&
- test_i18ncmp expect request.fuzzy
+ test_i18ncmp expect request.fuzzy &&
+ (
+ cd local &&
+ git request-pull initial "$downstream_url" tags/full:refs/tags/full
+ ) >request &&
+ sed -nf fuzz.sed <request >request.fuzzy &&
+ test_i18ncmp expect request.fuzzy
'
test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '
next prev parent reply other threads:[~2014-02-25 21:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-23 0:06 [RFC PATCH 2/1] Make request-pull able to take a refspec of form local:remote Linus Torvalds
2014-01-23 19:43 ` Junio C Hamano
2014-01-23 19:57 ` Linus Torvalds
2014-01-23 22:58 ` Junio C Hamano
2014-01-23 23:56 ` Linus Torvalds
2014-01-24 20:16 ` Junio C Hamano
2014-01-29 23:34 ` Re* " Junio C Hamano
2014-01-30 0:16 ` brian m. carlson
2014-01-30 0:40 ` Linus Torvalds
2014-02-25 21:44 ` Junio C Hamano [this message]
2014-03-12 18:04 ` Junio C Hamano
2014-03-12 23:18 ` Eric Sunshine
2014-03-13 21:22 ` 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=xmqqob1u6f5d.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=peff@peff$(echo .)net \
--cc=tj@kernel$(echo .)org \
--cc=torvalds@linux-foundation$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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