NCAR / spack-gust

Spack production user software stack on the Gust test system
4 stars 0 forks source link

git tab completion error message #30

Closed apcraig closed 1 year ago

apcraig commented 1 year ago

I use tab completion all the time in my login terminal. When I do it with git, an error message pops up

/usr/share/tcsh/git.complete: line 40: _git: command not found

I'm using tcsh and

which git /usr/bin/git

But it also happens when I load the git module,

which git /glade/u/apps/common/22.08/spack/opt/spack/git/2.37.0/gcc/7.5.0/bin/git

vanderwb commented 1 year ago

Thanks for reporting Tony - I can replicate the problem and see where it comes from, though I'm not sure of the root cause at this point.

@jbaksta - it seems like this behavior is coming from an inconsistency in the git initialization scripts. The basic flow seems to be the following for tcsh:

  1. Upon login, source /etc/profile.d/git.csh, which sets up autocompletion calls for git and gitk which call /usr/share/tcsh/git.complete via bash.
  2. git.complete eventually calls _git, which is a shell function defined by /etc/bash_completion.d/git.sh (which was sourced).

The Gust version of git.sh has different logic for defining the git and gitk wrapper functions that are used for auto-completion - this different logic is not working, though I haven't tracked down why as of yet.

vanderwb commented 1 year ago

I think the difference here is that the Cheyenne version of the file defines a _git function, whereas the Gust version does not seem to. However, both systems have git.complete files that expect _git to exist in the user environment.

vanderwb commented 1 year ago

@apcraig - this issue was fixed a while back. I see the correct behavior, but let us know if you see any different.