author | Ted Pavlic <ted@tedpavlic.com> | |
Thu, 15 Jan 2009 16:02:21 +0000 (11:02 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 15 Jan 2009 17:33:26 +0000 (09:33 -0800) | ||
commit | 25a31f814016891c7728fdebca056ef47ca75547 | |
tree | 8bc93c48f7f6a1f51b5ffb8079ae887f978857bf | tree | snapshot |
parent | b32acd21d81ac792cf28d487b960a2f6bb0ef0e2 | commit | diff |
bash-completion: Support running when set -u is enabled
Under "set -u" semantics, it is an error to access undefined variables.
Some user environments may enable this setting in the interactive shell.
In any context where the completion functions access an undefined
variable, accessing a default empty string (aka "${1-}" instead of "$1")
is a reasonable way to code the function, as it silences the undefined
variable error while still supplying an empty string.
In this patch, functions that should always take an argument still use
$1. Functions that have optional arguments use ${1-}.
Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Under "set -u" semantics, it is an error to access undefined variables.
Some user environments may enable this setting in the interactive shell.
In any context where the completion functions access an undefined
variable, accessing a default empty string (aka "${1-}" instead of "$1")
is a reasonable way to code the function, as it silences the undefined
variable error while still supplying an empty string.
In this patch, functions that should always take an argument still use
$1. Functions that have optional arguments use ${1-}.
Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash | diff | blob | history |