Bug ID 1227210
Summary bash-git-prompt only works for login shells
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware All
OS openSUSE Tumbleweed
Status NEW
Severity Normal
Priority P5 - None
Component Development
Assignee screening-team-bugs@suse.de
Reporter lassi.vaatamoinen@gmail.com
QA Contact qa-bugs@suse.de
Target Milestone ---
Found By ---
Blocker ---

There's a slight bug in the package, caused by the fact that
/etc/profile.d/bash-git-prompt.sh is executed via /etc/profile.

Now, the bash-git-prompt works properly when you login for example on a
non-graphical TTY, or via SSH (even on localhost), as here we get a login
shell.

BUT when you enter to a desktop environment, and use a terminal application,
bash-git-prompt __git_ps1 gets overridden by /etc/bash_completion.d/git-prompt
that comes as part of git-core, as that script is executed for non-login shell
by /etc/bash.bashrc

So, the sequence of issues to the problem is here:

    User comes to a login screen (e.g. SDDM)
    LOGIN -> /etc/profile gets executed
    /etc/profile.d/bash-git-prompt.sh
    PROFILEREAD=true
    Open Konsole
    /etc/bash.bashrc (and ~/.bashrc) get executed
    /etc/bash_completion.d/git-prompt is executed
    -> overrides the previously set git prompt.
    -> bash-git-prompt is only usable for login shells (sudo -i, ssh, TTY), not
in graphical desktop envs.

NOTE: it does not matter if for Konsole, you set startup command as '/bin/bash
--login' , since PROFILEREAD=true already (I assume), so the bash-git-prompt
scripts won't get run.

IMPROVEMENT: make bash-git-propmt run in the bashrc -sequence, too.


You are receiving this mail because: