From: Junio C Hamano Date: Wed, 12 Mar 2008 22:41:03 GMT Subject: Re: [PATCH 12/16] git-submodule: avoid sed input with no newline Message-ID: <7vabl34lc0.fsf@gitster.siamese.dyndns.org> In-Reply-To: <20080312214044.GM26286@coredump.intra.peff.net> Jeff King writes: > Some versions of sed don't like this, and give no output at > all. Instead, we can use git-config to pare down the matches > for us. Good use of --literal. But doesn't this make you wonder if "--literal-match --get-regexp" is quite a strange combination? "Literal" covers the value part but the key is still regexp (and we do want it to behave that way). However, maybe we would want to also allow "give entries whose key is this literal key and whose value matches this regexp"? > + name=$(git config --literal-match -f .gitmodules \ > + --get-regexp 'submodule\..*\.path$' "$1" | > + sed -e 's/submodule\.//' -e 's/\.path.*//') > + test -z "$name" && > + die "No submodule mapping found in .gitmodules for path '$path'" > + echo "$name" > }