# [PATCH] git-prompt.sh: make $f local to __git_eread()

1 messages from 2014-12-12 to 2014-12-12. Participants: jguenther@gmail.com.
Thread: https://gitlist.dev/t/38174

## jguenther@gmail.com, 2014-12-12 21:59

Subject: [PATCH] git-prompt.sh: make $f local to __git_eread()
Message-ID: <1418421596-7898-1-git-send-email-jguenther@gmail.com>
URL: https://gitlist.dev/e/1418421596-7898-1-git-send-email-jguenther%40gmail.com

```
From: Justin Guenther <jguenther@gmail.com>

This function uses (non-local) $f to store the value of its first parameter.
This can interfere with the user's environment.

Signed-off-by: Justin Guenther <jguenther@gmail.com>
---
 contrib/completion/git-prompt.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index c5473dc..729f769 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -270,7 +270,7 @@ __git_ps1_colorize_gitstring ()
 
 __git_eread ()
 {
-	f="$1"
+	local f="$1"
 	shift
 	test -r "$f" && read "$@" <"$f"
 }
-- 
2.2.0.37.g2035459

```
