threads / patch / 38174

patchgit-prompt.sh: make $f local to __git_eread()

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

## tl;dr

One message between Dec 12, 2014 and Dec 12, 2014. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

jguenther@gmail.com· Dec 12, 2014, 21:59 UTC · lore
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(-)
Show changes to contrib/completion/git-prompt.sh +1 −1
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

← back to recent threads