Re: bash prompt evaporates in subdirectories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 > On Tue Oct 22, 2024 at 5:53 PM CEST, Taylor Blau wrote:
> > Are you using the prompt from contrib/completion/git-prompt.sh? If so, I
> > CC'd a couple of folks who have worked recently on that script.
> >
> > I assume they may find it helpful to know a little more about your
> > setup, including possibly if you have a bisection where the prompt
> > stopped working for you when in sub-directories.
>
> Unfortunately, I have recently switched from fish (where
> everything works right), so I don’t know when exactly the break happened.
>
> Using openSUSE/MicroOS-based system with all the work done in
> distrobox containers (with openSUSE/Tumbleweed inside).
>
> Not sure, what else I can say, or how to better debug.

You can help by providing the following:

- What is the "innermost" distro where this happens? Thumbleweed?
  which version?

- Which git version do you have installed? How did you install it?

- How did you install the git-prompt support?

- Which shell do you use? (bash? zsh? something else?)

- How is the (git) prompt set in your shell startup file? (~/.bashrc,
  or ~/.profile, etc). If you don't know exactly, then can you please
  attach your shell startup files?

- Can you provide a sample repository to clone which reproduces the
  issue? for instance, you can pick a small repo from github.

- What are the steps to reproduce the issue? is it enough to "cd"
  into an existing sub-dir at the git dir? or is it only broken
  when creating an unrelated sub-dir and "cd" into it? better yet,
  provide a 1:... 2:... 3:... steps which reproduce the issue for
  you, and which others can try to follow.

I tried the following:

1. Download the latest Thumbleweed snapshot and boot in a VM:
   https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-XFCE-Live-x86_64-Snapshot20241022-Media.iso

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:
   
     This prompt is a port of the "Informative git prompt for zsh"
     which you can find https://github.com/olivierverdier/zsh-git-prompt

    so I did not try to set it up. If you have an issue with that
    package then you should report it to the package maintainer.

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\$ '

6. Start a new bash shell or new terminal.

7. Clone a sample repo (/shameless plug) and "cd" into it:
     git clone https://github.com/avih/shlolcat
     cd shlolcat  # the prompt correctly includes "(master)"

9. "cd" into a subdir:
     cd c-lolcat  # the prompt still correctly includes "(master)"

9. Create an arbitrary additional sub-dir and "cd" into it:
     mkdir xxx
     cd xxx  # the prompt still correctly includes "(master)"


So I can't reproduce such issue with git-prompt.sh which is part
of the "git" repo at contrib/completion/git-prompt.sh .

Cheers,
avih
    





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux