Code

MinGW: GCC >= 4 does not need SNPRINTF_SIZE_CORR anymore
[git.git] / builtin-log.c
index 442cc87cc1fddcbd4b3788f03ef8b2867dbf253c..0d34050556855d6bab8b4c4121e833cc326324df 100644 (file)
@@ -620,7 +620,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
        struct shortlog log;
        struct strbuf sb = STRBUF_INIT;
        int i;
-       const char *encoding = "utf-8";
+       const char *encoding = "UTF-8";
        struct diff_options opts;
        int need_8bit_cte = 0;
        struct commit *commit = NULL;
@@ -765,10 +765,12 @@ static int subject_prefix_callback(const struct option *opt, const char *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;
@@ -934,7 +936,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
         * like "git format-patch -o a123 HEAD^.." may fail; a123 is
         * possibly a valid SHA1.
         */
-       argc = parse_options(argc, argv, builtin_format_patch_options,
+       argc = parse_options(argc, argv, prefix, builtin_format_patch_options,
                             builtin_format_patch_usage,
                             PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN);
 
@@ -979,6 +981,15 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
        if (start_number < 0)
                start_number = 1;
+
+       /*
+        * If numbered is set solely due to format.numbered in config,
+        * and it would conflict with --keep-subject (-k) from the
+        * command line, reset "numbered".
+        */
+       if (numbered && keep_subject && !numbered_cmdline_opt)
+               numbered = 0;
+
        if (numbered && keep_subject)
                die ("-n and -k are mutually exclusive.");
        if (keep_subject && subject_prefix)