Skip to content

Commit

Permalink
parse_git_status: recognise "Changes not staged for commit"
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
tiborsimko authored and lvv committed May 12, 2011
1 parent a84b534 commit 286e406
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions git-prompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 286e406

Please sign in to comment.