]> git.ipfire.org Git - thirdparty/git.git/commitdiff
log: create log.initialDecorationSet=all
authorDerrick Stolee <derrickstolee@github.com>
Fri, 5 Aug 2022 17:58:41 +0000 (17:58 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Aug 2022 21:13:12 +0000 (14:13 -0700)
The previous change introduced the --clear-decorations option for users
who do not want their decorations limited to a narrow set of ref
namespaces.

Add a config option that is equivalent to specifying --clear-decorations
by default.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/log.txt
Documentation/git-log.txt
builtin/log.c
t/t4202-log.sh

index 456eb07800cb1eef63e9d26f96a1ed35b6e65116..5250ba45fb4ea583e1fb122b6f5f375aabeca5c8 100644 (file)
@@ -18,6 +18,11 @@ log.decorate::
        names are shown. This is the same as the `--decorate` option
        of the `git log`.
 
+log.initialDecorationSet::
+       By default, `git log` only shows decorations for certain known ref
+       namespaces. If 'all' is specified, then show all refs as
+       decorations.
+
 log.excludeDecoration::
        Exclude the specified patterns from the log decorations. This is
        similar to the `--decorate-refs-exclude` command-line option, but
index f2ce16fba7176e2fd52f278d45d2af4ac075da6d..b1285aee3c290ed76eb5accd4a733db0e747a518 100644 (file)
@@ -59,7 +59,9 @@ used as decoration if they match `HEAD`, `refs/heads/`, `refs/remotes/`,
 --clear-decorations::
        When specified, this option clears all previous `--decorate-refs`
        or `--decorate-refs-exclude` options and relaxes the default
-       decoration filter to include all references.
+       decoration filter to include all references. This option is
+       assumed if the config value `log.initialDecorationSet` is set to
+       `all`.
 
 --source::
        Print out the ref name given on the command line by which each
index 7d35d1ecab139d9b20fc2399c45f760a3c851591..2e2136020e5119fb2e3346b80293cc57c3c09216 100644 (file)
@@ -179,6 +179,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)
 static void set_default_decoration_filter(struct decoration_filter *decoration_filter)
 {
        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");
@@ -190,6 +191,17 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
                                           item->string);
        }
 
+       /*
+        * By default, decorate_all is disabled. Enable it if
+        * log.initialDecorationSet=all. Don't ever disable it by config,
+        * since the command-line takes precedent.
+        */
+       if (use_default_decoration_filter &&
+           !git_config_get_string("log.initialdecorationset", &value) &&
+           !strcmp("all", value))
+               use_default_decoration_filter = 0;
+       free(value);
+
        if (!use_default_decoration_filter ||
            decoration_filter->exclude_ref_pattern->nr ||
            decoration_filter->include_ref_pattern->nr ||
index 90800feb0f1e1529b3d964c294e9e7173a0800fd..4b2d642d34c9e18ab1739f1558e2293f470308c8 100755 (executable)
@@ -1090,6 +1090,9 @@ test_expect_success '--clear-decorations overrides defaults' '
        EOF
        git log --decorate=full --pretty="tformat:%f%d" \
                --clear-decorations >actual &&
+       test_cmp expect.all actual &&
+       git -c log.initialDecorationSet=all log \
+               --decorate=full --pretty="tformat:%f%d" >actual &&
        test_cmp expect.all actual
 '