summaryrefslogtreecommitdiff
path: root/t/t7503-pre-commit-hook.sh
diff options
context:
space:
mode:
authorLibravatar Jiang Xin <worldhello.net@gmail.com>2012-04-28 15:54:37 +0800
committerLibravatar Jiang Xin <worldhello.net@gmail.com>2012-04-28 15:54:37 +0800
commit69c835701b507e336fd5354f9f3b05e42d20c07d (patch)
treecc6b079231ddc1ab3e04654cbdf8937ef0d6632b /t/t7503-pre-commit-hook.sh
parentl10n: Add the German translation team and initialize de.po (diff)
parentThe sixth batch of topics graduated to 'master' (diff)
downloadtgif-69c835701b507e336fd5354f9f3b05e42d20c07d.tar.xz
Merge master branch for tracking l10n updates of next release
Use master branch to track l10n updates for git next release, while use maint branch to track l10n updates for git stable version.
Diffstat (limited to 't/t7503-pre-commit-hook.sh')
-rwxr-xr-xt/t7503-pre-commit-hook.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t7503-pre-commit-hook.sh b/t/t7503-pre-commit-hook.sh
index ee7f0cd459..984889b39d 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 <newauthor@example.com>" \
+ --allow-empty -m "by new.author via command line" &&
+ git show -s
+'
+
test_done