Skip to content

Commit 5e4f9cf

Browse files
pyokagangitster
authored andcommitted
builtin-am: check for valid committer ident
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(), but at this point of git-am's execution, 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c2676cd commit 5e4f9cf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin/am.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,6 +2246,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)
22462246
fprintf_ln(stderr, _("The -b/--binary option has been a no-op for long time, and\n"
22472247
"it will be removed. Please do not use it anymore."));
22482248

2249+
/* Ensure a valid committer ident can be constructed */
2250+
git_committer_info(IDENT_STRICT);
2251+
22492252
if (read_index_preload(&the_index, NULL) < 0)
22502253
die(_("failed to read the index"));
22512254

0 commit comments

Comments
 (0)