From: Junio C Hamano Date: Fri, 16 Jan 2026 23:45:56 +0000 (-0800) Subject: Merge branch 'dd/t5403-modernise' into jch X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60369bdcde38fd65991024a51673ea77b34f6607;p=thirdparty%2Fgit.git Merge branch 'dd/t5403-modernise' into jch Test clean-up. * dd/t5403-modernise: t5403: use test_cmp for post-checkout argument checks t5403: introduce check_post_checkout helper function --- 60369bdcde38fd65991024a51673ea77b34f6607 diff --cc t/t5403-post-checkout-hook.sh index 1462e3365b,53d97df070..cb0300b2d2 --- a/t/t5403-post-checkout-hook.sh +++ b/t/t5403-post-checkout-hook.sh @@@ -7,11 -7,23 +7,22 @@@ test_description='Test the post-checkou GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh + # Usage: check_post_checkout + # + # Verify that the post-checkout hook arguments in match the expected + # values: for the previous HEAD, for the new HEAD, and + # indicating whether this was a branch checkout (1) or file checkout (0). + check_post_checkout () { + test "$#" = 4 || BUG "check_post_checkout takes 4 args" + echo "old=$2 new=$3 flag=$4" >expect && + test_cmp expect "$1" + } + test_expect_success setup ' test_hook --setup post-checkout <<-\EOF && - echo "$@" >.git/post-checkout.args + echo "old=$1 new=$2 flag=$3" >.git/post-checkout.args EOF test_commit one && test_commit two &&