aboutsummaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-04-07 10:23:06 -0700
committerJunio C Hamano <gitster@pobox.com>2017-04-16 20:09:36 -0700
commitcf9e55f49438d07dd554c5ade92f1c266363af36 (patch)
tree740370f17314a958359b2606562ab28153517dea /git-submodule.sh
parentcf11a67975b057a144618badf16dc4e3d25b9407 (diff)
downloadgit-cf9e55f49438d07dd554c5ade92f1c266363af36.tar.gz
git-cf9e55f49438d07dd554c5ade92f1c266363af36.tar.xz
submodule: prevent backslash expantion in submodule names
When attempting to add a submodule with backslashes in its name 'git submodule' fails in a funny way. We can see that some of the backslashes are expanded resulting in a bogus path: git -C main submodule add ../sub\\with\\backslash fatal: repository '/tmp/test/sub\witackslash' does not exist fatal: clone of '/tmp/test/sub\witackslash' into submodule path To solve this, convert calls to 'read' to 'read -r' in git-submodule.sh in order to prevent backslash expantion in submodule names. Reported-by: Joachim Durchholz <jo@durchholz.org> Signed-off-by: Brandon Williams <bmwill@google.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 6ec35e5fc..c0d0e9a4c 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -332,7 +332,7 @@ cmd_foreach()
git submodule--helper list --prefix "$wt_prefix" ||
echo "#unmatched" $?
} |
- while read mode sha1 stage sm_path
+ while read -r mode sha1 stage sm_path
do
die_if_unmatched "$mode" "$sha1"
if test -e "$sm_path"/.git
@@ -441,7 +441,7 @@ cmd_deinit()
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched" $?
} |
- while read mode sha1 stage sm_path
+ while read -r mode sha1 stage sm_path
do
die_if_unmatched "$mode" "$sha1"
name=$(git submodule--helper name "$sm_path") || exit
@@ -605,7 +605,7 @@ cmd_update()
"$@" || echo "#unmatched" $?
} | {
err=
- while read mode sha1 stage just_cloned sm_path
+ while read -r mode sha1 stage just_cloned sm_path
do
die_if_unmatched "$mode" "$sha1"
@@ -847,7 +847,7 @@ cmd_summary() {
# Get modified modules cared by user
modules=$(git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- "$@" |
sane_egrep '^:([0-7]* )?160000' |
- while read mod_src mod_dst sha1_src sha1_dst status sm_path
+ while read -r mod_src mod_dst sha1_src sha1_dst status sm_path
do
# Always show modules deleted or type-changed (blob<->module)
if test "$status" = D || test "$status" = T
@@ -873,7 +873,7 @@ cmd_summary() {
git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- $modules |
sane_egrep '^:([0-7]* )?160000' |
cut -c2- |
- while read mod_src mod_dst sha1_src sha1_dst status name
+ while read -r mod_src mod_dst sha1_src sha1_dst status name
do
if test -z "$cached" &&
test $sha1_dst = 0000000000000000000000000000000000000000
@@ -1020,7 +1020,7 @@ cmd_status()
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched" $?
} |
- while read mode sha1 stage sm_path
+ while read -r mode sha1 stage sm_path
do
die_if_unmatched "$mode" "$sha1"
name=$(git submodule--helper name "$sm_path") || exit
@@ -1100,7 +1100,7 @@ cmd_sync()
git submodule--helper list --prefix "$wt_prefix" "$@" ||
echo "#unmatched" $?
} |
- while read mode sha1 stage sm_path
+ while read -r mode sha1 stage sm_path
do
die_if_unmatched "$mode" "$sha1"