You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot git autocomplete single file from newly-added subdirectory #5229
Thanks for digging into it. Normally fish does not dig into a directory (nor offer recursive completions) unless that directory has been typed out at the command prompt, so I imagine we can special-case the completion code to use -uall when commandline -ct | string match -qe / is true, then restrict the search to commandline -ct | string replace -r '/.*' '/'?
Edit: Never mind. That's exactly what you just said. 🤦♀️
I imagine we can special-case the completion code to use -uall when commandline -ct | string match -qe / is true, then restrict the search to commandline -ct | string replace -r '/.*' '/'?
No need to even do something that complex - it turns out that commandline arguments are always checked, so git status -unormal (commandline -ct)* would work. There's some ramifications to that, and I'm not sure if we want to do the glob or let git do it.
@faho I don't know if you'd prefer a separate issue for these, but
git checkout COMMITISH <TAB> should complete files that were in the repo at that time
git show <TAB> should offer local and remote branches, not just commitishes
git show COMMITISH:<TAB> should complete files that were in the repo at that time
git bisect has a well defined format (that also stupidly breaks with all git conventions) and takes a sub-sub-command instead of an argument. It should be straightforward, though.
You're right. In a repo like fish, it's just impossible to see them in the autocompleter because of the ordering of results.
Can you please universally add a rule for --? git checkout -- should complete files (theoretically from HEAD, but it's OK if just locally) but instead it exhibits #5237
git checkout -- should complete files (theoretically from HEAD, but it's OK if just locally)
Well.. no? I mean if you do git checkout -- README.md, and README.md exists and is known to git, that won't error out, but unless README.md is deleted or modified that command should be useless.
Hmm, I can't remember now but it was in the middle of a partial rebase and I needed to checkout the file to restore some changes or something. I will post back if/when I can repro.
Activity
faho commentedon Oct 4, 2018
This offers "bar/" for me, which is a result of using
git status -unormalinstead of "-uall". We might want to rethink that.faho commentedon Oct 4, 2018
Note that "uall" can be quite slow, so we might want to couple this with limiting to the current directory (via
commandline -ct)mqudsi commentedon Oct 4, 2018
Thanks for digging into it. Normally fish does not dig into a directory (nor offer recursive completions) unless that directory has been typed out at the command prompt, so I imagine we can special-case the completion code to use
-uallwhencommandline -ct | string match -qe /is true, then restrict the search tocommandline -ct | string replace -r '/.*' '/'?Edit: Never mind. That's exactly what you just said. 🤦♀️
faho commentedon Oct 4, 2018
No need to even do something that complex - it turns out that commandline arguments are always checked, so
git status -unormal (commandline -ct)*would work. There's some ramifications to that, and I'm not sure if we want to do the glob or let git do it.mqudsi commentedon Oct 14, 2018
With my recent experience in mind: whichever one is faster 😄
mqudsi commentedon Oct 23, 2018
@faho I don't know if you'd prefer a separate issue for these, but
git checkout COMMITISH <TAB>should complete files that were in the repo at that timegit show <TAB>should offer local and remote branches, not just commitishesgit show COMMITISH:<TAB>should complete files that were in the repo at that timegit bisecthas a well defined format (that also stupidly breaks with all git conventions) and takes a sub-sub-command instead of an argument. It should be straightforward, though.faho commentedon Oct 24, 2018
It does.
The rest just haven't been added. Any idea how to complete "files at the time"?
(This is why I said that doing git completions could be a full time job)
faho commentedon Oct 24, 2018
Not really -
stashalso does sub-subcommand.mqudsi commentedon Oct 27, 2018
You're right. In a repo like fish, it's just impossible to see them in the autocompleter because of the ordering of results.
Can you please universally add a rule for
--?git checkout --should complete files (theoretically from HEAD, but it's OK if just locally) but instead it exhibits #5237faho commentedon Oct 28, 2018
Well.. no? I mean if you do
git checkout -- README.md, and README.md exists and is known to git, that won't error out, but unless README.md is deleted or modified that command should be useless.Which is why checkout already has:
If we can reliably determine which files are useful we should only offer those, because the other files are just noise.
Or am I missing something?
(This probably triggers 5237 because of the "--")
mqudsi commentedon Oct 28, 2018
Hmm, I can't remember now but it was in the middle of a partial rebase and I needed to checkout the file to restore some changes or something. I will post back if/when I can repro.
completions/git: Let git glob files