Skip to content

Commit 1cb4937

Browse files
devzero2000gitster
authored andcommitted
git-mergetool.sh: avoid "test <cond> -a/-o <cond>"
The construct is error-prone; "test" being built-in in most modern shells, the reason to avoid "test <cond> && test <cond>" spawning one extra process by using a single "test <cond> -a <cond>" no longer exists. Signed-off-by: Elia Pinto <[email protected]> Reviewed-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c82af12 commit 1cb4937

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git-mergetool.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ checkout_staged_file () {
205205
"$(git checkout-index --temp --stage="$1" "$2" 2>/dev/null)" \
206206
: '\([^ ]*\) ')
207207

208-
if test $? -eq 0 -a -n "$tmpfile"
208+
if test $? -eq 0 && test -n "$tmpfile"
209209
then
210210
mv -- "$(git rev-parse --show-cdup)$tmpfile" "$3"
211211
else
@@ -256,7 +256,7 @@ merge_file () {
256256
checkout_staged_file 2 "$MERGED" "$LOCAL"
257257
checkout_staged_file 3 "$MERGED" "$REMOTE"
258258

259-
if test -z "$local_mode" -o -z "$remote_mode"
259+
if test -z "$local_mode" || test -z "$remote_mode"
260260
then
261261
echo "Deleted merge conflict for '$MERGED':"
262262
describe_file "$local_mode" "local" "$LOCAL"

0 commit comments

Comments
 (0)