git-submodule.sh: avoid "echo" path-like values
SysV-derived implementation of "echo" interprets some backslash sequences as special instruction, e.g. "echo 'ab\c'" shows an incomplete line with 'a' and 'b' on it. Avoid using it when showing a path-like values in the script. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
496eeeb19b
commit
6a0662304d
@ -235,7 +235,7 @@ module_name()
|
|||||||
sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
|
sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
|
||||||
test -z "$name" &&
|
test -z "$name" &&
|
||||||
die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$sm_path'")"
|
die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$sm_path'")"
|
||||||
echo "$name"
|
printf '%s\n' "$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -305,10 +305,10 @@ module_clone()
|
|||||||
b=${b%/}
|
b=${b%/}
|
||||||
|
|
||||||
# Turn each leading "*/" component into "../"
|
# Turn each leading "*/" component into "../"
|
||||||
rel=$(echo $b | sed -e 's|[^/][^/]*|..|g')
|
rel=$(printf '%s\n' "$b" | sed -e 's|[^/][^/]*|..|g')
|
||||||
echo "gitdir: $rel/$a" >"$sm_path/.git"
|
printf '%s\n' "gitdir: $rel/$a" >"$sm_path/.git"
|
||||||
|
|
||||||
rel=$(echo $a | sed -e 's|[^/][^/]*|..|g')
|
rel=$(printf '%s\n' "$a" | sed -e 's|[^/][^/]*|..|g')
|
||||||
(clear_local_git_env; cd "$sm_path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
|
(clear_local_git_env; cd "$sm_path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +389,7 @@ cmd_add()
|
|||||||
sm_path=$2
|
sm_path=$2
|
||||||
|
|
||||||
if test -z "$sm_path"; then
|
if test -z "$sm_path"; then
|
||||||
sm_path=$(echo "$repo" |
|
sm_path=$(printf '%s\n' "$repo" |
|
||||||
sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
|
sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1058,7 +1058,7 @@ cmd_summary() {
|
|||||||
# Always show modules deleted or type-changed (blob<->module)
|
# Always show modules deleted or type-changed (blob<->module)
|
||||||
if test "$status" = D || test "$status" = T
|
if test "$status" = D || test "$status" = T
|
||||||
then
|
then
|
||||||
echo "$sm_path"
|
printf '%s\n' "$sm_path"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# Respect the ignore setting for --for-status.
|
# Respect the ignore setting for --for-status.
|
||||||
@ -1070,7 +1070,7 @@ cmd_summary() {
|
|||||||
fi
|
fi
|
||||||
# Also show added or modified modules which are checked out
|
# Also show added or modified modules which are checked out
|
||||||
GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
|
GIT_DIR="$sm_path/.git" git-rev-parse --git-dir >/dev/null 2>&1 &&
|
||||||
echo "$sm_path"
|
printf '%s\n' "$sm_path"
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1311,7 +1311,7 @@ cmd_sync()
|
|||||||
./*|../*)
|
./*|../*)
|
||||||
# rewrite foo/bar as ../.. to find path from
|
# rewrite foo/bar as ../.. to find path from
|
||||||
# submodule work tree to superproject work tree
|
# submodule work tree to superproject work tree
|
||||||
up_path="$(echo "$sm_path" | sed "s/[^/][^/]*/../g")" &&
|
up_path="$(printf '%s\n' "$sm_path" | sed "s/[^/][^/]*/../g")" &&
|
||||||
# guarantee a trailing /
|
# guarantee a trailing /
|
||||||
up_path=${up_path%/}/ &&
|
up_path=${up_path%/}/ &&
|
||||||
# path from submodule work tree to submodule origin repo
|
# path from submodule work tree to submodule origin repo
|
||||||
|
Loading…
Reference in New Issue
Block a user