Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'ra/prompt-eread-fix'
author
Junio C Hamano
<gitster@pobox.com>
Thu, 28 Dec 2017 22:08:45 +0000
(14:08 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 28 Dec 2017 22:08:45 +0000
(14:08 -0800)
Update the shell prompt script (in contrib/) to strip trailing CR
from strings read from various "state" files.
* ra/prompt-eread-fix:
git-prompt: fix reading files with windows line endings
git-prompt: make __git_eread intended use explicit
contrib/completion/git-prompt.sh
patch
|
blob
|
history
raw
(from parent 1:
1f24cad
)
diff --git
a/contrib/completion/git-prompt.sh
b/contrib/completion/git-prompt.sh
index c6cbef38c2a580555dfcdc67e04f6ac507f9066c..983e419d2b7eda8f191a878a395179dcc24eb949 100644
(file)
--- a/
contrib/completion/git-prompt.sh
+++ b/
contrib/completion/git-prompt.sh
@@
-278,11
+278,12
@@
__git_ps1_colorize_gitstring ()
r="$c_clear$r"
}
+# Helper function to read the first line of a file into a variable.
+# __git_eread requires 2 arguments, the file path and the name of the
+# variable, in that order.
__git_eread ()
{
- local f="$1"
- shift
- test -r "$f" && read "$@" <"$f"
+ test -r "$1" && IFS=$'\r\n' read "$2" <"$1"
}
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)