git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-parse-remote: fix ambiguous shell bug in expand_refs_wildcard
@ 2006-12-18  8:09 Jeff King
  2006-12-18  8:16 ` Jeff King
       [not found] ` <7v4prtx9hu.fsf@assigned-by-dhcp.cox.net>
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff King @ 2006-12-18  8:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Bash and dash parse "${name%'^{}'}" differently, with bash quoting the
^{}, and dash assuming the first } is the end of the variable (and thus
tacking '} to the end). Instead, use backslash to quote the closing
brace.

Signed-off-by: Jeff King <peff@peff.net>
---
Please sanity check that I understand what the code is supposed to be
doing. The bug I was getting was this:

$ readlink /bin/sh
dash
$ git-clone git://git.kernel.org/pub/scm/git/git.git
[...]
$ cd git && git-pull
Warning: No merge candidate found because value of config option
         "branch.master.merge" does not match any remote branch fetched.

A shell trace showed lots of tests against strings like
"refs/heads/master'}". Expand_refs_wildcard returned no entries, so it
couldn't match the branch.master.merge field.

 git-parse-remote.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index f27c3c2..ab79042 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -116,7 +116,7 @@ expand_refs_wildcard () {
 			while read sha1 name
 			do
 				mapped=${name#"$from"}
-				if test "z$name" != "z${name%'^{}'}" ||
+				if test "z$name" != "z${name%'^{\}'}" ||
 					test "z$name" = "z$mapped"
 				then
 					continue
-- 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-07  8:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-18  8:09 [PATCH] git-parse-remote: fix ambiguous shell bug in expand_refs_wildcard Jeff King
2006-12-18  8:16 ` Jeff King
     [not found] ` <7v4prtx9hu.fsf@assigned-by-dhcp.cox.net>
2006-12-18 22:45   ` Jeff King
2006-12-19  0:35     ` Herbert Xu
2007-05-05  8:03       ` Herbert Xu
2007-05-07  6:36         ` Jeff King
2007-05-07  8:01           ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).