X-Git-Url: https://git.tokkee.org/?p=git.git;a=blobdiff_plain;f=t%2Ft7503-pre-commit-hook.sh;fp=t%2Ft7503-pre-commit-hook.sh;h=984889b39d3f8e9941a2aadc8cec833fe42176a2;hp=ee7f0cd4596f982f16cbf3859675e6faba424faa;hb=9eefd8ae8a955f470d931c13b8711d98f4e9d56e;hpb=47de6b0425c79081e64756dcc019bb26344bf7ad diff --git a/t/t7503-pre-commit-hook.sh b/t/t7503-pre-commit-hook.sh index ee7f0cd45..984889b39 100755 --- a/t/t7503-pre-commit-hook.sh +++ b/t/t7503-pre-commit-hook.sh @@ -118,4 +118,22 @@ test_expect_success 'with failing hook requiring GIT_PREFIX' ' git checkout -- file ' +test_expect_success 'check the author in hook' ' + write_script "$HOOK" <<-\EOF && + test "$GIT_AUTHOR_NAME" = "New Author" && + test "$GIT_AUTHOR_EMAIL" = "newauthor@example.com" + EOF + test_must_fail git commit --allow-empty -m "by a.u.thor" && + ( + GIT_AUTHOR_NAME="New Author" && + GIT_AUTHOR_EMAIL="newauthor@example.com" && + export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL && + git commit --allow-empty -m "by new.author via env" && + git show -s + ) && + git commit --author="New Author " \ + --allow-empty -m "by new.author via command line" && + git show -s +' + test_done