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

Entering git repo throws "Cannot find gitstatus.sh" #38

Open
serpro69 opened this issue Jun 10, 2019 · 7 comments
Open

Entering git repo throws "Cannot find gitstatus.sh" #38

serpro69 opened this issue Jun 10, 2019 · 7 comments

Comments

@serpro69
Copy link

serpro69 commented Jun 10, 2019

Not sure what this is. Had this error once before, couldn't find the culprit and had to do clean install. Now after a few days of using the dotfiles again seeing this error.

Re-running bootstrap.sh did not help. The file is clearly present in the /bin folder, however still getting this error.

Oh, and thanks for these awesome dotfiles!

Upd: I've noticed my shell got switched back to bash instead of zsh. Switching to zsh made the issue disappear. But should this work under bash shell as well?

@voku
Copy link
Owner

voku commented Jun 13, 2019

can you please run echo $PATH in the bash and post the result here, thanks. The file should be in the ~/bin/ directory not in /bin/.

@serpro69
Copy link
Author

serpro69 commented Jun 13, 2019

Here's the difference between path variables in zsh and bash:

✓ ~→ bash                                                                                                                                                                                                                                                                                                           
✓ ~→ echo $PATH
/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/home/sergio/.local/bin:/home/sergio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin

✓ ~→ zsh
✓ ~→ echo $PATH
/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/sergio/bin:/home/sergio/.local/bin:/home/sergio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin:/home/sergio/.local/bin

The file was present in the ~/bin directory, I checked that. Also it was on the path because I could just call $ gitstatus.sh from anywhere.

✓ ~→ cd dotfiles                                                                                                                                                                                                                                                                                                    
✓ ~/dotfiles→ bash # switching to bash in a repo, and getting the error message right away                                                                                                                                                                                                                                                                                                 
Cannot find gitstatus.sh!
Cannot find gitstatus.sh!
sergio@milleniumfalcon:~/dotfiles$ gitstatus # can still see the script on the path with autocomplete and execute it
gitstatus_pre-1.7.10.sh  gitstatus.py             gitstatus.sh             
sergio@milleniumfalcon:~/dotfiles$  zsh # changing back to zsh - no error 
✓ ~/dotfiles→

@GersonDias
Copy link

GersonDias commented Jun 25, 2019

Hey, I found the same issue running that on WSL

here is my $PATH after running bootstrap.sh

/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/gersondias/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Program Files/Docker/Docker/Resources/bin:/mnt/c/Python37/Scripts/:/mnt/c/Python37/:/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/mnt/c/Program Files (x86)/Intel/iCLS Client/:/mnt/c/Program Files/Intel/iCLS Client/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/PowerShell/6/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/vim/vim80:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/ide/Extensions/TestPlatform:/mnt/c/Users/GersonDias/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/GersonDias/AppData/Roaming/npm:/mnt/c/tools/Cmder:/mnt/c/Users/GersonDias/.dotnet/tools:/snap/bin  

@serpro69
Copy link
Author

I personally didn't look into it yet, though I have a feeling that it has to do with .redpill files, specifically the bash setup. But I don't have much time ATM to debug this, and I also use zsh, so I don't encounter this issue unless I explicitly switch back to bash shell.

@roaldjap
Copy link

roaldjap commented Nov 3, 2019

Hey, I found the same issue running that on WSL

here is my $PATH after running bootstrap.sh

/usr/local/bin:/usr/sbin:/sbin:/usr/local/sbin:/home/gersondias/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Program Files/Docker/Docker/Resources/bin:/mnt/c/Python37/Scripts/:/mnt/c/Python37/:/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/mnt/c/Program Files (x86)/Intel/iCLS Client/:/mnt/c/Program Files/Intel/iCLS Client/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/PowerShell/6/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/vim/vim80:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin:/mnt/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/ide/Extensions/TestPlatform:/mnt/c/Users/GersonDias/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/GersonDias/AppData/Roaming/npm:/mnt/c/tools/Cmder:/mnt/c/Users/GersonDias/.dotnet/tools:/snap/bin  

I have the same issue on WSL. Have you found any solutions @GersonDias ?

@roaldjap
Copy link

roaldjap commented Nov 7, 2019

On wsl, I managed to prevent throwing "Cannot find gitstatus.sh" by executing zsh on your bash shell. by default, wsl runs bash shell. try also running chsh -s $(which zsh) to change your shell default.

@raelik
Copy link

raelik commented Feb 3, 2022

I fixed this issue by copying bin/gitstatush.sh into .redpill/bash_prompt/. The problem is fairly obvious when you look at the code starting at line 9 in gitprompt.sh:

function git_prompt_dir() {                                                      
  # assume the gitstatus.sh is in the same directory as this script                                 
  # code thanks to http://stackoverflow.com/questions/59895                      
  if [ -z "$__GIT_PROMPT_DIR_BASH" ]; then                                       
    local SOURCE="${BASH_SOURCE[0]}"                                             
    while [ -h "$SOURCE" ]; do                                                   
      local DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"                     
      SOURCE="$(readlink "$SOURCE")"                                             
      [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"                               
    done                                                                         
    __GIT_PROMPT_DIR_BASH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"           
  fi                                                                             
} 

The comment says it all. The code assumes that gitstatus.sh is in the same directory with gitprompt.sh

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

No branches or pull requests

5 participants