aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-11-05 01:38:39 -0500
committerJunio C Hamano <gitster@pobox.com>2018-11-06 12:55:35 +0900
commitfce56648056acf476aa810a02c6eb33cbcabb6c9 (patch)
tree6763cc696a759ce78b35c5204961ab727fad8c8d
parentapply: mark include/exclude options as NONEG (diff)
downloadgit-fce56648056acf476aa810a02c6eb33cbcabb6c9.tar.gz
git-fce56648056acf476aa810a02c6eb33cbcabb6c9.zip
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>
-rw-r--r--builtin/am.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 3ee9a9d2a9..dcb880b699 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -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;