diff --git a/liquidprompt b/liquidprompt index de87db1..5fe92d7 100755 --- a/liquidprompt +++ b/liquidprompt @@ -569,6 +569,14 @@ _lp_git_branch_color() git diff --cached --quiet >/dev/null 2>&1 GDC=$? + local has_untracked + has_untracked=$(git status 2>/dev/null | grep '\(# Untracked\)') + if [[ -z "$has_untracked" ]] ; then + has_untracked="" + else + has_untracked="*" + fi + local has_commit has_commit=$(git rev-list --no-merges --count origin/${branch}..${branch} 2>/dev/null) if [[ -z "$has_commit" ]] ; then @@ -579,16 +587,16 @@ _lp_git_branch_color() has_lines=$(git diff --numstat | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d/-%d\n", plus, minus)}') if [[ "$has_commit" -gt "0" ]] ; then # Changes to commit and commits to push - ret="${LP_COLOR_CHANGES}${branch}${NO_COL}(${LP_COLOR_DIFF}$has_lines${NO_COL},${LP_COLOR_COMMITS}$has_commit${NO_COL})" + ret="${LP_COLOR_CHANGES}${branch}${has_untracked}${NO_COL}(${LP_COLOR_DIFF}$has_lines${NO_COL},${LP_COLOR_COMMITS}$has_commit${NO_COL})" else - ret="${LP_COLOR_CHANGES}${branch}${NO_COL}(${LP_COLOR_DIFF}$has_lines${NO_COL})" # changes to commit + ret="${LP_COLOR_CHANGES}${branch}${has_untracked}${NO_COL}(${LP_COLOR_DIFF}$has_lines${NO_COL})" # changes to commit fi else if [[ "$has_commit" -gt "0" ]] ; then # some commit(s) to push - ret="${LP_COLOR_COMMITS}${branch}${NO_COL}(${LP_COLOR_COMMITS}$has_commit${NO_COL})" + ret="${LP_COLOR_COMMITS}${branch}${has_untracked}${NO_COL}(${LP_COLOR_COMMITS}$has_commit${NO_COL})" else - ret="${LP_COLOR_UP}${branch}${NO_COL}" # nothing to commit or push + ret="${LP_COLOR_UP}${branch}${has_untracked}${NO_COL}" # nothing to commit or push fi fi echo -ne "$ret"