Re: [PATCH v4 43/44] builtin-am: check for valid committer ident
On Sun, Jun 28, 2015 at 7:06 AM, Paul Tan <pyokagan@gmail.com> wrote:
Show 5 quoted lines
> When commit_tree() is called, if the user does not have an explicit
> committer ident configured, it will attempt to construct a default
> committer ident based on the user's and system's info (e.g. gecos field,
> hostname etc.) However, if a default committer ident is unable to be
> constructed, commit_tree() will die(). However, at this point of git-am,
Show 32 quoted lines
> there will already be changes made to the index and work tree.
>
> This can be confusing to new users, and as such since d64e6b0 (Keep
> Porcelainish from failing by broken ident after making changes.,
> 2006-02-18) git-am.sh will check to see if the committer ident has been
> configured, or a default one can be constructed, before even starting to
> apply patches.
>
> Re-implement this in builtin/am.c.
>
> Signed-off-by: Paul Tan <pyokagan@gmail.com>
> ---
> builtin/am.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/builtin/am.c b/builtin/am.c
> index a46aa74..1cb02c8 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -2268,6 +2268,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)
> fprintf_ln(stderr, _("The -b/--binary option has been a no-op for long time, and\n"
> "it will be removed. Please do not use it anymore."));
>
> + /* Ensure a valid committer ident can be constructed */
> + git_committer_info(IDENT_STRICT);
> +
> if (read_index_preload(&the_index, NULL) < 0)
> die(_("failed to read the index"));
>
> --
> 2.5.0.rc0.76.gb2c6e93
>