summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-15 09:56:28 +0300
committerLeonid Volnitsky <Leonid@Volnitsky.com>2008-06-15 09:59:36 +0300
commit6adfbbd669b812fac340f84d7e12e6c49c1c790c (patch)
treeff1bf5f21389ff8cf425d3e8821aba55864920b5
parentalso added raw head disp (diff)
downloadgit-prompt-6adfbbd669b812fac340f84d7e12e6c49c1c790c.tar.gz
git-prompt-6adfbbd669b812fac340f84d7e12e6c49c1c790c.tar.bz2
git-prompt-6adfbbd669b812fac340f84d7e12e6c49c1c790c.zip
file list composition refactored
-rwxr-xr-xprompt13
1 files changed, 10 insertions, 3 deletions
diff --git a/prompt b/prompt
index 7b4a5dd..92d7266 100755
--- a/prompt
+++ b/prompt
@@ -321,6 +321,7 @@ PROMPT_COMMAND='
# at least one should be set
: ${status?prompt internal error: git status}
eval git_color="\${git_$status}"
+ git_color=${git_color:-$WHITE}
### head
head=`git-name-rev --name-only HEAD 2>/dev/null`
@@ -328,14 +329,20 @@ PROMPT_COMMAND='
head_rev=${head_rev:0:6}
### compose local label
- [[ $clean == "clean" ]] || sep=":"
- tail_local="($head $white$head_rev${op+ / $op}$git_color)$sep$git_added$git_added_files$git_modified$git_modified_files$git_untracked$git_untracked_files$git_color"
+
+ unset file_list
+ file_list+="${git_added_files+$git_added$git_added_files }"
+ file_list+="${git_modified_files+$git_modified$git_modified_files }"
+ file_list+="${git_untracked_files+$git_untracked$git_untracked_files }"
+ [[ $file_list ]] && file_list=":${file_list}" # ${+ does not works (?)
+
+ tail_local="($head $white$head_rev${op+ / $op}$git_color)${file_list}"
### fringes (added depended on location)
head_local="${head_local+$git_color $head_local\n}"
tail_local="${tail_local+$git_color $tail_local}${dir_color}"
- unset branch status git_color clean added modified untracked sep
+ unset branch status git_color clean added modified untracked sep file_list
unset git_modified_files
unset git_untracked_files
unset git_added_files