All of lore.kernel.org
 help / color / mirror / Atom feed
* Git completion not using ls-remote to auto-complete during push
@ 2015-06-17 16:10 Robert Dailey
  2015-06-18  7:03 ` Stefan Näwe
  2015-06-18 11:29 ` SZEDER Gábor
  0 siblings, 2 replies; 6+ messages in thread
From: Robert Dailey @ 2015-06-17 16:10 UTC (permalink / raw)
  To: Git

I do the following:

$ git push origin :topic

If I stop halfway through typing 'topic' and hit TAB, auto-completion
does not work if I do not have a local branch by that name (sometimes
I delete my local branch first, then I push to delete it remotely). I
thought that git completion code was supposed to use ls-remote to auto
complete refs used in push operations. Is this supposed to work?

I'm using Git 2.4.3. Tested on both MSYS2 in Windows and Linux Mint.
Same behavior in both. I am using the latest git completion code from
the master branch in the git repo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git completion not using ls-remote to auto-complete during push
  2015-06-17 16:10 Git completion not using ls-remote to auto-complete during push Robert Dailey
@ 2015-06-18  7:03 ` Stefan Näwe
  2015-06-18 11:29 ` SZEDER Gábor
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Näwe @ 2015-06-18  7:03 UTC (permalink / raw)
  To: Robert Dailey, Git

Am 17.06.2015 um 18:10 schrieb Robert Dailey:
> I do the following:
> 
> $ git push origin :topic
> 
> If I stop halfway through typing 'topic' and hit TAB, auto-completion
> does not work if I do not have a local branch by that name (sometimes
> I delete my local branch first, then I push to delete it remotely). I
> thought that git completion code was supposed to use ls-remote to auto
> complete refs used in push operations. Is this supposed to work?
> 
> I'm using Git 2.4.3. Tested on both MSYS2 in Windows and Linux Mint.
> Same behavior in both. I am using the latest git completion code from
> the master branch in the git repo.

Same here!

But it works in my self-compiled version of msysgit (yes, the old
'Git for Windows' development environment) which is rebased onto v2.2.2.
Time for 'git bisect' I guess...

Stefan
-- 
----------------------------------------------------------------
/dev/random says: A cat sleeps fat, yet walks thin.
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git completion not using ls-remote to auto-complete during push
  2015-06-17 16:10 Git completion not using ls-remote to auto-complete during push Robert Dailey
  2015-06-18  7:03 ` Stefan Näwe
@ 2015-06-18 11:29 ` SZEDER Gábor
  2015-06-18 15:27   ` Robert Dailey
  1 sibling, 1 reply; 6+ messages in thread
From: SZEDER Gábor @ 2015-06-18 11:29 UTC (permalink / raw)
  To: Robert Dailey; +Cc: Stefan Näwe, Git

Quoting Robert Dailey <rcdailey.lists@gmail.com>
> I do the following:
> 
> $ git push origin :topic
> 
> If I stop halfway through typing 'topic' and hit TAB, auto-completion
> does not work if I do not have a local branch by that name (sometimes
> I delete my local branch first, then I push to delete it remotely). I
> thought that git completion code was supposed to use ls-remote to auto
> complete refs used in push operations. Is this supposed to work?

It's intentional.  Running 'git ls-remote' with a far away remote can
take ages, so instead we grab the refs on the remote from the locally
stored refs under 'refs/remotes/<remote>/'.

See e832f5c096 (completion: avoid ls-remote in certain scenarios,
2013-05-28).  The commit message mentions that you can "force"
completion of remote refs via 'git ls-remote' by starting with the full
refname, i.e.  'refs/<TAB>', however, that seems to work only on the
left hand side of the colon in the push refspec.

Gábor

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git completion not using ls-remote to auto-complete during push
  2015-06-18 11:29 ` SZEDER Gábor
@ 2015-06-18 15:27   ` Robert Dailey
  2015-06-18 15:55     ` SZEDER Gábor
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Dailey @ 2015-06-18 15:27 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Stefan Näwe, Git

On Thu, Jun 18, 2015 at 6:29 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:
> Quoting Robert Dailey <rcdailey.lists@gmail.com>
>> I do the following:
>>
>> $ git push origin :topic
>>
>> If I stop halfway through typing 'topic' and hit TAB, auto-completion
>> does not work if I do not have a local branch by that name (sometimes
>> I delete my local branch first, then I push to delete it remotely). I
>> thought that git completion code was supposed to use ls-remote to auto
>> complete refs used in push operations. Is this supposed to work?
>
> It's intentional.  Running 'git ls-remote' with a far away remote can
> take ages, so instead we grab the refs on the remote from the locally
> stored refs under 'refs/remotes/<remote>/'.
>
> See e832f5c096 (completion: avoid ls-remote in certain scenarios,
> 2013-05-28).  The commit message mentions that you can "force"
> completion of remote refs via 'git ls-remote' by starting with the full
> refname, i.e.  'refs/<TAB>', however, that seems to work only on the
> left hand side of the colon in the push refspec.
>
> Gábor
>

If that's indeed the case, then completion should work. I have a
'refs/remotes/origin/topic'. Why will auto complete not work even
though this exists? Do multiple remotes cause issues (in theory there
is no reason why it should cause problems, since it should know I'm
auto-completing a ref on 'origin')?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git completion not using ls-remote to auto-complete during push
  2015-06-18 15:27   ` Robert Dailey
@ 2015-06-18 15:55     ` SZEDER Gábor
  2015-06-18 19:12       ` Robert Dailey
  0 siblings, 1 reply; 6+ messages in thread
From: SZEDER Gábor @ 2015-06-18 15:55 UTC (permalink / raw)
  To: Robert Dailey; +Cc: Stefan Näwe, Git


Quoting Robert Dailey <rcdailey.lists@gmail.com>:

> On Thu, Jun 18, 2015 at 6:29 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:
>> Quoting Robert Dailey <rcdailey.lists@gmail.com>
>>> I do the following:
>>>
>>> $ git push origin :topic
>>>
>>> If I stop halfway through typing 'topic' and hit TAB, auto-completion
>>> does not work if I do not have a local branch by that name (sometimes
>>> I delete my local branch first, then I push to delete it remotely). I
>>> thought that git completion code was supposed to use ls-remote to auto
>>> complete refs used in push operations. Is this supposed to work?
>>
>> It's intentional.  Running 'git ls-remote' with a far away remote can
>> take ages, so instead we grab the refs on the remote from the locally
>> stored refs under 'refs/remotes/<remote>/'.
>>
>> See e832f5c096 (completion: avoid ls-remote in certain scenarios,
>> 2013-05-28).  The commit message mentions that you can "force"
>> completion of remote refs via 'git ls-remote' by starting with the full
>> refname, i.e.  'refs/<TAB>', however, that seems to work only on the
>> left hand side of the colon in the push refspec.
>>
>> Gábor
>>
>
> If that's indeed the case, then completion should work. I have a
> 'refs/remotes/origin/topic'. Why will auto complete not work even
> though this exists? Do multiple remotes cause issues (in theory there
> is no reason why it should cause problems, since it should know I'm
> auto-completing a ref on 'origin')?

The number of remotes doesn't matter.
What matters is which side of the colon the ref to be completed is.

You can complete

   git push origin refs/<TAB>

and

   git fetch origin refs/<TAB>

will even list you refs freshly queried via 'git ls-remote'.
However,

   git push origin :refs/<TAB>
   git push origin branch:refs/<TAB>

don't work, because there are no refs starting with the prefix  
':refs/' or 'branch:refs/'.

Gábor

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git completion not using ls-remote to auto-complete during push
  2015-06-18 15:55     ` SZEDER Gábor
@ 2015-06-18 19:12       ` Robert Dailey
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Dailey @ 2015-06-18 19:12 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Stefan Näwe, Git

On Thu, Jun 18, 2015 at 10:55 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:
>
> Quoting Robert Dailey <rcdailey.lists@gmail.com>:
>
>> On Thu, Jun 18, 2015 at 6:29 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:
>>>
>>> Quoting Robert Dailey <rcdailey.lists@gmail.com>
>>>>
>>>> I do the following:
>>>>
>>>> $ git push origin :topic
>>>>
>>>> If I stop halfway through typing 'topic' and hit TAB, auto-completion
>>>> does not work if I do not have a local branch by that name (sometimes
>>>> I delete my local branch first, then I push to delete it remotely). I
>>>> thought that git completion code was supposed to use ls-remote to auto
>>>> complete refs used in push operations. Is this supposed to work?
>>>
>>>
>>> It's intentional.  Running 'git ls-remote' with a far away remote can
>>> take ages, so instead we grab the refs on the remote from the locally
>>> stored refs under 'refs/remotes/<remote>/'.
>>>
>>> See e832f5c096 (completion: avoid ls-remote in certain scenarios,
>>> 2013-05-28).  The commit message mentions that you can "force"
>>> completion of remote refs via 'git ls-remote' by starting with the full
>>> refname, i.e.  'refs/<TAB>', however, that seems to work only on the
>>> left hand side of the colon in the push refspec.
>>>
>>> Gábor
>>>
>>
>> If that's indeed the case, then completion should work. I have a
>> 'refs/remotes/origin/topic'. Why will auto complete not work even
>> though this exists? Do multiple remotes cause issues (in theory there
>> is no reason why it should cause problems, since it should know I'm
>> auto-completing a ref on 'origin')?
>
>
> The number of remotes doesn't matter.
> What matters is which side of the colon the ref to be completed is.
>
> You can complete
>
>   git push origin refs/<TAB>
>
> and
>
>   git fetch origin refs/<TAB>
>
> will even list you refs freshly queried via 'git ls-remote'.
> However,
>
>   git push origin :refs/<TAB>
>   git push origin branch:refs/<TAB>
>
> don't work, because there are no refs starting with the prefix ':refs/' or
> 'branch:refs/'.
>
> Gábor
>

Interesting. So is it just a glaring bug that the git completion
script isn't ignoring the : and anything to the left of it? Or is this
beyond the control of the script?

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-18 19:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 16:10 Git completion not using ls-remote to auto-complete during push Robert Dailey
2015-06-18  7:03 ` Stefan Näwe
2015-06-18 11:29 ` SZEDER Gábor
2015-06-18 15:27   ` Robert Dailey
2015-06-18 15:55     ` SZEDER Gábor
2015-06-18 19:12       ` Robert Dailey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.