mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
Merge branch 'ra/prompt-eread-fix'
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
This commit is contained in:
commit
5abbdbbd9b
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user