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>

Jeff King committed Nov 5, 2018 at 01:38 UTC fce56648056acf476aa810a02c6eb33cbcabb6c9
1 file changed +3 -1
builtin/am.c
+3 -1
@@ -2165,7 +2165,9 @@ static int parse_opt_patchformat(const struct option *opt, const char *arg, int
2165 {
2166 int *opt_value = opt->value;
2167
2168 - if (!strcmp(arg, "mbox"))
2168 + if (unset)
2169 + *opt_value = PATCH_FORMAT_UNKNOWN;
2170 + else if (!strcmp(arg, "mbox"))
2171 *opt_value = PATCH_FORMAT_MBOX;
2172 else if (!strcmp(arg, "stgit"))
2173 *opt_value = PATCH_FORMAT_STGIT;