Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git autocomplete stopped working #73

Open
Nikitaw99 opened this issue Jul 26, 2016 · 18 comments
Open

Git autocomplete stopped working #73

Nikitaw99 opened this issue Jul 26, 2016 · 18 comments

Comments

@Nikitaw99
Copy link

Nikitaw99 commented Jul 26, 2016

I am not sure what I did, but I guess the git autocompletion broke for me...
I think it happened while I was trying to set git=hub so that I don't always have to use hub.

Now it broke...

I have tried reinstalling gitsome, but the issue still occurs. Any help?
gif

Also, I was using it on windows. I looked here on how to add it back, but I simply can't find any of the paths in:

    'BASH_COMPLETIONS': (('/usr/local/etc/bash_completion',
                             '/opt/local/etc/profile.d/bash_completion.sh',
                             '/usr/local/etc/bash_completion.d/git-completion.bash')
                        if ON_MAC else
                        ('/usr/share/bash-completion/bash_completion',
                             '/usr/share/bash-completion/completions/git')
                        if ON_ARCH else
                        ('/etc/bash_completion',
                             '/usr/share/bash-completion/completions/git')),
@Nikitaw99
Copy link
Author

I recently tried to put:

$BASH_COMPLETIONS.append('/usr/local/etc/bash_completion')
$BASH_COMPLETIONS.append('/opt/local/etc/profile.d/bash_completion.sh')
$BASH_COMPLETIONS.append('/usr/local/etc/bash_completion.d/git-completion.bash')
$BASH_COMPLETIONS.append('/usr/share/bash-completion/completions/git')

into the contents of ~/.xonshrc. Nothing changed.

@donnemartin donnemartin changed the title Git autocomplete is broken?? Git autocomplete stopped working Jul 27, 2016
@donnemartin
Copy link
Owner

Hi @Nikitaw99,

It sounds like git tab completion was once working but now suddenly stopped.

I think it happened while I was trying to set git=hub so that I don't always have to use hub.

Can you try to undo these changes and see if it fixes the git tab completion issues? I think you might have been following these hub aliasing instructions.

Outside of gitsome, are you getting git tab completions to work?

@Nikitaw99
Copy link
Author

Nikitaw99 commented Jul 27, 2016

@donnemartin

Outside of gitsome, are you getting git tab completions to work?

Yes! Atleast they are working. Or atleast outside of gitsome.

And no, I didn't know about this.

I think I tried:

  • alias.bat git=hub
  • aliases git=hub
  • alias git=hub

I am mostly looking for a way to "reset" the autocompletion.

@donnemartin
Copy link
Owner

I think it happened while I was trying to set git=hub so that I don't always have to use hub.
Now it broke...

I think I tried:

  • alias.bat git=hub
  • aliases git=hub
  • alias git=hub

Have you tried undoing these changes?

To reset bash completions just delete ~/.xonshrc.

@Nikitaw99
Copy link
Author

Nikitaw99 commented Jul 31, 2016

I think I tried:

  • alias.bat git=hub
  • aliases git=hub
  • alias git=hub

Have you tried undoing these changes?

I don't know how to undo them,

To reset bash completions just delete ~/.xonshrc.

I just removed ~/.xonshrc and it changed nothing.

@Nikitaw99
Copy link
Author

gh completions are still working.

I added this to ~/,xonshrc:

$BASH_COMPLETIONS.append('C:\Program\ Files\Git\mingw64\share\git\completion\git-completion.bash')
$BASH_COMPLETIONS.append('C:\Program\ Files\Git\mingw64\share\git\completion\git-completion.bash')

Yet the completions still don't work.

@donnemartin
Copy link
Owner

@Nikitaw99 unfortunately I'm not sure how to help fix the problem you're encountering that seems to be local to your system. Perhaps the community might jump in with a suggestion.

@orionlee
Copy link

I have the same problem without using hub at all in the following environment:

windows 7, git-for-windows 2.9.0 , bash that comes with git,

In my environment:

  1. git completion in bash does work
  2. in gitsome (xonsh), the completion does NOT work, irrespective of setting $BASH_COMPLETIONS in ~/.xonshrc

I believe the issue occurs at xnosh layer but I didn't get much further.
My reason is that I got a temporary fix by hacking completer.py, basically telling it when it comes to git, it supplies its own hardcoded completion, ignoring what the shell (xnosh) provides.

