]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/log.c
Merge branch 'ab/config-multi-and-nonbool'
[thirdparty/git.git] / builtin / log.c
index a70fba198f9451c9005b3ecd14cfce8765e1d838..0c6556b2d783637d1d42d7edbe2a0593344a965b 100644 (file)
@@ -4,8 +4,10 @@
  * (C) Copyright 2006 Linus Torvalds
  *              2006 Junio Hamano
  */
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
 #include "config.h"
+#include "hex.h"
 #include "refs.h"
 #include "object-store.h"
 #include "color.h"
@@ -56,6 +58,7 @@ static int stdout_mboxrd;
 static const char *fmt_patch_subject_prefix = "PATCH";
 static int fmt_patch_name_max = FORMAT_PATCH_NAME_MAX_DEFAULT;
 static const char *fmt_pretty;
+static int format_no_prefix;
 
 static const char * const builtin_log_usage[] = {
        N_("git log [<options>] [<revision-range>] [[--] <path>...]"),
@@ -182,10 +185,10 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
        int i;
        char *value = NULL;
        struct string_list *include = decoration_filter->include_ref_pattern;
-       const struct string_list *config_exclude =
-                       git_config_get_value_multi("log.excludeDecoration");
+       const struct string_list *config_exclude;
 
-       if (config_exclude) {
+       if (!git_config_get_string_multi("log.excludeDecoration",
+                                        &config_exclude)) {
                struct string_list_item *item;
                for_each_string_list_item(item, config_exclude)
                        string_list_append(decoration_filter->exclude_ref_config_pattern,
@@ -436,7 +439,7 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
        setitimer(ITIMER_REAL, &early_output_timer, NULL);
 }
 
-static void early_output(int signal)
+static void early_output(int signal UNUSED)
 {
        show_early_output = log_show_early;
 }
@@ -601,8 +604,6 @@ static int git_log_config(const char *var, const char *value, void *cb)
                return 0;
        }
 
-       if (git_gpg_config(var, value, cb) < 0)
-               return -1;
        return git_diff_ui_config(var, value, cb);
 }
 
@@ -1084,6 +1085,19 @@ static int git_format_config(const char *var, const char *value, void *cb)
                stdout_mboxrd = git_config_bool(var, value);
                return 0;
        }
+       if (!strcmp(var, "format.noprefix")) {
+               format_no_prefix = 1;
+               return 0;
+       }
+
+       /*
+        * ignore some porcelain config which would otherwise be parsed by
+        * git_diff_ui_config(), via git_log_config(); we can't just avoid
+        * diff_ui_config completely, because we do care about some ui options
+        * like color.
+        */
+       if (!strcmp(var, "diff.noprefix"))
+               return 0;
 
        return git_log_config(var, value, cb);
 }
@@ -1993,6 +2007,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        s_r_opt.def = "HEAD";
        s_r_opt.revarg_opt = REVARG_COMMITTISH;
 
+       if (format_no_prefix)
+               diff_set_noprefix(&rev.diffopt);
+
        if (default_attach) {
                rev.mime_boundary = default_attach;
                rev.no_inline = 1;
@@ -2097,6 +2114,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
        /* Always generate a patch */
        rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
+       rev.always_show_header = 1;
 
        rev.zero_commit = zero_commit;
        rev.patch_name_max = fmt_patch_name_max;