diff --git a/refs/files-backend.c b/refs/files-backend.c index 64f51f0da905a9..3b28d1b4fda3fd 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1890,7 +1890,10 @@ static int files_log_ref_write(struct files_ref_store *refs, if (logfd < 0) return 0; result = log_ref_write_fd(logfd, old_oid, new_oid, - git_committer_info(0), msg); + fmt_ident(getenv("GIT_COMMITTER_NAME"), + getenv("GIT_COMMITTER_EMAIL"), + WANT_COMMITTER_IDENT, NULL, 0), + msg); if (result) { struct strbuf sb = STRBUF_INIT; int save_errno = errno; diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index e2316f1dd4c200..b3f03be5595b4f 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -272,19 +272,19 @@ test_expect_success "clean up reflog" ' test_expect_success "create $m (logged by touch)" ' test_config core.logAllRefUpdates false && - GIT_COMMITTER_DATE="2005-05-26 23:30" \ + GIT_TEST_DATE_NOW=1117150200 \ git update-ref --create-reflog HEAD $A -m "Initial Creation" && test $A = $(git show-ref -s --verify $m) ' test_expect_success "update $m (logged by touch)" ' test_config core.logAllRefUpdates false && - GIT_COMMITTER_DATE="2005-05-26 23:31" \ + GIT_TEST_DATE_NOW=1117150260 \ git update-ref HEAD $B $A -m "Switch" && test $B = $(git show-ref -s --verify $m) ' test_expect_success "set $m (logged by touch)" ' test_config core.logAllRefUpdates false && - GIT_COMMITTER_DATE="2005-05-26 23:41" \ + GIT_TEST_DATE_NOW=1117150860 \ git update-ref HEAD $A && test $A = $(git show-ref -s --verify $m) ' @@ -302,19 +302,19 @@ test_expect_success "verifying $m's log (logged by touch)" ' test_expect_success "create $m (logged by config)" ' test_config core.logAllRefUpdates true && - GIT_COMMITTER_DATE="2005-05-26 23:32" \ + GIT_TEST_DATE_NOW=1117150320 \ git update-ref HEAD $A -m "Initial Creation" && test $A = $(git show-ref -s --verify $m) ' test_expect_success "update $m (logged by config)" ' test_config core.logAllRefUpdates true && - GIT_COMMITTER_DATE="2005-05-26 23:33" \ + GIT_TEST_DATE_NOW=1117150380 \ git update-ref HEAD $B $A -m "Switch" && test $B = $(git show-ref -s --verify $m) ' test_expect_success "set $m (logged by config)" ' test_config core.logAllRefUpdates true && - GIT_COMMITTER_DATE="2005-05-26 23:43" \ + GIT_TEST_DATE_NOW=1117150980 \ git update-ref HEAD $A && test $A = $(git show-ref -s --verify $m) ' @@ -445,24 +445,24 @@ test_expect_success 'query reflog with gap' ' test_expect_success 'creating initial files' ' test_when_finished rm -f M && + test_tick && echo TEST >F && git add F && - GIT_AUTHOR_DATE="2005-05-26 23:30" \ - GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a && + GIT_TEST_DATE_NOW=1117150200 git commit -m add -a && + test_tick && h_TEST=$(git rev-parse --verify HEAD) && echo The other day this did not work. >M && echo And then Bob told me how to fix it. >>M && echo OTHER >F && - GIT_AUTHOR_DATE="2005-05-26 23:41" \ - GIT_COMMITTER_DATE="2005-05-26 23:41" git commit -F M -a && + GIT_TEST_DATE_NOW=1117150860 git commit -F M -a && + test_tick && h_OTHER=$(git rev-parse --verify HEAD) && - GIT_AUTHOR_DATE="2005-05-26 23:44" \ - GIT_COMMITTER_DATE="2005-05-26 23:44" git commit --amend && + GIT_TEST_DATE_NOW=1117151040 git commit --amend && + test_tick && h_FIXED=$(git rev-parse --verify HEAD) && echo Merged initial commit and a later commit. >M && echo $h_TEST >.git/MERGE_HEAD && - GIT_AUTHOR_DATE="2005-05-26 23:45" \ - GIT_COMMITTER_DATE="2005-05-26 23:45" git commit -F M && + GIT_TEST_DATE_NOW=1117151100 git commit -F M && h_MERGED=$(git rev-parse --verify HEAD) ' diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh index 975c4ea83a877b..c8fb45423657f8 100755 --- a/t/t1411-reflog-show.sh +++ b/t/t1411-reflog-show.sh @@ -7,10 +7,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./test-lib.sh test_expect_success 'setup' ' - echo content >file && - git add file && - test_tick && - git commit -m one + test_commit one file content ' commit=$(git rev-parse --short HEAD) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 78e054ab503a65..35aa16663ea395 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -397,21 +397,24 @@ test_commit () { then test_tick fi && - git ${indir:+ -C "$indir"} commit \ + GIT_TEST_DATE_NOW=$test_tick TZ=PDT+7 \ + git ${indir:+ -C "$indir"} commit \ ${author:+ --author "$author"} \ $signoff -m "$1" && case "$tag" in none) ;; light) - git ${indir:+ -C "$indir"} tag "${4:-$1}" + GIT_TEST_DATE_NOW=$test_tick TZ=PDT+7 \ + git ${indir:+ -C "$indir"} tag "${4:-$1}" ;; annotate) if test -z "$notick" then test_tick fi && - git ${indir:+ -C "$indir"} tag -a -m "$1" "${4:-$1}" + GIT_TEST_DATE_NOW=$test_tick TZ=PDT+7 \ + git ${indir:+ -C "$indir"} tag -a -m "$1" "${4:-$1}" ;; esac }