Thread (10 messages) 10 messages, 3 authors, 2024-10-24

Re: bash prompt evaporates in subdirectories

From: avih <hidden>
Date: 2024-10-24 12:45:40

 On Thursday, October 24, 2024 at 02:46:21 PM GMT+3, avih [off-list ref] wrote:
...

I tried the following:

...

2. In a terminal (default shell is bash 5.2.37(1)):
   sudo zypper install git  # 2.47.0-1.1
   sudo zypper install bash-git-prompt

3. The above does NOT install git-prompt.sh which is maintained
   together with git at the contrib dir. In its README.md:
   ...

4.  Download git-prompt.sh from the git contrib dir:
      curl -o ~/git-prompt.sh https://raw.githubusercontent.com/git/git/refs/tags/v2.47.0/contrib/completion/git-prompt.sh
      chmod +x ~/git-prompt.sh
5. Add the following lines at the end of ~/.bashrc :
     . ~/git-prompt.sh
     PS1='\w$(__git_ps1)\n\$ '
Actually, "sudo zypper install git" does install the correct script
at /usr/share/bash-completion/completions/git-prompt.sh

Additionally, that "git" package adds /etc/bash-completion.d/git-prompt
which does source this script automatically on shell startup, therefore
step 4 (the curl thing) is not required, and git-prompt.sh is already
loaded automatically, and so only one line instead of two should be
added to ~/.bashrc (as a minimal example):

  PS1='\w$(__git_ps1)\n\$ '

The rest is the same. Still can't reproduce it with this script.

avih
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help