diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-04-26 10:34:53 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-26 10:34:53 -0700 |
commit | 695db86ad73cc3c1dca43fb60cdf469f8d26e358 (patch) | |
tree | e0a3c3a1598564fc473864ef9a8d074a693a05ca /t | |
parent | Merge branch 'tr/maint-word-diff-regex-sticky' into maint (diff) | |
parent | commit: pass author/committer info to hooks (diff) | |
download | tgif-695db86ad73cc3c1dca43fb60cdf469f8d26e358.tar.xz |
Merge branch 'jc/commit-hook-authorship' into maint
"git commit --author=$name" did not tell the name that was being
recorded in the resulting commit to hooks, even though it does do so
when the end user overrode the authorship via the "GIT_AUTHOR_NAME"
environment variable.
* jc/commit-hook-authorship:
commit: pass author/committer info to hooks
t7503: does pre-commit-hook learn authorship?
ident.c: add split_ident_line() to parse formatted ident line
Diffstat (limited to 't')
-rwxr-xr-x | t/t7503-pre-commit-hook.sh | 18 |
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 |