git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: avih <avihpit@yahoo.com>
To: "Taylor Blau" <me@ttaylorr.com>, "Matěj Cepl" <mcepl@cepl.eu>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: bash prompt evaporates in subdirectories
Date: Thu, 24 Oct 2024 11:46:20 +0000 (UTC)	[thread overview]
Message-ID: <1101848017.3146876.1729770380522@mail.yahoo.com> (raw)
In-Reply-To: <D53YJ81WH001.2KRT4KHARKLC4@cepl.eu>

 > 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
    

  reply	other threads:[~2024-10-24 12:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22 15:02 bash prompt evaporates in subdirectories Matěj Cepl
2024-10-22 15:53 ` Taylor Blau
2024-10-24 10:17   ` Matěj Cepl
2024-10-24 11:46     ` avih [this message]
2024-10-24 12:35       ` avih
2024-10-24 13:33       ` Matěj Cepl
2024-10-24 14:19         ` avih
2024-10-24 14:26         ` RESOLVED [Was: Re: bash prompt evaporates in subdirectories] Matěj Cepl
2024-10-24 15:50           ` Taylor Blau
2024-10-24 20:03           ` avih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1101848017.3146876.1729770380522@mail.yahoo.com \
    --to=avihpit@yahoo.com \
    --cc=git@vger.kernel.org \
    --cc=mcepl@cepl.eu \
    --cc=me@ttaylorr.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).