{"thread":{"id":"38575","subject":"[PATCH 0/3] request-pull: do something if $3 is passed","startedAt":"2015-02-16T18:16:05Z","lastAt":"2015-02-18T07:11:00Z","messageCount":16,"participants":["Paolo Bonzini","Junio C Hamano","Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"256157","messageId":"1424110568-29479-1-git-send-email-bonzini@gnu.org","threadId":"38575","inReplyTo":null,"subject":"[PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2015-02-16T18:16:05Z","receivedAt":"2015-02-16T18:16:05Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"From: Paolo Bonzini <pbonzini@redhat.com>\n\nAfter updating to git 2.3.0, \"git request-pull\" is stubbornly complaining\nthat I lack a matching tag on the remote side unless I pass the third\nargument.  But I did prepare and push a signed tag.\n\nThis looks like a bug to me; when $3 is not passed git will try to use\n\"HEAD\" as the default but it cannot be resolved to a tag, neither locally\n(patch 2) nor remotely (patch 3).\n\nPatch 1 is a simple testcase fix.\n\nPaolo\n\nPaolo Bonzini (3):\n  request-pull: fix expected format in tests\n  request-pull: use \"git tag --points-at\" to detect local tags\n  request-pull: find matching tag or branch name on remote side\n\n git-request-pull.sh     | 15 +++++++++++----\n t/t5150-request-pull.sh |  5 ++---\n 2 files changed, 13 insertions(+), 7 deletions(-)\n\n-- \n2.3.0\n"},{"id":"256158","messageId":"1424110568-29479-2-git-send-email-bonzini@gnu.org","threadId":"38575","inReplyTo":"1424110568-29479-1-git-send-email-bonzini@gnu.org","subject":"[PATCH 1/3] request-pull: fix expected format in tests","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2015-02-16T18:16:06Z","receivedAt":"2015-02-16T18:16:06Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"From: Paolo Bonzini <pbonzini@redhat.com>\n\n\"tag foo\" in requests has been replaced with \"tags/foo\" (commit f032d66,\nrequest-pull: do not emit \"tag\" before the tagname, 2011-12-19).  Adjust\nthe parsing script to match; since the new format does not have spaces,\ndoing nothing is fine.\n\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>\n---\n t/t5150-request-pull.sh | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh\nindex 82c33b8..8b19279 100755\n--- a/t/t5150-request-pull.sh\n+++ b/t/t5150-request-pull.sh\n@@ -67,11 +67,10 @@ test_expect_success 'setup: two scripts for reading pull requests' '\n \n \tcat <<-\\EOT >read-request.sed &&\n \t#!/bin/sed -nf\n-\t# Note that a request could ask for \"tag $tagname\"\n+\t# Note that a request could ask for \"tags/$tagname\"\n \t/ in the git repository at:$/!d\n \tn\n \t/^$/ n\n-\ts/ tag \\([^ ]*\\)$/ tag--\\1/\n \ts/^[ \t]*\\(.*\\) \\([^ ]*\\)/please pull\\\n \t\\1\\\n \t\\2/p\n-- \n2.3.0\n"},{"id":"256159","messageId":"1424110568-29479-3-git-send-email-bonzini@gnu.org","threadId":"38575","inReplyTo":"1424110568-29479-1-git-send-email-bonzini@gnu.org","subject":"[PATCH 2/3] request-pull: use \"git tag --points-at\" to detect local tags","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2015-02-16T18:16:07Z","receivedAt":"2015-02-16T18:16:07Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"From: Paolo Bonzini <pbonzini@redhat.com>\n\nIf the third argument is not passed, \"git show-ref --tags HEAD\" will\nnever return anything and git-request-pull will never detect a tag\nname.\n\nInstead, \"git tag --points-at\" can find it.  Use it if \"git show-ref\"\nfails.\n\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>\n---\n git-request-pull.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/git-request-pull.sh b/git-request-pull.sh\nindex d5500fd..a507006 100755\n--- a/git-request-pull.sh\n+++ b/git-request-pull.sh\n@@ -58,6 +58,7 @@ pretty_remote=${remote#refs/}\n pretty_remote=${pretty_remote#heads/}\n head=$(git symbolic-ref -q \"$local\")\n head=${head:-$(git show-ref --heads --tags \"$local\" | cut -d' ' -f2)}\n+head=${head:-$(git tag --points-at \"$local\" | sed 's,^,refs/tags/,')}\n head=${head:-$(git rev-parse --quiet --verify \"$local\")}\n \n # None of the above? Bad.\n-- \n2.3.0\n"},{"id":"256160","messageId":"1424110568-29479-4-git-send-email-bonzini@gnu.org","threadId":"38575","inReplyTo":"1424110568-29479-1-git-send-email-bonzini@gnu.org","subject":"[PATCH 3/3] request-pull: find matching tag or branch name on remote side","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2015-02-16T18:16:08Z","receivedAt":"2015-02-16T18:16:08Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"From: Paolo Bonzini <pbonzini@redhat.com>\n\nIf the third argument is not passed to \"git request-pull\", the\nfind_matching_ref script will look for HEAD in the remote side\nwhich does not work.  Instead, default to the ref names found\nvia \"git show-ref\" or \"git tag\".\n\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>\n---\n git-request-pull.sh     | 14 ++++++++++----\n t/t5150-request-pull.sh |  2 +-\n 2 files changed, 11 insertions(+), 5 deletions(-)\n\ndiff --git a/git-request-pull.sh b/git-request-pull.sh\nindex a507006..fcbe383 100755\n--- a/git-request-pull.sh\n+++ b/git-request-pull.sh\n@@ -54,8 +54,6 @@ fi\n local=${3%:*}\n local=${local:-HEAD}\n remote=${3#*:}\n-pretty_remote=${remote#refs/}\n-pretty_remote=${pretty_remote#heads/}\n head=$(git symbolic-ref -q \"$local\")\n head=${head:-$(git show-ref --heads --tags \"$local\" | cut -d' ' -f2)}\n head=${head:-$(git tag --points-at \"$local\" | sed 's,^,refs/tags/,')}\n@@ -64,6 +62,14 @@ head=${head:-$(git rev-parse --quiet --verify \"$local\")}\n # None of the above? Bad.\n test -z \"$head\" && die \"fatal: Not a valid revision: $local\"\n \n+#\n+# If $3 was not there, the remote name should be the same\n+# as the locally detected name\n+#\n+remote=${remote:-$head}\n+pretty_remote=${remote#refs/}\n+pretty_remote=${pretty_remote#heads/}\n+\n # This also verifies that the resulting head is unique:\n # \"git show-ref\" could have shown multiple matching refs..\n headrev=$(git rev-parse --verify --quiet \"$head\"^0)\n@@ -111,12 +117,12 @@ find_matching_ref='\n \t}\n '\n \n-ref=$(git ls-remote \"$url\" | @@PERL@@ -e \"$find_matching_ref\" \"${remote:-HEAD}\" \"$headrev\")\n+ref=$(git ls-remote \"$url\" | @@PERL@@ -e \"$find_matching_ref\" \"$remote\" \"$headrev\")\n \n if test -z \"$ref\"\n then\n \techo \"warn: No match for commit $headrev found at $url\" >&2\n-\techo \"warn: Are you sure you pushed '${remote:-HEAD}' there?\" >&2\n+\techo \"warn: Are you sure you pushed '$remote' there?\" >&2\n \tstatus=1\n fi\n \ndiff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh\nindex 8b19279..11ba8ff 100755\n--- a/t/t5150-request-pull.sh\n+++ b/t/t5150-request-pull.sh\n@@ -178,7 +178,7 @@ test_expect_success 'request asks HEAD to be pulled' '\n \t\tread repository &&\n \t\tread branch\n \t} <digest &&\n-\ttest -z \"$branch\"\n+\ttest \"$branch\" = \"tags/full\"\n \n '\n \n-- \n2.3.0\n"},{"id":"256166","messageId":"xmqqiof163kk.fsf@gitster.dls.corp.google.com","threadId":"38575","inReplyTo":"1424110568-29479-1-git-send-email-bonzini@gnu.org","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-16T19:47:55Z","receivedAt":"2015-02-16T19:47:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paolo Bonzini <bonzini@gnu.org> writes:\n\n> From: Paolo Bonzini <pbonzini@redhat.com>\n>\n> After updating to git 2.3.0, \"git request-pull\" is stubbornly complaining\n> that I lack a matching tag on the remote side unless I pass the third\n> argument.  But I did prepare and push a signed tag.\n\nA few questions.\n\n - what old version did you update from?  I think the \"correct\n   over-eager dwimming\" change was from v2.0 days.\n\n - what exactly do you mean by \"stubbornly complain\"?  I think we\n   say something about HEAD not matching the HEAD over there, which\n   I think is bogus (we should instead say things about the branch\n   you are on and the branch over there with the same name) and is\n   worth fixing.\n\n> This looks like a bug to me; when $3 is not passed git will try to use\n> \"HEAD\" as the default but it cannot be resolved to a tag, neither locally\n> (patch 2) nor remotely (patch 3).\n\nAn earlier 024d34cb (request-pull: more strictly match local/remote\nbranches, 2014-01-22) deliberately disabled over-eager DWIMming when\nthe $3-rd argument _is_ given.  It didn't say much about what should\nhappen when it is missing.\n\nI am torn about your changes.\n\nOne part of me feel that not giving the $3-rd argument should behave\nthe same way as if you gave the name of the current branch as the\n$3-rd argument.  DWIMming from local HEAD to a local branch name\n(e.g. 'master') may be OK and necessary (I already said it is worth\nfixing above).  But we should not be resurrecting the over-eager\nDWIMming from that point---not from a local branch name to a tag\nthat points at it, which was what 024d34cb wanted to forbid.\n\nOn the other hand, I can also understand (not necessarily agree\nwith) a view that not giving the $3-rd argument is an explicit\nuser's wish to us to DWIM as much as we want.  But again, that\ndirectly contradicts with the desire of 024d34cb.\n\nSo,... I dunno.\n\nI'd be more comfortable if 2/3 and 3/3 were replaced with something\nlike \"do not ask HEAD to be pulled, but always require a specific\nref to be pulled\", by dereferencing HEAD locally to a branch name,\nand behave as if that name was given to $3 from the command line,\nwithout doing any other changes (like turning that branch name that\nwas implicitly given into a tag that happens to point at it).\n\nThanks.\n\n>\n> Patch 1 is a simple testcase fix.\n>\n> Paolo\n>\n> Paolo Bonzini (3):\n>   request-pull: fix expected format in tests\n>   request-pull: use \"git tag --points-at\" to detect local tags\n>   request-pull: find matching tag or branch name on remote side\n>\n>  git-request-pull.sh     | 15 +++++++++++----\n>  t/t5150-request-pull.sh |  5 ++---\n>  2 files changed, 13 insertions(+), 7 deletions(-)\n"},{"id":"256191","messageId":"54E31405.5040502@gnu.org","threadId":"38575","inReplyTo":"xmqqiof163kk.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2015-02-17T10:12:21Z","receivedAt":"2015-02-17T10:12:21Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"\n\nOn 16/02/2015 20:47, Junio C Hamano wrote:\n> Paolo Bonzini <bonzini@gnu.org> writes:\n> \n>> From: Paolo Bonzini <pbonzini@redhat.com>\n>>\n>> After updating to git 2.3.0, \"git request-pull\" is stubbornly complaining\n>> that I lack a matching tag on the remote side unless I pass the third\n>> argument.  But I did prepare and push a signed tag.\n> \n> A few questions.\n> \n>  - what old version did you update from?  I think the \"correct\n>    over-eager dwimming\" change was from v2.0 days.\n\nI upgraded from 1.9.  My workflow is to make a signed tag, push it and\ndo \"git request-pull origin/master <url>\".\n\nMy branches have a different name locally vs. remotely (e.g.\n\"kvm-master\" and \"kvm-next\" locally vs. refs/heads/master and\nrefs/heads/next remotely) exactly to avoid overeager matching in\ngit-request-pull.  I only ever want to request pulls based on signed tags.\n\n>  - what exactly do you mean by \"stubbornly complain\"?  I think we\n>    say something about HEAD not matching the HEAD over there, which\n>    I think is bogus (we should instead say things about the branch\n>    you are on and the branch over there with the same name) and is\n>    worth fixing.\n\nI tried both \"git checkout kvm-next\" and \"git checkout tags/for-linus\",\nand it still complains.\n\nWhat you refer to is, I think, fixed by patch 3.  The find_matching_ref\nscript does not work if its first argument is HEAD.  So patch 3 is\nprobably an improvement anyway for the \"matching branch name\" case, even\nif my usecase involves tags rather than branches.\n\n> An earlier 024d34cb (request-pull: more strictly match local/remote\n> branches, 2014-01-22) deliberately disabled over-eager DWIMming when\n> the $3-rd argument _is_ given.\n\nI agree with that change.\n\n> One part of me feel that not giving the $3-rd argument should behave\n> the same way as if you gave the name of the current branch as the\n> $3-rd argument.\n\nThis works well for workflows where you do pull requests based on\nbranches.  However Linus strongly encourages using signed tags.\n\nI certainly can adjust my workflow for this.  For example I can add\nsomething like this to my .gitconfig\n\n\t[request-pull]\n\t\tdwim = tags/for-linus\n\nand add an alias that uses \"git config request-pull.dwim\" as the third\nargument (other projects I work on obviously use different tag names :).\n\nWhile similar, the two patches are different:\n\n1) The usage of \"git show-ref --heads --tags\" looked like a feeble\nattempt at DWIMming tags.  But I can see how that is supposed to work\nonly if $3 is specified.  Adding a usage of \"git tag --points-at\" would\ngo against the intentions of 024d34cb.  Perhaps restrict DWIMming to\nsigned and annotated tags only, through a new option to \"git tag\"?\n\n2) Patch 3 makes sense independent of patch 2 and, as mentioned above,\nit is probably a bugfix anyway.\n\n> On the other hand, I can also understand (not necessarily agree\n> with) a view that not giving the $3-rd argument is an explicit\n> user's wish to us to DWIM as much as we want.  But again, that\n> directly contradicts with the desire of 024d34cb.\n> \n> So,... I dunno.\n\nI don't know either.  Based on your answer, it seems like you are\nfocusing mostly on a branch-based workflow; the two definitely have\ndifferent requirements for DWIMming (since you cannot get a tag name via\n\"git symbolic-ref\" for example).  On the other hand most of the\nun-DWIMming changes were done by Linus who works a lot with (other\npeople's) signed tags...\n\nPaolo\n"},{"id":"256230","messageId":"xmqqvbj01fbz.fsf@gitster.dls.corp.google.com","threadId":"38575","inReplyTo":"54E31405.5040502@gnu.org","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-17T19:57:20Z","receivedAt":"2015-02-17T19:57:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paolo Bonzini <bonzini@gnu.org> writes:\n\n> On 16/02/2015 20:47, Junio C Hamano wrote:\n>> Paolo Bonzini <bonzini@gnu.org> writes:\n>> \n>>> From: Paolo Bonzini <pbonzini@redhat.com>\n>>>\n>>> After updating to git 2.3.0, \"git request-pull\" is stubbornly complaining\n>>> that I lack a matching tag on the remote side unless I pass the third\n>>> argument.  But I did prepare and push a signed tag.\n>> \n>> A few questions.\n>> \n>>  - what old version did you update from?  I think the \"correct\n>>    over-eager dwimming\" change was from v2.0 days.\n>\n> I upgraded from 1.9.  My workflow is to make a signed tag, push it and\n> do \"git request-pull origin/master <url>\".\n>\n> My branches have a different name locally vs. remotely (e.g.\n> \"kvm-master\" and \"kvm-next\" locally vs. refs/heads/master and\n> refs/heads/next remotely) exactly to avoid overeager matching in\n> git-request-pull.  I only ever want to request pulls based on signed tags.\n\nSo I think you would want something like this:\n\n    git tag -s for-linus kvm-next\n    git push <url> kvm-next:next tags/for-linus\n    git request-pull origin/master <url> for-linus\n\nin the post 2.0 world with 024d34cb (request-pull: more strictly\nmatch local/remote branches, 2014-01-22)?\n\n>>  - what exactly do you mean by \"stubbornly complain\"?  I think we\n>>    say something about HEAD not matching the HEAD over there, which\n>>    I think is bogus (we should instead say things about the branch\n>>    you are on and the branch over there with the same name) and is\n>>    worth fixing.\n>\n> I tried both \"git checkout kvm-next\" and \"git checkout tags/for-linus\",\n> and it still complains.\n\nSorry, I was asking what you mean by \"complains\" (i.e. the exact\nerror message).  I was and am guessing it is something like this: \n\n    warn: No match for commit 3188ab3... found at <url>\n    warn: Are you sure you pushed 'HEAD' there?\n\nAsking to pull 'HEAD' may be often a wrong thing to do, and I\nwouldn't mind if this sequence:\n\n\tgit checkout kvm-next\n        git request-pull origin/master <url>\n\nbehaved the same way as\n\n        git request-pull origin/master <url> kvm-next\n\nBut I do not know if the implicit HEAD should DWIM locally to this:\n\n        git request-pull origin/master <url> for-linus\n\n> ...  Based on your answer, it seems like you are focusing mostly\n> on a branch-based workflow; ...\n\nNot really.  I am focusing mostly on not breaking what 024d34cb0 and\ndc2eacc58c fixed earlier.\n\n> ... the two definitely have\n> different requirements for DWIMming (since you cannot get a tag name via\n> \"git symbolic-ref\" for example).  On the other hand most of the\n> un-DWIMming changes were done by Linus who works a lot with (other\n> people's) signed tags...\n"},{"id":"256231","messageId":"54E3A5E2.6060806@gnu.org","threadId":"38575","inReplyTo":"xmqqvbj01fbz.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2015-02-17T20:34:42Z","receivedAt":"2015-02-17T20:34:42Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"\n\nOn 17/02/2015 20:57, Junio C Hamano wrote:\n> Sorry, I was asking what you mean by \"complains\" (i.e. the exact\n> error message).  I was and am guessing it is something like this: \n> \n>     warn: No match for commit 3188ab3... found at <url>\n>     warn: Are you sure you pushed 'HEAD' there?\n\nYes, it is.\n\n> Asking to pull 'HEAD' may be often a wrong thing to do, and I\n> wouldn't mind if this sequence:\n> \n> \tgit checkout kvm-next\n>         git request-pull origin/master <url>\n> \n> behaved the same way as\n> \n>         git request-pull origin/master <url> kvm-next\n\nFWIW, that would always be wrong for my scenario.\n\n> But I do not know if the implicit HEAD should DWIM locally to this:\n> \n>         git request-pull origin/master <url> for-linus\n\nI guess only Linus could answer that, since he wrote 024d34cb0 and he\nknows the intent better than anyone else.\n\nPaolo\n"},{"id":"256233","messageId":"CA+55aFw_pKtraqwMMsqsYgF=ikShH=6ybtb7+QPr8r=77kmoVQ@mail.gmail.com","threadId":"38575","inReplyTo":"54E3A5E2.6060806@gnu.org","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2015-02-17T20:42:40Z","receivedAt":"2015-02-17T20:42:40Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Tue, Feb 17, 2015 at 12:34 PM, Paolo Bonzini <bonzini@gnu.org> wrote:\n>\n> I guess only Linus could answer that, since he wrote 024d34cb0 and he\n> knows the intent better than anyone else.\n\nI don't even understand your problem.\n\nYou said\n\n  \"when $3 is not passed git will try to use \"HEAD\" as the default but\nit cannot be resolved to a tag, neither locally (patch 2) nor remotely\n(patch 3)\"\n\nwhich makes absolutely no sense.\n\nHEAD is not a tag. Never has been, never will be. If you want me to\npull a tag, then you damn well should say what tag you want, not just\nrandomly say HEAD.\n\nSo what is it you want to do? At no point is \"HEAD should resolve as a\ntag\" sensible.\n\n                      Linus\n"},{"id":"256234","messageId":"54E3AA41.5070209@gnu.org","threadId":"38575","inReplyTo":"CA+55aFw_pKtraqwMMsqsYgF=ikShH=6ybtb7+QPr8r=77kmoVQ@mail.gmail.com","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2015-02-17T20:53:21Z","receivedAt":"2015-02-17T20:53:21Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"\n\nOn 17/02/2015 21:42, Linus Torvalds wrote:\n>   \"when $3 is not passed git will try to use \"HEAD\" as the default but\n> it cannot be resolved to a tag, neither locally (patch 2) nor remotely\n> (patch 3)\"\n> \n> which makes absolutely no sense.\n\nIndeed, that's why I wrote patches even though I did find the patches\nthat you wrote for 2.0.\n\nWithout $3, git tries to do things that make no sense like \"git show-ref\n--heads --tags HEAD\"; or that make little sense when requesting a pull,\nlike looking for HEAD in the output of \"git ls-remote\".  But from the\nrelease notes of 2.0 it looks like it's intended and the script is just\ntaking shortcuts.\n\n> HEAD is not a tag. Never has been, never will be. If you want me to\n> pull a tag, then you damn well should say what tag you want, not just\n> randomly say HEAD.\n\nOk, in 1.9.x I used to not say anything; if the new workflow is to\nalways specify a tag, that's okay.\n\n> So what is it you want to do? At no point is \"HEAD should resolve as a\n> tag\" sensible.\n\nI wanted git to find the matching tag on the remote side when I use \"git\nrequest-pull origin/master URL\" with no third parameter, since I never\nrequest pulls except with a single signed tag.  But I'll adjust my aliases.\n\nPaolo\n"},{"id":"256235","messageId":"xmqqiof01ca9.fsf@gitster.dls.corp.google.com","threadId":"38575","inReplyTo":"CA+55aFw_pKtraqwMMsqsYgF=ikShH=6ybtb7+QPr8r=77kmoVQ@mail.gmail.com","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-17T21:03:10Z","receivedAt":"2015-02-17T21:03:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> HEAD is not a tag. Never has been, never will be. If you want me to\n> pull a tag, then you damn well should say what tag you want, not just\n> randomly say HEAD.\n>\n> So what is it you want to do? At no point is \"HEAD should resolve as a\n> tag\" sensible.\n\n\"HEAD should resolve as a tag\" is not sensible, but \"HEAD should\nlocally DWIM to something sensible\" is still possible, no?\n\nWe could for example make the rule for unset $3 case like this,\ninstead of the current \"missing $3 is a request to pull HEAD\":\n\n    If you have one and only one signed tag that happens to point at\n    the commit sitting at HEAD, behave as if that tag was given as\n    the third argument from the command line.\n\n    Otherwise, if you are on a branch, behave as if that branch was\n    given as the third argument from the command line.\n\n    If you are not on any branch, error out.\n"},{"id":"256236","messageId":"CA+55aFxdxzeHmckgn5ZSvXKr9VOztNApif+=5xmZ+4v=RhUryQ@mail.gmail.com","threadId":"38575","inReplyTo":"54E3AA41.5070209@gnu.org","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2015-02-17T21:04:11Z","receivedAt":"2015-02-17T21:04:11Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Tue, Feb 17, 2015 at 12:53 PM, Paolo Bonzini <bonzini@gnu.org> wrote:\n>\n> Without $3, git tries to do things that make no sense like \"git show-ref\n> --heads --tags HEAD\"; or that make little sense when requesting a pull,\n> like looking for HEAD in the output of \"git ls-remote\".  But from the\n> release notes of 2.0 it looks like it's intended and the script is just\n> taking shortcuts.\n\nIt is *you* who make no sense.\n\nLooking for HEAD in \"git ls-remote\"? Perfectly sensible:\n\n    [torvalds@i7 linux]$ git ls-remote origin | grep HEAD\n    cc4f9c2a91b7be7b3590bb1cbe8148873556aa3f HEAD\n\nthat's the default thing when you don't specify any particular branch or tag.\n\n> Ok, in 1.9.x I used to not say anything; if the new workflow is to\n> always specify a tag, that's okay.\n\nIndeed. You have to specify what you want me to pull. Exactly because\nin 1.9.x people didn't, and I got *really* tired of getting bogus pull\nrequests that didn't work, or pointed at the wrong branch when people\nhad multiple branches with the same contents etc.\n\n> I wanted git to find the matching tag on the remote side when I use \"git\n> request-pull origin/master URL\" with no third parameter, since I never\n> request pulls except with a single signed tag.\n\nThe thing is, HEAD works. Not for you, because you don't use HEAD. But\nbecause you don't use HEAD, you shouldn't use the default.\n\nI *would* agree to making $3 be mandatory, but there are still people\nout there who just use a single branch per repository and no signed\nbranches. Which is the only reason that \"default HEAD' thing exists.\n\n                       :Linus\n"},{"id":"256237","messageId":"CA+55aFz4Dy=-bC8ccWfmHpquAWH+Fm0abmkW_dVB9M5wpm3qkQ@mail.gmail.com","threadId":"38575","inReplyTo":"xmqqiof01ca9.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2015-02-17T21:08:13Z","receivedAt":"2015-02-17T21:08:13Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Tue, Feb 17, 2015 at 1:03 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> \"HEAD should resolve as a tag\" is not sensible, but \"HEAD should\n> locally DWIM to something sensible\" is still possible, no?\n\nI disagree. Why? Because what you have locally is *not* necessarily\nthe same thing you have remotely.\n\nAnd that's *exactly* why people used to send me broken pull requests.\n\"git pull-request\" would guess on things, and it would get the guesses\nwrong, and write the pull request wrong.\n\n> We could for example make the rule for unset $3 case like this:\n> instead of the current \"missing $3 is a request to pull HEAD\":\n>\n>     If you have one and only one signed tag that happens to point at\n>     the commit sitting at HEAD, behave as if that tag was given as\n>     the third argument from the command line.\n\nIf you verify that \"one and only\" to be true both locally and\nremotely, then I guess I would be ok with it. But it really would have\nto be unique. And truly unique, as in no confusion about branches or\ntags, only one or the other. Because the \"tag vs branch\" was one of\nthe main sources of confusion that made me repeatedly get bad pull\nrequests, particularly when there was something locally that wasn't\nactually named the same thing remotely.\n\n                         Linus\n"},{"id":"256238","messageId":"1957798859.18730760.1424207408147.JavaMail.zimbra@redhat.com","threadId":"38575","inReplyTo":"CA+55aFxdxzeHmckgn5ZSvXKr9VOztNApif+=5xmZ+4v=RhUryQ@mail.gmail.com","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Paolo Bonzini","fromEmail":"pbonzini@redhat.com","sentAt":"2015-02-17T21:10:08Z","receivedAt":"2015-02-17T21:10:08Z","isPatch":true,"sender":{"key":"pbonzini@redhat.com","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"\n> Looking for HEAD in \"git ls-remote\"? Perfectly sensible:\n> \n>     [torvalds@i7 linux]$ git ls-remote origin | grep HEAD\n>     cc4f9c2a91b7be7b3590bb1cbe8148873556aa3f HEAD\n> \n> that's the default thing when you don't specify any particular branch or tag.\n\nSure.  But if I got a pull request saying \"please pull\ngit://example.org/foo.git HEAD\" I would think that the sender\nmessed up the pull request.  So *in the context of git-request-pull*\n${remote:-HEAD} makes little sense to me.\n\nBut hey, you said it's me who makes no sense.  Maybe I really don't.\n\n> The thing is, HEAD works. Not for you, because you don't use HEAD. But\n> because you don't use HEAD, you shouldn't use the default.\n\nOki.  Will adjust my scripts.  Junio, you may still want to apply patch\n1 if only for documentation purposes (the \"tag foo\" functionality is\nunused in the rest of the test).\n\nPaolo\n"},{"id":"256239","messageId":"CA+55aFy_63YEaYa4KYEiMP+pR0-MKrf2nd1PgnJ2Ez2XJuVGhQ@mail.gmail.com","threadId":"38575","inReplyTo":"1957798859.18730760.1424207408147.JavaMail.zimbra@redhat.com","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2015-02-17T21:18:16Z","receivedAt":"2015-02-17T21:18:16Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Tue, Feb 17, 2015 at 1:10 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:\n>\n> Sure.  But if I got a pull request saying \"please pull\n> git://example.org/foo.git HEAD\" I would think that the sender\n> messed up the pull request.  So *in the context of git-request-pull*\n> ${remote:-HEAD} makes little sense to me.\n\nUmm. If somebody actually leaves off the third argument THAT IS NOT AT\nALL what it prints.\n\nIt will show\n\n    The following changes since commit <base>...\n\n        .. base commit description ..\n\n   are available in the git repository at:\n\n      git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git\n\n    for you to fetch changes up to cc4f9c2a91b7be7b3590bb1cbe8148873556aa3f:\n    ...\n\nIOW, it does exactly the right thing. It gives the contents of HEAD,\nbut it doesn't actually say HEAD anywhere.\n\nAnd just look at lkml. The above kind of branch-less and tag-less pull\nrequests are still fairly common. It's the original git model, and it\nmay be a bit archaic, and I much prefer people to send me signed tags,\nbut hey, that's what \"don't mention a branch or tag\" means.\n\nAnd no, I don't think git request-pull is at all different from other\ngit commands. \"git log\" means the same thing as \"git log HEAD\". Exact\nsame thing, and nobody would actually write out that HEAD (except\ninside scripts, perhaps).\n\nSo basically I agree that git request-pull has changed behavior, but\nthe new behavior is *more* in line with other git commands, and the\nold behavior was actually really really odd with that whole extensive\n\"guess what the user means\". No other git command ever did that\nguessing thing (ok, famous last words, maybe somebody can come up with\none), and not mentioning a branch/tag/commit explicitly pretty much\nalways means \"HEAD\".\n\n                      :Linus\n"},{"id":"256255","messageId":"xmqqvbiz4ruj.fsf@gitster.dls.corp.google.com","threadId":"38575","inReplyTo":"CA+55aFy_63YEaYa4KYEiMP+pR0-MKrf2nd1PgnJ2Ez2XJuVGhQ@mail.gmail.com","subject":"Re: [PATCH 0/3] request-pull: do something if $3 is passed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-18T07:11:00Z","receivedAt":"2015-02-18T07:11:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> So basically I agree that git request-pull has changed behavior, but\n> the new behavior is *more* in line with other git commands, and the\n> old behavior was actually really really odd with that whole extensive\n> \"guess what the user means\". No other git command ever did that\n> guessing thing (ok, famous last words, maybe somebody can come up with\n> one), and not mentioning a branch/tag/commit explicitly pretty much\n> always means \"HEAD\".\n\nOK.\n\nThere may be some stuff that DWIMs \"HEAD\" to something other than\nthe commit that is at the tip of HEAD, but I agree that the fewer we\nhave such oddballs, the better.\n\nThanks.\n"}]}