Skip to content

Commit 46b0585

Browse files
rwegitster
authored andcommitted
completion: fix incorrect bash/zsh string equality check
In the basic `[`/`test` command, the string equality operator is a single `=`. The `==` operator is only available in `[[`, which is a bash-ism also supported by zsh. This mix-up was causing the following completion error in zsh: > __git_ls_files_helper:7: = not found (That message refers to the extraneous symbol in `==` ← `=`). This updates that comparison to use a single `=` inside the basic `[ … ]` test conditional. Although this fix is inconsistent with the other comparisons in this file, which use `[[ … == … ]]`, and the two expressions are functionally identical in this context, that approach was rejected due to a preference for `[`. Signed-off-by: Robert Estelle <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent af6d1d6 commit 46b0585

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ __gitcomp_file ()
515515
# argument, and using the options specified in the second argument.
516516
__git_ls_files_helper ()
517517
{
518-
if [ "$2" == "--committable" ]; then
518+
if [ "$2" = "--committable" ]; then
519519
__git -C "$1" -c core.quotePath=false diff-index \
520520
--name-only --relative HEAD -- "${3//\\/\\\\}*"
521521
else

0 commit comments

Comments
 (0)