diff options
| author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2024-08-20 01:48:26 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-08-20 08:28:17 -0700 |
| commit | 6df4b091597bf1ea8ed674eb2839d70fda4ea4c4 (patch) | |
| tree | 258586ed7c575428056745025d9f8d0286da0c2f | |
| parent | git-prompt: use here-doc instead of here-string (diff) | |
| download | git-6df4b091597bf1ea8ed674eb2839d70fda4ea4c4.tar.gz git-6df4b091597bf1ea8ed674eb2839d70fda4ea4c4.zip | |
git-prompt: fix uninitialized variable
First use is in the form: local var; ...; var=$var$whatever...
If the variable was unset (as bash and others do after "local x"),
then it would error if set -u is in effect.
Also, many shells inherit the existing value after "local var"
without init, but in this case it's unlikely to have a prior value.
Now we initialize it.
(local var= is enough, but local var="" is the custom in this file)
Signed-off-by: Avi Halachmi (:avih) <avihpit@yahoo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | contrib/completion/git-prompt.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh index ebf2e30d68..4cc2cf91bb 100644 --- a/contrib/completion/git-prompt.sh +++ b/contrib/completion/git-prompt.sh @@ -116,7 +116,7 @@ printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1 __git_ps1_show_upstream () { local key value - local svn_remote svn_url_pattern count n + local svn_remote svn_url_pattern="" count n local upstream_type=git legacy="" verbose="" name="" svn_remote=() |