@donnemartin
Copy link
Owner

My reason is that I got a temporary fix by hacking completer.py, basically telling it when it comes to git, it supplies its own hardcoded completion, ignoring what the shell (xnosh) provides.

@orionlee Interesting, do you mind posting the change and I can take a look?

@orionlee
Copy link

orionlee commented Aug 21, 2016

@donnemartin Attached please see the hack:
completer.py.txt

Basically I treat git expansion similar to gh, and use the existing hardcoded META_LOOKUP_GIT to provide a list of git commands.

I should add that given the existing mechanism in providing descriptions to shell-completed git commands fail to yield any in my environement xonsh code that calls build_completions_with_meta, I conclude the problem is that xnosh does not complete git in my environment.

@donnemartin
Copy link
Owner

@orionlee thanks!

@gifford
Copy link

gifford commented Nov 24, 2016

@donnemartin I am seeing this same problem on brand new installs on two different computers.

I just found out about gitsome, and tried to install it on two different machines (one Windows 10, one macOS 10.12). On both machines, I can get autocompletions for gh commands but not for git commands. When I type git , the autocomplete list doesn't contain any git commands. On the Mac the autocomplete only lists files and folders. On the Windows machine, it lists files and folders as well as python types and keywords (the Windows machine looks exactly like @Nikitaw99's gif at the top of this thread). As I said, both of these are brand new installations of gitsome, I haven't changed any configurations or aliased hub or anything.

Please let me know if you have any suggestions, or if there is any other information I can provide to help reproduce and fix this. Thanks in advance!

@donnemartin
Copy link
Owner

Hi @gifford, there does seem to be a bug on Windows based on these reports, I've labeled this ticket as a bug.

For Mac I think this the first I've heard of issues with the git autocompleter. Does the enabling bash completions section of the README help?

@Nikitaw99
Copy link
Author

Nikitaw99 commented Nov 25, 2016

Reinstalled gitsome just now. Still not working.

@gifford
Copy link

gifford commented Nov 27, 2016

@donnemartin I didn't realize that the git autocompleter depended on bash completions. Based on your suggestion, I discovered that I did not have bash completions set up for git on my Mac. Now that I set them up, the autocompleter works as well.

The Windows issue is still a problem - I verified that I can complete git commands with the tab key in the Windows command line, but I still don't get any git-related autocomplete options in the drop-down with gitsome.

@modulexcite
Copy link

modulexcite commented Nov 27, 2016

Thank you for an excellent tool.
I've a similar problem mentioned here by @gifford and @Nikitaw99 and I was never able to get the autocomplete working on my Windows 7 SP1 (64bit) machine with Python v3.5 (32bit) installed using ConEmu. The ".xonshrc" file was never created on my machine after installing gitsome but the files ".xonsh_history.json" and ".xonsh_man_completions" files were created, so I've created the ".xonshrc" file appended the paths to the git completions manually but that didn't have any effect.
The ".xonsh_history.json" file is storing the history and autocompleting the git commands that are stored in that file that I have executed previously but the general autocomplete feature for git is not working. However the GitHub commands autocomplete feature is working great which is awesome.

@donnemartin
Copy link
Owner

@modulexcite thanks for the additional info!

Thanks to orionlee, who has done an initial investigation on this with #73 (comment) and #73 (comment).

@modulexcite
Copy link

Thanks @donnemartin, I can confirm that the workaround provided by @orionlee on this thread enables the autocompletion of git commands now but not for the git-extras commands. Thanks @orionlee.
I'm just getting started on python and thank you for your help on this.


Below are my findings so far, Hopefully this helps other people trying to figure out why it isn't working.
The "$BASH_COMPLETIONS" variable returns the below value (paths) in gitsome on my machine
['/etc/bash_completion', '/usr/share/bash-completion/completions/git']
which does not exist on my machine with git v2.10.2 installed on my machine. The actual path for the git completion resides here
C:\Program Files\Git\mingw64\share\git\completion\git-completion.bash
I've added this path to the ".xonshrc" file but that didn't solve the problem. The other thing I tried was to create a symlink to C:\Program Files\Git\mingw64\share\git\completion with the name git in /usr/share/bash-completion/completions/git and unfortunately that didn't solve the problem either.
I do agree with @orionlee on this being an issue with the xonsh layer as I've noticed a few issues posted by users regarding xonsh and git not working well together, I'm listing a few of them here.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants