Merge branch 'ml/reflog-write-committer-info-fix'
"git reflog write" did not honor the configured user.name/email which has been corrected. * ml/reflog-write-committer-info-fix: builtin/reflog: respect user config in "write" subcommandmain
commit
47f870c4ae
|
|
@ -418,6 +418,8 @@ static int cmd_reflog_write(int argc, const char **argv, const char *prefix,
|
||||||
const char *ref, *message;
|
const char *ref, *message;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
repo_config(repo, git_ident_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, reflog_write_usage, 0);
|
argc = parse_options(argc, argv, prefix, options, reflog_write_usage, 0);
|
||||||
if (argc != 4)
|
if (argc != 4)
|
||||||
usage_with_options(reflog_write_usage, options);
|
usage_with_options(reflog_write_usage, options);
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,42 @@ test_expect_success 'simple writes' '
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'uses user.name and user.email config' '
|
||||||
|
test_when_finished "rm -rf repo" &&
|
||||||
|
git init repo &&
|
||||||
|
(
|
||||||
|
cd repo &&
|
||||||
|
test_commit initial &&
|
||||||
|
COMMIT_OID=$(git rev-parse HEAD) &&
|
||||||
|
|
||||||
|
sane_unset GIT_COMMITTER_NAME &&
|
||||||
|
sane_unset GIT_COMMITTER_EMAIL &&
|
||||||
|
git config --local user.name "Author" &&
|
||||||
|
git config --local user.email "a@uth.or" &&
|
||||||
|
git reflog write refs/heads/something $ZERO_OID $COMMIT_OID first &&
|
||||||
|
test_reflog_matches . refs/heads/something <<-EOF
|
||||||
|
$ZERO_OID $COMMIT_OID Author <a@uth.or> $GIT_COMMITTER_DATE first
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'environment variables take precedence over config' '
|
||||||
|
test_when_finished "rm -rf repo" &&
|
||||||
|
git init repo &&
|
||||||
|
(
|
||||||
|
cd repo &&
|
||||||
|
test_commit initial &&
|
||||||
|
COMMIT_OID=$(git rev-parse HEAD) &&
|
||||||
|
|
||||||
|
git config --local user.name "Author" &&
|
||||||
|
git config --local user.email "a@uth.or" &&
|
||||||
|
git reflog write refs/heads/something $ZERO_OID $COMMIT_OID first &&
|
||||||
|
test_reflog_matches . refs/heads/something <<-EOF
|
||||||
|
$ZERO_OID $COMMIT_OID $SIGNATURE first
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'can write to root ref' '
|
test_expect_success 'can write to root ref' '
|
||||||
test_when_finished "rm -rf repo" &&
|
test_when_finished "rm -rf repo" &&
|
||||||
git init repo &&
|
git init repo &&
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue