提交 ea10b60c 编写于 作者: B Ben Jackson 提交者: Junio C Hamano

Work around ash "alternate value" expansion bug

Ash (used as /bin/sh on many distros) has a shell expansion bug
for the form ${var:+word word}.  The result is a single argument
"word word".  Work around by using ${var:+word} ${var:+word} or
equivalent.
Signed-off-by: NBen Jackson <ben@ben.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 77b96d6d
......@@ -571,7 +571,7 @@ do
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
export GIT_COMMITTER_DATE
fi &&
git commit-tree $tree ${parent:+-p $parent} <"$dotest/final-commit"
git commit-tree $tree ${parent:+-p} $parent <"$dotest/final-commit"
) &&
git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent ||
stop_here $this
......
......@@ -204,8 +204,15 @@ cmd_add()
else
module_clone "$path" "$realrepo" || exit
(unset GIT_DIR; cd "$path" && git checkout -f -q ${branch:+-b "$branch" "origin/$branch"}) ||
die "Unable to checkout submodule '$path'"
(
unset GIT_DIR
cd "$path" &&
# ash fails to wordsplit ${branch:+-b "$branch"...}
case "$branch" in
'') git checkout -f -q ;;
?*) git checkout -f -q -b "$branch" "origin/$branch" ;;
esac
) || die "Unable to checkout submodule '$path'"
fi
git add "$path" ||
......
......@@ -64,6 +64,16 @@ test_expect_success 'submodule add' '
)
'
test_expect_success 'submodule add --branch' '
(
cd addtest &&
git submodule add -b initial "$submodurl" submod-branch &&
git submodule init &&
cd submod-branch &&
git branch | grep initial
)
'
test_expect_success 'submodule add with ./ in path' '
(
cd addtest &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册