Skip to content
/ git Public
forked from git/git

Commit

Permalink
t4204: do not let $name variable clobbered
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gitster committed May 24, 2016
1 parent 3a0f269 commit 5c63920
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions t/t4204-patch-id.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 5c63920

Please sign in to comment.