summaryrefslogtreecommitdiff
path: root/t/t4204-patch-id.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-05-23 22:23:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-05-24 22:49:02 (GMT)
commit5c63920190b38f4ea92d5b0104d3697a34f5f2b3 (patch)
treed0622ccd27cfcc8f6c6d51fc37ca3fb9c8c98796 /t/t4204-patch-id.sh
parent3a0f269e7c82aa3a87323cb7ae04ac5f129f036b (diff)
downloadgit-5c63920190b38f4ea92d5b0104d3697a34f5f2b3.zip
git-5c63920190b38f4ea92d5b0104d3697a34f5f2b3.tar.gz
git-5c63920190b38f4ea92d5b0104d3697a34f5f2b3.tar.bz2
t4204: do not let $name variable clobbered
test_patch_id_file_order shell function uses $name variable to hold one filename, and calls another shell function calc_patch_id as a downstream of one pipeline. The called function, however, also uses the same $name variable. With a shell implementation that runs the callee in the current shell environment, the caller's $name would be clobbered by the callee's use of the same variable. This hasn't been an issue with dash and bash. ksh93 reveals the breakage in the test script. Fix it by using a distinct variable name in the callee. Reported-by: Armin Kunaschik <megabreit@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4204-patch-id.sh')
-rwxr-xr-xt/t4204-patch-id.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/t/t4204-patch-id.sh b/t/t4204-patch-id.sh
index baa9d3c..84a8096 100755
--- a/t/t4204-patch-id.sh
+++ b/t/t4204-patch-id.sh
@@ -30,11 +30,11 @@ test_expect_success 'patch-id output is well-formed' '
#calculate patch id. Make sure output is not empty.
calc_patch_id () {
- name="$1"
+ patch_name="$1"
shift
git patch-id "$@" |
- sed "s/ .*//" >patch-id_"$name" &&
- test_line_count -gt 0 patch-id_"$name"
+ sed "s/ .*//" >patch-id_"$patch_name" &&
+ test_line_count -gt 0 patch-id_"$patch_name"
}
get_top_diff () {