Backported the new way of counting stashed files and the printf function to speed it up

master
oGre 10 years ago
parent 09c98facb6
commit 50ee0e5fc9
  1. 25
      gitstatus_pre-1.7.10.sh

@ -39,10 +39,15 @@ num_changed=$(( `all_lines "$gitstatus"` - `count_lines "$gitstatus" U` ))
num_conflicts=`count_lines "$staged_files" U` num_conflicts=`count_lines "$staged_files" U`
num_staged=$(( `all_lines "$staged_files"` - num_conflicts )) num_staged=$(( `all_lines "$staged_files"` - num_conflicts ))
num_untracked=`git ls-files --others --exclude-standard $(git rev-parse --show-cdup) | wc -l` num_untracked=`git ls-files --others --exclude-standard $(git rev-parse --show-cdup) | wc -l`
if [[ "$__GIT_PROMPT_IGNORE_STASH" = "1" ]]; then
num_stashed=0 num_stashed=0
else if [[ "$__GIT_PROMPT_IGNORE_STASH" != "1" ]]; then
num_stashed=`git stash list | wc -l` stash_file="$( git rev-parse --git-dir )/logs/refs/stash"
if [[ -e "${stash_file}" ]]; then
while IFS='' read -r wcline || [[ -n "$wcline" ]]; do
((num_stashed++))
done < ${stash_file}
fi
fi fi
clean=0 clean=0
@ -105,8 +110,14 @@ if [[ "$has_remote_tracking" == "0" ]] ; then
remote='_NO_REMOTE_TRACKING_' remote='_NO_REMOTE_TRACKING_'
fi fi
for w in "$branch" "$remote" $num_staged $num_conflicts $num_changed $num_untracked $num_stashed $clean ; do printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
echo "$w" "$branch" \
done "$remote" \
$num_staged \
$num_conflicts \
$num_changed \
$num_untracked \
$num_stashed \
$clean
exit exit

Loading…
Cancel
Save