Diff
1diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh
2index 7b732d2aeba0e3bca3b42d28f2f8f5730a08ccee..54489080f8ae25a4483cd4bae076942f47f53031 100644
3--- a/plugins/gitfast/git-prompt.sh
4+++ b/plugins/gitfast/git-prompt.sh
5@@ -259,6 +259,13 @@ __git_ps1_colorize_gitstring ()
6 r="$c_clear$r"
7 }
8
9+eread ()
10+{
11+ f="$1"
12+ shift
13+ test -r "$f" && read "$@" <"$f"
14+}
15+
16 # __git_ps1 accepts 0 or 1 arguments (i.e., format string)
17 # when called from PS1 using command substitution
18 # in this mode it prints text to add to bash PS1 prompt (includes branch name)
19@@ -321,9 +328,9 @@ __git_ps1 ()
20 local step=""
21 local total=""
22 if [ -d "$g/rebase-merge" ]; then
23- read b 2>/dev/null <"$g/rebase-merge/head-name"
24- read step 2>/dev/null <"$g/rebase-merge/msgnum"
25- read total 2>/dev/null <"$g/rebase-merge/end"
26+ eread "$g/rebase-merge/head-name" b
27+ eread "$g/rebase-merge/msgnum" step
28+ eread "$g/rebase-merge/end" total
29 if [ -f "$g/rebase-merge/interactive" ]; then
30 r="|REBASE-i"
31 else
32@@ -331,10 +338,10 @@ __git_ps1 ()
33 fi
34 else
35 if [ -d "$g/rebase-apply" ]; then
36- read step 2>/dev/null <"$g/rebase-apply/next"
37- read total 2>/dev/null <"$g/rebase-apply/last"
38+ eread "$g/rebase-apply/next" step
39+ eread "$g/rebase-apply/last" total
40 if [ -f "$g/rebase-apply/rebasing" ]; then
41- read b 2>/dev/null <"$g/rebase-apply/head-name"
42+ eread "$g/rebase-apply/head-name" b
43 r="|REBASE"
44 elif [ -f "$g/rebase-apply/applying" ]; then
45 r="|AM"
46@@ -358,7 +365,7 @@ __git_ps1 ()
47 b="$(git symbolic-ref HEAD 2>/dev/null)"
48 else
49 local head=""
50- if ! read head 2>/dev/null <"$g/HEAD"; then
51+ if ! eread "$g/HEAD" head; then
52 if [ $pcmode = yes ]; then
53 PS1="$ps1pc_start$ps1pc_end"
54 fi