t4041 (diff-submodule-option): rewrite add_file() routine
Instead of "cd there and then come back", use the "cd there in a subshell" pattern. Also fix '&&' chaining in one place. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
20fa53855e
commit
2934975f2d
@ -11,18 +11,18 @@ This test tries to verify the sanity of the --submodule option of git diff.
|
|||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
add_file () {
|
add_file () {
|
||||||
sm=$1
|
(
|
||||||
shift
|
cd "$1" &&
|
||||||
owd=$(pwd)
|
shift &&
|
||||||
cd "$sm"
|
for name
|
||||||
for name; do
|
do
|
||||||
echo "$name" > "$name" &&
|
echo "$name" >"$name" &&
|
||||||
git add "$name" &&
|
git add "$name" &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
git commit -m "Add $name"
|
git commit -m "Add $name" || exit
|
||||||
done >/dev/null
|
done >/dev/null &&
|
||||||
git rev-parse --short --verify HEAD
|
git rev-parse --short --verify HEAD
|
||||||
cd "$owd"
|
)
|
||||||
}
|
}
|
||||||
commit_file () {
|
commit_file () {
|
||||||
test_tick &&
|
test_tick &&
|
||||||
|
Loading…
Reference in New Issue
Block a user