From: Junio C Hamano Date: Mon, 25 May 2009 07:59:59 +0000 (-0700) Subject: Merge branch 'sb/format-patch-parseopt' into sb/opt-filename X-Git-Tag: v1.6.4-rc0~94^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8a17595899ac49a24128db76a80fbb35da487845;p=git.git Merge branch 'sb/format-patch-parseopt' into sb/opt-filename * sb/format-patch-parseopt: format-patch: migrate to parse-options API Conflicts: builtin-log.c --- 8a17595899ac49a24128db76a80fbb35da487845 diff --cc builtin-log.c index f10cfebdb,442cc87cc..5d39565e9 --- a/builtin-log.c +++ b/builtin-log.c @@@ -740,6 -741,108 +741,110 @@@ static const char *set_outdir(const cha output_directory)); } + static const char * const builtin_format_patch_usage[] = { + "git format-patch [options] [ | ]", + NULL + }; + + static int keep_subject = 0; + + static int keep_callback(const struct option *opt, const char *arg, int unset) + { + ((struct rev_info *)opt->value)->total = -1; + keep_subject = 1; + return 0; + } + + static int subject_prefix = 0; + + static int subject_prefix_callback(const struct option *opt, const char *arg, + int unset) + { + subject_prefix = 1; + ((struct rev_info *)opt->value)->subject_prefix = arg; + return 0; + } + ++static int numbered_cmdline_opt = 0; ++ + static int numbered_callback(const struct option *opt, const char *arg, + int unset) + { - *(int *)opt->value = unset ? 0 : 1; ++ *(int *)opt->value = numbered_cmdline_opt = unset ? 0 : 1; + if (unset) + auto_number = 0; + return 0; + } + + static int no_numbered_callback(const struct option *opt, const char *arg, + int unset) + { + return numbered_callback(opt, arg, 1); + } + + static int output_directory_callback(const struct option *opt, const char *arg, + int unset) + { + const char **dir = (const char **)opt->value; + if (*dir) + die("Two output directories?"); + *dir = arg; + return 0; + } + + static int thread_callback(const struct option *opt, const char *arg, int unset) + { + int *thread = (int *)opt->value; + if (unset) + *thread = 0; + else if (!arg || !strcmp(arg, "shallow")) + *thread = THREAD_SHALLOW; + else if (!strcmp(arg, "deep")) + *thread = THREAD_DEEP; + else + return 1; + return 0; + } + + static int attach_callback(const struct option *opt, const char *arg, int unset) + { + struct rev_info *rev = (struct rev_info *)opt->value; + if (unset) + rev->mime_boundary = NULL; + else if (arg) + rev->mime_boundary = arg; + else + rev->mime_boundary = git_version_string; + rev->no_inline = unset ? 0 : 1; + return 0; + } + + static int inline_callback(const struct option *opt, const char *arg, int unset) + { + struct rev_info *rev = (struct rev_info *)opt->value; + if (unset) + rev->mime_boundary = NULL; + else if (arg) + rev->mime_boundary = arg; + else + rev->mime_boundary = git_version_string; + rev->no_inline = 0; + return 0; + } + + static int header_callback(const struct option *opt, const char *arg, int unset) + { + add_header(arg); + return 0; + } + + static int cc_callback(const struct option *opt, const char *arg, int unset) + { + ALLOC_GROW(extra_cc, extra_cc_nr + 1, extra_cc_alloc); + extra_cc[extra_cc_nr++] = xstrdup(arg); + return 0; + } + int cmd_format_patch(int argc, const char **argv, const char *prefix) { struct commit *commit;