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

Re: bash prompt evaporates in subdirectories

From
avih <avihpit@yahoo.com>
Date
Oct 24, 2024, 14:19 UTC
Message-ID
<1945074076.3173992.1729779552281@mail.yahoo.com>
In-Reply-To
<D542P2ZTHIUJ.2GEJYE41VTC0J@cepl.eu>
 On Thursday, October 24, 2024 at 04:33:14 PM GMT+3, Matěj Cepl <mcepl@cepl.eu> wrote:
Show 5 quoted lines
> On Thu Oct 24, 2024 at 1:46 PM CEST, avih wrote:
> > ...
> > - 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/
Good.
Show 6 quoted lines
> ... using the script from git-core.
> >      . ~/git-prompt.sh
> >      PS1='\w$(__git_ps1)\n\$ '
>
> Yes, that works:
> ...

Good. So this probably means there's no issue with that script, unless you can isolate a specific minimal example (with some config vars, PS1/PROMPT_COMMAND, etc) which behaves badly.

> > - Which shell do you use? (bash? zsh? something else?)
>
> bash with ble.sh (freshly updated, but the problem can be reproduced even without it)
ble.sh looks pretty not-small, and I'm not familiar with it.
Show 14 quoted lines
> > - 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
> ... (generally default distro files)
>
> * ~/.bashrc is https://mcepl.fedorapeople.org/tmp/bashrc
> * ~/.config/blesh/init.sh is
>   https://mcepl.fedorapeople.org/tmp/init.sh
>
> ...
>
> So, the problem is somewhere in my too complicated configuration. Any idea, where?

These files load/use ~/.config/dotfiles/osc/osc-prompt.sh which is not linked or provided, and I'm guessing is either the culprit, or the issue is how you use it together with __git_ps1, which I can't help you with.

You may link it in a reply, but I likely don't have the bandwidth to look into it, though maybe someone else would be able to help.

Or, even better, you should look into it and bisect your config.
For what it's worth, if, with that same Tumbleweed live DVD, with git
installed, I add your ~/.bashrc content to mine (default), and add
this final line:
 
  PS1='\n\w$(__git_ps1)\n\$ '
 
then it does work correctly (with your GIT_PS1_* config vars etc).
But your PS1 is:
 
  export PS1='\h:\W$(__osc_prompt) \$ '

So I'm guessing things go wrong somewhere between __osc_prompt and __git_ps1 invocation, but I can't tell where.

Anyway, good luck. avih

Previous: avih
Message 10 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.