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>
Junio C Hamano committed
Feb 25, 2014 at 13:44 UTC
5aae66bd998429959d89c5bedf0bd8175a2b3f33
2 files changed
+10
-2
git-request-pull.sh
+3
-1
@@ -53,6 +53,8 @@ fi
53
local=${3%:*}
54
local=${local:-HEAD}
55
remote=${3#*:}
56
+pretty_remote=${remote#refs/}
57
+pretty_remote=${pretty_remote#heads/}
58
head=$(git symbolic-ref -q "$local")
59
head=${head:-$(git show-ref --heads --tags "$local" | cut -d' ' -f2)}
60
head=${head:-$(git rev-parse --quiet --verify "$local")}
@@ -124,7 +126,7 @@ git show -s --format='The following changes since commit %H:
126
127
are available in the git repository at:
128
' $merge_base &&
127
-echo " $url $remote" &&
129
+echo " $url $pretty_remote" &&
130
git show -s --format='
131
for you to fetch changes up to %H:
132
t/t5150-request-pull.sh
+7
-1
@@ -216,8 +216,14 @@ test_expect_success 'pull request format' '
216
git request-pull initial "$downstream_url" tags/full >../request
217
) &&
218
<request sed -nf fuzz.sed >request.fuzzy &&
219
- test_i18ncmp expect request.fuzzy
219
+ test_i18ncmp expect request.fuzzy &&
220
221
+ (
222
+ cd local &&
223
+ git request-pull initial "$downstream_url" tags/full:refs/tags/full
224
+ ) >request &&
225
+ sed -nf fuzz.sed <request >request.fuzzy &&
226
+ test_i18ncmp expect request.fuzzy
227
'
228
229
test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '