Re: [PATCH 12/16] git-submodule: avoid sed input with no newline
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 12, 2008, 22:41 UTC
- Message-ID
- <7vabl34lc0.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20080312214044.GM26286@coredump.intra.peff.net>
Jeff King <peff@peff.net> 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"?
Show 7 quoted lines
> + 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" > }