diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-12-08 17:32:08 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-12-09 00:55:55 -0800 |
commit | 774751a8bc594a5b56039bbdc43c45e3882dd804 (patch) | |
tree | 60e5459a634d34763ff783a58e7732869f841e74 /builtin-commit-tree.c | |
parent | Add tests for pre-commit and commit-msg hooks (diff) | |
download | tgif-774751a8bc594a5b56039bbdc43c45e3882dd804.tar.xz |
Re-fix "builtin-commit: fix --signoff"
An earlier fix to the said commit was incomplete; it mixed up the
meaning of the flag parameter passed to the internal fmt_ident()
function, so this corrects it.
git_author_info() and git_committer_info() can be told to issue a
warning when no usable user information is found, and optionally can be
told to error out. Operations that actually use the information to
record a new commit or a tag will still error out, but the caller to
leave reflog record will just silently use bogus user information.
Not warning on misconfigured user information while writing a reflog
entry is somewhat debatable, but it is probably nicer to the users to
silently let it pass, because the only information you are losing is who
checked out the branch.
* git_author_info() and git_committer_info() used to take 1 (positive
int) to error out with a warning on misconfiguration; this is now
signalled with a symbolic constant IDENT_ERROR_ON_NO_NAME.
* These functions used to take -1 (negative int) to warn but continue;
this is now signalled with a symbolic constant IDENT_WARN_ON_NO_NAME.
* fmt_ident() function implements the above error reporting behaviour
common to git_author_info() and git_committer_info(). A symbolic
constant IDENT_NO_DATE can be or'ed in to the flag parameter to make
it return only the "Name <email@address.xz>".
* fmt_name() is a thin wrapper around fmt_ident() that always passes
IDENT_ERROR_ON_NO_NAME and IDENT_NO_DATE.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit-tree.c')
-rw-r--r-- | builtin-commit-tree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c index 88b0ab36eb..6610d18358 100644 --- a/builtin-commit-tree.c +++ b/builtin-commit-tree.c @@ -98,8 +98,8 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) strbuf_addf(&buffer, "parent %s\n", sha1_to_hex(parent_sha1[i])); /* Person/date information */ - strbuf_addf(&buffer, "author %s\n", git_author_info(1)); - strbuf_addf(&buffer, "committer %s\n", git_committer_info(1)); + strbuf_addf(&buffer, "author %s\n", git_author_info(IDENT_ERROR_ON_NO_NAME)); + strbuf_addf(&buffer, "committer %s\n", git_committer_info(IDENT_ERROR_ON_NO_NAME)); if (!encoding_is_utf8) strbuf_addf(&buffer, "encoding %s\n", git_commit_encoding); strbuf_addch(&buffer, '\n'); |