summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2012-11-30 17:07:35 +0530
committerJunio C Hamano <gitster@pobox.com>2012-12-02 02:02:05 -0800
commit2934975f2df4ab7fd93c0f7a2fff80414d090547 (patch)
treea8fcc0e0c403de2e0293d716c9b0541e0760efa7 /t
parent20fa53855e5479e9903047ba18cc247fd4519db4 (diff)
downloadgit-2934975f2df4ab7fd93c0f7a2fff80414d090547.tar.gz
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>
Diffstat (limited to 't')
-rwxr-xr-xt/t4041-diff-submodule-option.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 08d549a7b0..de166049c2 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -11,18 +11,18 @@ This test tries to verify the sanity of the --submodule option of git diff.
. ./test-lib.sh
add_file () {
- sm=$1
- shift
- owd=$(pwd)
- cd "$sm"
- for name; do
- echo "$name" > "$name" &&
- git add "$name" &&
- test_tick &&
- git commit -m "Add $name"
- done >/dev/null
- git rev-parse --short --verify HEAD
- cd "$owd"
+ (
+ cd "$1" &&
+ shift &&
+ for name
+ do
+ echo "$name" >"$name" &&
+ git add "$name" &&
+ test_tick &&
+ git commit -m "Add $name" || exit
+ done >/dev/null &&
+ git rev-parse --short --verify HEAD
+ )
}
commit_file () {
test_tick &&