diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2024-08-20 01:48:28 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-20 08:28:18 -0700 |
commit | fe445a1026562dfeb4fa1b0ee93bdfe3b7422251 (patch) | |
tree | cb215d239eafc4249124b7e328911b0c8504b151 /builtin/commit.c | |
parent | f2e264e43f6065e05ed7c53395ed167fc33eea2a (diff) |
git-prompt: replace [[...]] with standard code
The existing [[...]] tests were either already valid as standard [...]
tests, or only required minimal retouch:
Notes:
- [[...]] doesn't do field splitting and glob expansion, so $var
or $(cmd...) don't need quoting, but [... does need quotes.
- [[ X == Y ]] when Y is a string is same as [ X = Y ], but if Y is
a pattern, then we need: case X in Y)... ; esac .
- [[ ... && ... ]] was replaced with [ ... ] && [ ... ] .
- [[ -o <zsh-option> ]] requires [[...]], so put it in "eval" and only
eval it in zsh, so other shells would not abort on syntax error
(posix says [[ has unspecified results, shells allowed to reject it)
- ((x++)) was changed into x=$((x+1)) (yeah, not [[...]] ...)
Shells which accepted the previous forms:
- bash, zsh, ksh93, mksh, openbsd sh, pdksh.
Shells which didn't, and now can process it:
- dash, free/net bsd sh, busybox-ash, Schily Bourne sh, yash.
Signed-off-by: Avi Halachmi (:avih) <avihpit@yahoo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions