summaryrefslogtreecommitdiff
path: root/prompt
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 12:39:07 +0300
commit6f04a2d02d0e304627d3f5d9e834e0d4b9c524ef (patch)
treeff1bf5f21389ff8cf425d3e8821aba55864920b5 /prompt
parentalso added raw head disp (diff)
downloadgit-prompt-6f04a2d02d0e304627d3f5d9e834e0d4b9c524ef.tar.gz
git-prompt-6f04a2d02d0e304627d3f5d9e834e0d4b9c524ef.tar.bz2
git-prompt-6f04a2d02d0e304627d3f5d9e834e0d4b9c524ef.zip
file list composition refactored
Diffstat (limited to 'prompt')
-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