Subject: Re: [PATCH 12/16] git-submodule: avoid sed input with no newline

From: Junio C Hamano <[email-masked]>
Date: Wed, 12 Mar 2008 15:41:03 -0700

Jeff King <[email-masked]> 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"
>  }