Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Ridd <chris.ridd@isode.com>2008-06-11 17:09:19 +0400
committerJunio C Hamano <gitster@pobox.com>2008-06-13 09:20:18 +0400
commitfe22e5420ee547bac58481ed1a868f4cd39ad128 (patch)
treef18c3d179ec5a8a90ed2569ffa5033880d99e24b
parent4209752da5a2e327e470493618931a7abbf0a381 (diff)
Improve sed portability
The behaviour of "sed" on an incomplete line is unspecified by POSIX, and On Solaris it apparently fails to process input that doesn't end in a LF. Consequently constructs like re=$(printf '%s' foo | sed -e 's/bar/BAR/g' $) cause re to be set to the empty string. Such a construct is used in git-submodule.sh. Because the LF at the end of command output are stripped away by the command substitution, it is a safe and sane change to add a LF at the end of the printf format specifier. Signed-off-by: Chris Ridd <chris.ridd@isode.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xgit-submodule.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 100737210d..4032830907 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -73,7 +73,7 @@ resolve_relative_url ()
module_name()
{
# Do we have "submodule.<something>.path = $1" defined in .gitmodules file?
- re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
+ re=$(printf '%s\n' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
test -z "$name" &&