From: Paolo Bonzini <pbonzini@xxxxxxxxxx> If the third argument is not passed to "git request-pull", the find_matching_ref script will look for HEAD in the remote side which does not work. Instead, default to the ref names found via "git show-ref" or "git tag". Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- git-request-pull.sh | 14 ++++++++++---- t/t5150-request-pull.sh | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/git-request-pull.sh b/git-request-pull.sh index a507006..fcbe383 100755 --- a/git-request-pull.sh +++ b/git-request-pull.sh @@ -54,8 +54,6 @@ 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 tag --points-at "$local" | sed 's,^,refs/tags/,')} @@ -64,6 +62,14 @@ head=${head:-$(git rev-parse --quiet --verify "$local")} # None of the above? Bad. test -z "$head" && die "fatal: Not a valid revision: $local" +# +# If $3 was not there, the remote name should be the same +# as the locally detected name +# +remote=${remote:-$head} +pretty_remote=${remote#refs/} +pretty_remote=${pretty_remote#heads/} + # This also verifies that the resulting head is unique: # "git show-ref" could have shown multiple matching refs.. headrev=$(git rev-parse --verify --quiet "$head"^0) @@ -111,12 +117,12 @@ find_matching_ref=' } ' -ref=$(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "${remote:-HEAD}" "$headrev") +ref=$(git ls-remote "$url" | @@PERL@@ -e "$find_matching_ref" "$remote" "$headrev") if test -z "$ref" then echo "warn: No match for commit $headrev found at $url" >&2 - echo "warn: Are you sure you pushed '${remote:-HEAD}' there?" >&2 + echo "warn: Are you sure you pushed '$remote' there?" >&2 status=1 fi diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh index 8b19279..11ba8ff 100755 --- a/t/t5150-request-pull.sh +++ b/t/t5150-request-pull.sh @@ -178,7 +178,7 @@ test_expect_success 'request asks HEAD to be pulled' ' read repository && read branch } <digest && - test -z "$branch" + test "$branch" = "tags/full" ' -- 2.3.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html