]> git.ipfire.org Git - thirdparty/git.git/commit
git-prompt: fix uninitialized variable
authorAvi Halachmi (:avih) <avihpit@yahoo.com>
Tue, 20 Aug 2024 01:48:26 +0000 (01:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 20 Aug 2024 15:28:17 +0000 (08:28 -0700)
commit6df4b091597bf1ea8ed674eb2839d70fda4ea4c4
tree258586ed7c575428056745025d9f8d0286da0c2f
parentf037e607a875790dcadbba3f7a8fc185e2877792
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>
contrib/completion/git-prompt.sh