Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow different color for master branch #363

Merged
merged 2 commits into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion gitprompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,15 @@ function updatePrompt() {

local NEW_PROMPT="$EMPTY_PROMPT"
if [[ -n "$git_status_fields" ]]; then
local STATUS_PREFIX="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX}${GIT_PROMPT_BRANCH}\${GIT_BRANCH}${ResetColor}${GIT_FORMATTED_UPSTREAM}"

case "$GIT_BRANCH" in
$GIT_PROMPT_MASTER_BRANCHES)
local STATUS_PREFIX="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX}${GIT_PROMPT_MASTER_BRANCH}\${GIT_BRANCH}${ResetColor}${GIT_FORMATTED_UPSTREAM}"
;;
*)
local STATUS_PREFIX="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX}${GIT_PROMPT_BRANCH}\${GIT_BRANCH}${ResetColor}${GIT_FORMATTED_UPSTREAM}"
;;
esac
local STATUS=""

# __add_status KIND VALEXPR INSERT
Expand Down
1 change: 1 addition & 0 deletions themes/Chmike.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ override_git_prompt_colors() {

GIT_PROMPT_THEME_NAME="Chmike"
GIT_PROMPT_BRANCH="${Green}"
GIT_PROMPT_MASTER_BRANCH="${Green}"
GIT_PROMPT_REMOTE=" "
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭐"

Expand Down
9 changes: 8 additions & 1 deletion themes/Custom.bgptemplate
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ override_git_prompt_colors() {
# GIT_PROMPT_SEPARATOR="|" # separates each item

# GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory
# GIT_PROMPT_MASTER_BRANCH="${Magenta}" # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES
# GIT_PROMPT_STAGED="${Red}●" # the number of staged files/directories
# GIT_PROMPT_CONFLICTS="${Red}✖ " # the number of files in conflict
# GIT_PROMPT_CHANGED="${Blue}✚ " # the number of changed files
Expand Down Expand Up @@ -53,6 +54,12 @@ override_git_prompt_colors() {
# GIT_PROMPT_SYMBOLS_BEHIND="↓·" # The symbol for "n versions behind of origin"
# GIT_PROMPT_SYMBOLS_PREHASH=":" # Written before hash of commit, if no name could be found
# GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L" # This symbol is written after the branch, if the branch is not tracked

# branch name(s) that will use $GIT_PROMPT_MASTER_BRANCH color
# To specify multiple branches, use
# shopt -s extglob
# GIT_PROMPT_MASTER_BRANCHES='@(master|production)'
# GIT_PROMPT_MASTER_BRANCHES="master"
}

reload_git_prompt_colors "Custom"
reload_git_prompt_colors "Custom"
7 changes: 7 additions & 0 deletions themes/Default.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ define_undefined_git_prompt_colors() {
if [ -z ${GIT_PROMPT_SEPARATOR+x} ]; then GIT_PROMPT_SEPARATOR="|"; fi # separates each item

if [ -z ${GIT_PROMPT_BRANCH+x} ]; then GIT_PROMPT_BRANCH="${Magenta}"; fi # the git branch that is active in the current directory
if [ -z ${GIT_PROMPT_MASTER_BRANCH+x} ]; then GIT_PROMPT_MASTER_BRANCH="${Magenta}"; fi # used if the git branch that is active in the current directory is $GIT_PROMPT_MASTER_BRANCHES
if [ -z ${GIT_PROMPT_STAGED+x} ]; then GIT_PROMPT_STAGED="${Red}●"; fi # the number of staged files/directories
if [ -z ${GIT_PROMPT_CONFLICTS+x} ]; then GIT_PROMPT_CONFLICTS="${Red}✖ "; fi # the number of files in conflict
if [ -z ${GIT_PROMPT_CHANGED+x} ]; then GIT_PROMPT_CHANGED="${Blue}✚ "; fi # the number of changed files
Expand Down Expand Up @@ -88,6 +89,12 @@ define_undefined_git_prompt_colors() {
if [ -z ${GIT_PROMPT_SYMBOLS_BEHIND+x} ]; then GIT_PROMPT_SYMBOLS_BEHIND="↓·"; fi # The symbol for "n versions behind of origin"
if [ -z ${GIT_PROMPT_SYMBOLS_PREHASH+x} ]; then GIT_PROMPT_SYMBOLS_PREHASH=":"; fi # Written before hash of commit, if no name could be found
if [ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING+x} ]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L"; fi # This symbol is written after the branch, if the branch is not tracked

# branch name(s) that will use $GIT_PROMPT_MASTER_BRANCH color
# To specify multiple branches, use
# shopt -s extglob
# GIT_PROMPT_MASTER_BRANCHES='@(master|production)'
if [ -z ${GIT_PROMPT_MASTER_BRANCHES+x} ]; then GIT_PROMPT_MASTER_BRANCHES="master"; fi
}

# call only from theme file
Expand Down
1 change: 1 addition & 0 deletions themes/Evermeet.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ override_git_prompt_colors() {
GIT_PROMPT_SEPARATOR="|" # separates each item

GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory
GIT_PROMPT_MASTER_BRANCH="${Magenta}" # the git branch that is active in the current directory
GIT_PROMPT_STAGED="${Cyan}●" # the number of staged files/directories
GIT_PROMPT_CONFLICTS="${BoldRed}✖" # the number of files in conflict
GIT_PROMPT_CHANGED="${Cyan}✚" # the number of changed files
Expand Down
1 change: 1 addition & 0 deletions themes/Evermeet_Lowres.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ override_git_prompt_colors() {
GIT_PROMPT_SEPARATOR="|" # separates each item

GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory
GIT_PROMPT_MASTER_BRANCH="${Magenta}" # the git branch that is active in the current directory
GIT_PROMPT_STAGED="${Cyan}●" # the number of staged files/directories
GIT_PROMPT_CONFLICTS="${BoldRed}✖ " # the number of files in conflict
GIT_PROMPT_CHANGED="${Cyan}✚ " # the number of changed files
Expand Down
1 change: 1 addition & 0 deletions themes/Evermeet_Ubuntu.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ override_git_prompt_colors() {
GIT_PROMPT_SEPARATOR="|" # separates each item

GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory
GIT_PROMPT_MASTER_BRANCH="${Magenta}" # the git branch that is active in the current directory
GIT_PROMPT_STAGED="${Cyan}● " # the number of staged files/directories
GIT_PROMPT_CONFLICTS="${BoldRed}✖ " # the number of files in conflict
GIT_PROMPT_CHANGED="${Cyan}✚ " # the number of changed files
Expand Down
1 change: 1 addition & 0 deletions themes/Minimal.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ override_git_prompt_colors() {

Time12a="\$(date +%H:%M:%S)"
GIT_PROMPT_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory
GIT_PROMPT_MASTER_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory
GIT_PROMPT_PREFIX="" # start of the git info string
GIT_PROMPT_SUFFIX="" # the end of the git info string
GIT_PROMPT_SEPARATOR="" # separates each item
Expand Down
1 change: 1 addition & 0 deletions themes/Minimal_UserHost.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ override_git_prompt_colors() {
fi

GIT_PROMPT_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory
GIT_PROMPT_MASTER_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory
GIT_PROMPT_PREFIX="" # start of the git info string
GIT_PROMPT_SUFFIX="" # the end of the git info string
GIT_PROMPT_SEPARATOR="" # separates each item
Expand Down
1 change: 1 addition & 0 deletions themes/Single_line_Dark.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
override_git_prompt_colors() {
GIT_PROMPT_THEME_NAME="Single_line_nono031"
GIT_PROMPT_BRANCH="${Cyan}"
GIT_PROMPT_MASTER_BRANCH="${Cyan}"
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
GIT_PROMPT_CHANGED="${Yellow}✚ "
GIT_PROMPT_STAGED="${Magenta}●"
Expand Down
1 change: 1 addition & 0 deletions themes/Single_line_NoExitState_Gentoo.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
override_git_prompt_colors() {
GIT_PROMPT_THEME_NAME="Single_line_NoExitState_Gentoo"
GIT_PROMPT_BRANCH="${Cyan}"
GIT_PROMPT_MASTER_BRANCH="${Cyan}"
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
GIT_PROMPT_CHANGED="${Yellow}✚ "
GIT_PROMPT_STAGED="${Magenta}●"
Expand Down
1 change: 1 addition & 0 deletions themes/Single_line_NoExitState_openSUSE.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
override_git_prompt_colors() {
GIT_PROMPT_THEME_NAME="Single_line_NoExitState_openSUSE"
GIT_PROMPT_BRANCH="${Cyan}"
GIT_PROMPT_MASTER_BRANCH="${Cyan}"
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
GIT_PROMPT_CHANGED="${Yellow}✚ "
GIT_PROMPT_STAGED="${Magenta}●"
Expand Down
1 change: 1 addition & 0 deletions themes/Single_line_openSUSE.bgptheme
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
override_git_prompt_colors() {
GIT_PROMPT_THEME_NAME="Single_line_openSUSE"
GIT_PROMPT_BRANCH="${Cyan}"
GIT_PROMPT_MASTER_BRANCH="${Cyan}"
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
GIT_PROMPT_CHANGED="${Yellow}✚ "
GIT_PROMPT_STAGED="${Magenta}●"
Expand Down