mirror of
https://github.com/git/git.git
synced 2024-11-27 12:03:55 +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"
|
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 ()
|
__git_eread ()
|
||||||
{
|
{
|
||||||
local f="$1"
|
test -r "$1" && IFS=$'\r\n' read "$2" <"$1"
|
||||||
shift
|
|
||||||
test -r "$f" && read "$@" <"$f"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
|
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
|
||||||
|
Loading…
Reference in New Issue
Block a user