am: handle --no-patch-format option

Running "git am --no-patch-format" will currently segfault, since it
tries to parse a NULL argument. Instead, let's have it cancel any
previous --patch-format option.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2018-11-05 01:38:39 -05:00 committed by Junio C Hamano
parent d5d202537f
commit fce5664805

View file

@ -2165,7 +2165,9 @@ static int parse_opt_patchformat(const struct option *opt, const char *arg, int
{
int *opt_value = opt->value;
if (!strcmp(arg, "mbox"))
if (unset)
*opt_value = PATCH_FORMAT_UNKNOWN;
else if (!strcmp(arg, "mbox"))
*opt_value = PATCH_FORMAT_MBOX;
else if (!strcmp(arg, "stgit"))
*opt_value = PATCH_FORMAT_STGIT;