git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: bash prompt evaporates in subdirectories

From
Matěj Cepl <mcepl@cepl.eu>
Date
Oct 24, 2024, 13:33 UTC
Message-ID
<D542P2ZTHIUJ.2GEJYE41VTC0J@cepl.eu>
In-Reply-To
<1101848017.3146876.1729770380522@mail.yahoo.com>
On Thu Oct 24, 2024 at 1:46 PM CEST, avih wrote:
> - What is the "innermost" distro where this happens? Thumbleweed?
>   which version?

Yes, Tumbleweed (actually MicroOS uses Tumbleweed packages as well), which is a rolling distro and I updated (almost) daily, so it is hard to say which version.

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

mitmanek:~ $ rpm -qf "$(which git)" git-core-2.47.0-1.1.x86_64 mitmanek:~ $

> - How did you install the git-prompt support?
Using the git-prompt.sh from the package, but it seems to be the same as the upstream one in contrib/
mitmanek:~ $ rpm -qf /bin/bash
bash-5.2.37-14.2.x86_64
mitmanek:~ $ rpm -qf /usr/share/bash-completion/completions/git-prompt.sh
git-core-2.47.0-1.1.x86_64
mitmanek:~ $ diff -u \
    /usr/share/bash-completion/completions/git-prompt.sh \
    <(curl -L -s https://github.com/git/git/raw/refs/heads/master/contrib/completion/git-prompt.sh)
mitmanek:~ $ 
> - Which shell do you use? (bash? zsh? something else?)
bash with ble.sh (freshly updated, but the problem can be reproduced even without it)
> - 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?
* /etc/bash.bashrc is
  https://mcepl.fedorapeople.org/tmp/bash.bashrc (the
  standard openSUSE one with the addition of loading
  /etc/profile.d/distrobox_profile.sh)
* /etc/profile is https://mcepl.fedorapeople.org/tmp/profile
  (git is not mentioned anywhere in /etc/profile.d)
* /etc/bash_completion.d/git-prompt is
  https://mcepl.fedorapeople.org/tmp/git-prompt (so, yes
  git-prompt may be attempted to be loaded twice)
* /etc/profile.d/distrobox_profile.sh is
  https://mcepl.fedorapeople.org/tmp/distrobox_profile.sh
* ~/.bashrc is https://mcepl.fedorapeople.org/tmp/bashrc
* ~/.config/blesh/init.sh is
  https://mcepl.fedorapeople.org/tmp/init.sh
> - Can you provide a sample repository to clone which reproduces the
>   issue? for instance, you can pick a small repo from github.

Basically any git repository which has more than one level of directories, I spent most of my time in https://git.sr.ht/~mcepl/m2crypto, so when I do `cd src` the git status evaporates.

Show 5 quoted lines
> - 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.
Yes, just run `cat <(curl -L -s https://mcepl.fedorapeople.org/tmp/typescript)`
>    sudo zypper install bash-git-prompt
I don’t have this package installed at all, using the script from git-core.
>      . ~/git-prompt.sh
>      PS1='\w$(__git_ps1)\n\$ '
Yes, that works:

mitmanek:~ $ export PS1='\w$(__git_ps1)\n\$ ' ~ $ ~/repos/m2crypto cd -- /home/matej/repos/m2crypto ~/repos/m2crypto (master $) $ cd src ~/repos/m2crypto/src (master $) $

So, the problem is somewhere in my too complicated configuration. Any idea, where?
Thank you for your help so far!
Matěj
-- 
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
 
Books aren’t written - they’re rewritten. Including your own. It
is one of the hardest things to accept, especially after the
seventh rewrite hasn’t quite done it.
  -- Michael Crichton, alluding to Steele MacKaye (1889) article
     where he said this about theater plays.
Previous: avihNext: Matěj Cepl
Message 6 of 10 in “bash prompt evaporates in subdirectories”
  1. Matěj CeplOct 22, 2024
  2. Taylor BlauOct 22, 2024
  3. Matěj CeplOct 24, 2024
  4. avihOct 24, 2024
  5. avihOct 24, 2024
  6. Matěj CeplOct 24, 2024
  7. RESOLVED [Was: Re: bash prompt evaporates in subdirectories]Matěj Cepl, Oct 24, 2024
  8. Taylor BlauOct 24, 2024
  9. avihOct 24, 2024
  10. avihOct 24, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.