summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Simko <tibor.simko@cern.ch>2011-05-13 03:38:31 +0800
committerLeonid Volnitsky <leonid@volnitsky.com>2011-05-13 04:49:09 +0800
commit286e406f2c5e7e098efdd45c9df1ddfb2ba6b404 (patch)
treedfacfc88afe9a3d752afcc14b5b98c74bf717917
parentfixed: autojump was selecting oldest (not most recent) dirs (diff)
downloadgit-prompt-286e406f2c5e7e098efdd45c9df1ddfb2ba6b404.tar.gz
git-prompt-286e406f2c5e7e098efdd45c9df1ddfb2ba6b404.tar.bz2
git-prompt-286e406f2c5e7e098efdd45c9df1ddfb2ba6b404.zip
parse_git_status: recognise "Changes not staged for commit"
Recognise "Changes not staged for commit" section when parsing git status. This fixes the display of modified but unstaged files in the prompt when using git v1.7 (e.g. Debian Wheezy).
-rwxr-xr-xgit-prompt.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/git-prompt.sh b/git-prompt.sh
index 6d000ba..559e3c3 100755
--- a/git-prompt.sh
+++ b/git-prompt.sh
@@ -444,6 +444,12 @@ parse_git_status() {
s/^# unmerged: '"$file_regex"'/ [[ \" ${modified_files[*]} \" =~ \" \1 \" ]] || modified_files[${#modified_files[@]}]=\"\1\"/p
}
+ /^# Changes not staged for commit:/,/^# [A-Z]/ {
+ s/^# Changes not staged for commit:/modified=modified;/p
+ s/^# modified: '"$file_regex"'/ [[ \" ${modified_files[*]} \" =~ \" \1 \" ]] || modified_files[${#modified_files[@]}]=\"\1\"/p
+ s/^# unmerged: '"$file_regex"'/ [[ \" ${modified_files[*]} \" =~ \" \1 \" ]] || modified_files[${#modified_files[@]}]=\"\1\"/p
+ }
+
/^# Untracked files:/,/^[^#]/{
s/^# Untracked files:/untracked=untracked;/p
s/^# '"$file_regex"'/ [[ \" ${untracked_files[*]} ${modified_files[*]} ${added_files[*]} \" =~ \" \1 \" ]] || untracked_files[${#untracked_files[@]}]=\"\1\"/p