@matheusbsbs / matheus-bagliano / commits / a5c4f85b16
Fork 0

bash: Properly quote the GIT_DIR at all times to fix subdirectory paths with spaces

Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Kevin Ballard committed Mar 8, 2008 at 22:10 UTC a5c4f85b1685aeb01f4dac88075f465c71a6c82d
1 file changed +4 -4
contrib/completion/git-completion.bash
+4 -4
@@ -83,17 +83,17 @@ __git_ps1 ()
83 elif [ -f "$g/.dotest-merge/interactive" ]
84 then
85 r="|REBASE-i"
86 - b="$(cat $g/.dotest-merge/head-name)"
86 + b="$(cat "$g/.dotest-merge/head-name")"
87 elif [ -d "$g/.dotest-merge" ]
88 then
89 r="|REBASE-m"
90 - b="$(cat $g/.dotest-merge/head-name)"
90 + b="$(cat "$g/.dotest-merge/head-name")"
91 elif [ -f "$g/MERGE_HEAD" ]
92 then
93 r="|MERGING"
94 b="$(git symbolic-ref HEAD 2>/dev/null)"
95 else
96 - if [ -f $g/BISECT_LOG ]
96 + if [ -f "$g/BISECT_LOG" ]
97 then
98 r="|BISECTING"
99 fi
@@ -101,7 +101,7 @@ __git_ps1 ()
101 then
102 if ! b="$(git describe --exact-match HEAD 2>/dev/null)"
103 then
104 - b="$(cut -c1-7 $g/HEAD)..."
104 + b="$(cut -c1-7 "$g/HEAD")..."
105 fi
106 fi
107 fi