{"thread":{"id":"39659","subject":"Git completion not using ls-remote to auto-complete during push","startedAt":"2015-06-17T16:10:35Z","lastAt":"2015-06-18T19:12:56Z","messageCount":6,"participants":["Robert Dailey","Stefan Näwe","SZEDER Gábor"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"264035","messageId":"CAHd499Dk44Fq5c_wadxT_kuCs5BdkRwKZWOHyAgE4oi7pezxPw@mail.gmail.com","threadId":"39659","inReplyTo":null,"subject":"Git completion not using ls-remote to auto-complete during push","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-06-17T16:10:35Z","receivedAt":"2015-06-17T16:10:35Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"I do the following:\n\n$ git push origin :topic\n\nIf I stop halfway through typing 'topic' and hit TAB, auto-completion\ndoes not work if I do not have a local branch by that name (sometimes\nI delete my local branch first, then I push to delete it remotely). I\nthought that git completion code was supposed to use ls-remote to auto\ncomplete refs used in push operations. Is this supposed to work?\n\nI'm using Git 2.4.3. Tested on both MSYS2 in Windows and Linux Mint.\nSame behavior in both. I am using the latest git completion code from\nthe master branch in the git repo.\n"},{"id":"264109","messageId":"55826D2E.2060308@atlas-elektronik.com","threadId":"39659","inReplyTo":"CAHd499Dk44Fq5c_wadxT_kuCs5BdkRwKZWOHyAgE4oi7pezxPw@mail.gmail.com","subject":"Re: Git completion not using ls-remote to auto-complete during push","fromName":"Stefan Näwe","fromEmail":"stefan.naewe@atlas-elektronik.com","sentAt":"2015-06-18T07:03:10Z","receivedAt":"2015-06-18T07:03:10Z","isPatch":false,"sender":{"key":"stefan.naewe@gmail.com","avatar":"https://avatars.githubusercontent.com/u/4468?v=4"},"body":"Am 17.06.2015 um 18:10 schrieb Robert Dailey:\n> I do the following:\n> \n> $ git push origin :topic\n> \n> If I stop halfway through typing 'topic' and hit TAB, auto-completion\n> does not work if I do not have a local branch by that name (sometimes\n> I delete my local branch first, then I push to delete it remotely). I\n> thought that git completion code was supposed to use ls-remote to auto\n> complete refs used in push operations. Is this supposed to work?\n> \n> I'm using Git 2.4.3. Tested on both MSYS2 in Windows and Linux Mint.\n> Same behavior in both. I am using the latest git completion code from\n> the master branch in the git repo.\n\nSame here!\n\nBut it works in my self-compiled version of msysgit (yes, the old\n'Git for Windows' development environment) which is rebased onto v2.2.2.\nTime for 'git bisect' I guess...\n\nStefan\n-- \n----------------------------------------------------------------\n/dev/random says: A cat sleeps fat, yet walks thin.\npython -c \"print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')\" \nGPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF\n"},{"id":"264170","messageId":"1434626973-4801-1-git-send-email-szeder@ira.uka.de","threadId":"39659","inReplyTo":"CAHd499Dk44Fq5c_wadxT_kuCs5BdkRwKZWOHyAgE4oi7pezxPw@mail.gmail.com","subject":"Re: Git completion not using ls-remote to auto-complete during push","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2015-06-18T11:29:33Z","receivedAt":"2015-06-18T11:29:33Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Quoting Robert Dailey <rcdailey.lists@gmail.com>\n> I do the following:\n> \n> $ git push origin :topic\n> \n> If I stop halfway through typing 'topic' and hit TAB, auto-completion\n> does not work if I do not have a local branch by that name (sometimes\n> I delete my local branch first, then I push to delete it remotely). I\n> thought that git completion code was supposed to use ls-remote to auto\n> complete refs used in push operations. Is this supposed to work?\n\nIt's intentional.  Running 'git ls-remote' with a far away remote can\ntake ages, so instead we grab the refs on the remote from the locally\nstored refs under 'refs/remotes/<remote>/'.\n\nSee e832f5c096 (completion: avoid ls-remote in certain scenarios,\n2013-05-28).  The commit message mentions that you can \"force\"\ncompletion of remote refs via 'git ls-remote' by starting with the full\nrefname, i.e.  'refs/<TAB>', however, that seems to work only on the\nleft hand side of the colon in the push refspec.\n\nGábor\n"},{"id":"264187","messageId":"CAHd499DeUOqsuSoysaOAAYORk3B=XBXco9yEKdXt8m4XJYFyZw@mail.gmail.com","threadId":"39659","inReplyTo":"1434626973-4801-1-git-send-email-szeder@ira.uka.de","subject":"Re: Git completion not using ls-remote to auto-complete during push","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-06-18T15:27:16Z","receivedAt":"2015-06-18T15:27:16Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"On Thu, Jun 18, 2015 at 6:29 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:\n> Quoting Robert Dailey <rcdailey.lists@gmail.com>\n>> I do the following:\n>>\n>> $ git push origin :topic\n>>\n>> If I stop halfway through typing 'topic' and hit TAB, auto-completion\n>> does not work if I do not have a local branch by that name (sometimes\n>> I delete my local branch first, then I push to delete it remotely). I\n>> thought that git completion code was supposed to use ls-remote to auto\n>> complete refs used in push operations. Is this supposed to work?\n>\n> It's intentional.  Running 'git ls-remote' with a far away remote can\n> take ages, so instead we grab the refs on the remote from the locally\n> stored refs under 'refs/remotes/<remote>/'.\n>\n> See e832f5c096 (completion: avoid ls-remote in certain scenarios,\n> 2013-05-28).  The commit message mentions that you can \"force\"\n> completion of remote refs via 'git ls-remote' by starting with the full\n> refname, i.e.  'refs/<TAB>', however, that seems to work only on the\n> left hand side of the colon in the push refspec.\n>\n> Gábor\n>\n\nIf that's indeed the case, then completion should work. I have a\n'refs/remotes/origin/topic'. Why will auto complete not work even\nthough this exists? Do multiple remotes cause issues (in theory there\nis no reason why it should cause problems, since it should know I'm\nauto-completing a ref on 'origin')?\n"},{"id":"264191","messageId":"20150618175536.Horde.csrWs9ln__S_ZM2wEkboXw1@webmail.informatik.kit.edu","threadId":"39659","inReplyTo":"CAHd499DeUOqsuSoysaOAAYORk3B=XBXco9yEKdXt8m4XJYFyZw@mail.gmail.com","subject":"Re: Git completion not using ls-remote to auto-complete during push","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2015-06-18T15:55:36Z","receivedAt":"2015-06-18T15:55:36Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"\nQuoting Robert Dailey <rcdailey.lists@gmail.com>:\n\n> On Thu, Jun 18, 2015 at 6:29 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:\n>> Quoting Robert Dailey <rcdailey.lists@gmail.com>\n>>> I do the following:\n>>>\n>>> $ git push origin :topic\n>>>\n>>> If I stop halfway through typing 'topic' and hit TAB, auto-completion\n>>> does not work if I do not have a local branch by that name (sometimes\n>>> I delete my local branch first, then I push to delete it remotely). I\n>>> thought that git completion code was supposed to use ls-remote to auto\n>>> complete refs used in push operations. Is this supposed to work?\n>>\n>> It's intentional.  Running 'git ls-remote' with a far away remote can\n>> take ages, so instead we grab the refs on the remote from the locally\n>> stored refs under 'refs/remotes/<remote>/'.\n>>\n>> See e832f5c096 (completion: avoid ls-remote in certain scenarios,\n>> 2013-05-28).  The commit message mentions that you can \"force\"\n>> completion of remote refs via 'git ls-remote' by starting with the full\n>> refname, i.e.  'refs/<TAB>', however, that seems to work only on the\n>> left hand side of the colon in the push refspec.\n>>\n>> Gábor\n>>\n>\n> If that's indeed the case, then completion should work. I have a\n> 'refs/remotes/origin/topic'. Why will auto complete not work even\n> though this exists? Do multiple remotes cause issues (in theory there\n> is no reason why it should cause problems, since it should know I'm\n> auto-completing a ref on 'origin')?\n\nThe number of remotes doesn't matter.\nWhat matters is which side of the colon the ref to be completed is.\n\nYou can complete\n\n   git push origin refs/<TAB>\n\nand\n\n   git fetch origin refs/<TAB>\n\nwill even list you refs freshly queried via 'git ls-remote'.\nHowever,\n\n   git push origin :refs/<TAB>\n   git push origin branch:refs/<TAB>\n\ndon't work, because there are no refs starting with the prefix  \n':refs/' or 'branch:refs/'.\n\nGábor\n"},{"id":"264208","messageId":"CAHd499A5rUvHQBQx3GgoTGnhzOhXEwS4SFGOE=ujGo43nyTe1A@mail.gmail.com","threadId":"39659","inReplyTo":"20150618175536.Horde.csrWs9ln__S_ZM2wEkboXw1@webmail.informatik.kit.edu","subject":"Re: Git completion not using ls-remote to auto-complete during push","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-06-18T19:12:56Z","receivedAt":"2015-06-18T19:12:56Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"On Thu, Jun 18, 2015 at 10:55 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:\n>\n> Quoting Robert Dailey <rcdailey.lists@gmail.com>:\n>\n>> On Thu, Jun 18, 2015 at 6:29 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:\n>>>\n>>> Quoting Robert Dailey <rcdailey.lists@gmail.com>\n>>>>\n>>>> I do the following:\n>>>>\n>>>> $ git push origin :topic\n>>>>\n>>>> If I stop halfway through typing 'topic' and hit TAB, auto-completion\n>>>> does not work if I do not have a local branch by that name (sometimes\n>>>> I delete my local branch first, then I push to delete it remotely). I\n>>>> thought that git completion code was supposed to use ls-remote to auto\n>>>> complete refs used in push operations. Is this supposed to work?\n>>>\n>>>\n>>> It's intentional.  Running 'git ls-remote' with a far away remote can\n>>> take ages, so instead we grab the refs on the remote from the locally\n>>> stored refs under 'refs/remotes/<remote>/'.\n>>>\n>>> See e832f5c096 (completion: avoid ls-remote in certain scenarios,\n>>> 2013-05-28).  The commit message mentions that you can \"force\"\n>>> completion of remote refs via 'git ls-remote' by starting with the full\n>>> refname, i.e.  'refs/<TAB>', however, that seems to work only on the\n>>> left hand side of the colon in the push refspec.\n>>>\n>>> Gábor\n>>>\n>>\n>> If that's indeed the case, then completion should work. I have a\n>> 'refs/remotes/origin/topic'. Why will auto complete not work even\n>> though this exists? Do multiple remotes cause issues (in theory there\n>> is no reason why it should cause problems, since it should know I'm\n>> auto-completing a ref on 'origin')?\n>\n>\n> The number of remotes doesn't matter.\n> What matters is which side of the colon the ref to be completed is.\n>\n> You can complete\n>\n>   git push origin refs/<TAB>\n>\n> and\n>\n>   git fetch origin refs/<TAB>\n>\n> will even list you refs freshly queried via 'git ls-remote'.\n> However,\n>\n>   git push origin :refs/<TAB>\n>   git push origin branch:refs/<TAB>\n>\n> don't work, because there are no refs starting with the prefix ':refs/' or\n> 'branch:refs/'.\n>\n> Gábor\n>\n\nInteresting. So is it just a glaring bug that the git completion\nscript isn't ignoring the : and anything to the left of it? Or is this\nbeyond the control of the script?\n"}]}