Skip to content

Commit

Permalink
Created the .local/git-prompt.sh as a fallback for ${__git_ps1}
Browse files Browse the repository at this point in the history
  • Loading branch information
evandrocoan committed Dec 24, 2019
1 parent 38c179a commit e843296
Show file tree
Hide file tree
Showing 3 changed files with 583 additions and 11 deletions.
29 changes: 18 additions & 11 deletions .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,6 @@ if [ -n "$force_color_prompt" ]; then
fi
fi

# linux@linux:(master)/root$ sudo apt ...
# https://stackoverflow.com/questions/37021988/conditional-space-in-ps1
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
# https://gist.github.com/justintv/168835 - Display git branch in bash prompt
if [ -z "${__git_ps1}" ];
then
function __git_ps1() {
:;
}
fi

if [ "$color_prompt" = yes ];
then
# linux@linux:(master)/root$ echo hi
Expand Down Expand Up @@ -528,6 +517,24 @@ export DISPLAY=:0
python3 -m site &> /dev/null && PATH="$PATH:`python3 -m site --user-base`/bin"
python2 -m site &> /dev/null && PATH="$PATH:`python2 -m site --user-base`/bin"

# linux@linux:(master)/root$ sudo apt ...
# https://stackoverflow.com/questions/37021988/conditional-space-in-ps1
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
# https://gist.github.com/justintv/168835 - Display git branch in bash prompt
if [ -z "${__git_ps1}" ];
then
function __git_ps1() {
:;
}

# To update it:
# wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -O ~/.local/git-prompt.sh
if [ -f ~/.local/git-prompt.sh ];
then
source ~/.local/git-prompt.sh;
fi
fi

# Run `.per_computer_settings` rules which override some other variable on this `.bashrc`
# https://stackoverflow.com/questions/23929235/multi-line-string-with-extra-space-preserved-indentation/36240082
eval "$run_post_rules_for_per_computer_settings"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

# https://stackoverflow.com/questions/5261959/unignore-subdirectories-of-ignored-directories-in-git
!/.local/
!/.local/git-prompt.sh
!/.local/bin/
!/.local/bin/run_as_user.sh
!/.local/bin/_generic_timer.sh
Expand Down
Loading

0 comments on commit e843296

Please sign in to comment.