Re: Git completion not using ls-remote to auto-complete during push

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Quoting Robert Dailey <rcdailey.lists@xxxxxxxxx>:

On Thu, Jun 18, 2015 at 6:29 AM, SZEDER Gábor <szeder@xxxxxxxxxx> wrote:
Quoting Robert Dailey <rcdailey.lists@xxxxxxxxx>
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

--
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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]