]> rtime.felk.cvut.cz Git - git.git/commitdiff
Merge branch 'sb/format-patch-parseopt'
authorJunio C Hamano <gitster@pobox.com>
Sun, 31 May 2009 23:17:31 +0000 (16:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 31 May 2009 23:17:31 +0000 (16:17 -0700)
* sb/format-patch-parseopt:
  format-patch: migrate to parse-options API

Conflicts:
builtin-log.c

1  2 
builtin-log.c

diff --cc builtin-log.c
index 17d06bf20211cc0c881bceb2f24c5c1df516daf8,442cc87cc1fddcbd4b3788f03ef8b2867dbf253c..c8c620827587f14c4ff3314572c0dd01a4a4cfe3
@@@ -740,6 -741,108 +741,110 @@@ static const char *set_outdir(const cha
                                       output_directory));
  }
  
 -      *(int *)opt->value = unset ? 0 : 1;
+ static const char * const builtin_format_patch_usage[] = {
+       "git format-patch [options] [<since> | <revision range>]",
+       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 = 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;