1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 13:58:00 +00:00

git-info: use tab as separator for splitting ahead_and_behind (#902)

The current implementation is not tamper-proof against a modified IFS. See discussion in https://github.com/sorin-ionescu/prezto/pull/902 for details.
This commit is contained in:
Zhiming Wang 2020-06-30 01:26:36 +08:00 committed by GitHub
parent 2d3763380c
commit a132c1007a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,7 +275,7 @@ function git-info {
# Format ahead. # Format ahead.
if [[ -n "$ahead_format" ]]; then if [[ -n "$ahead_format" ]]; then
ahead="$ahead_and_behind[(w)1]" ahead="$ahead_and_behind[(pws:\t:)1]"
if (( ahead > 0 )); then if (( ahead > 0 )); then
zformat -f ahead_formatted "$ahead_format" "A:$ahead" zformat -f ahead_formatted "$ahead_format" "A:$ahead"
fi fi
@ -283,7 +283,7 @@ function git-info {
# Format behind. # Format behind.
if [[ -n "$behind_format" ]]; then if [[ -n "$behind_format" ]]; then
behind="$ahead_and_behind[(w)2]" behind="$ahead_and_behind[(pws:\t:)2]"
if (( behind > 0 )); then if (( behind > 0 )); then
zformat -f behind_formatted "$behind_format" "B:$behind" zformat -f behind_formatted "$behind_format" "B:$behind"
fi fi