log: create log.initialDecorationSet=all
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>
Derrick Stolee committed
Aug 5, 2022 at 17:58 UTC
3e103ed23f2950a111a9ef8480a629d7331dc6ee
4 files changed
+23
-1
Documentation/config/log.txt
+5
@@ -18,6 +18,11 @@ log.decorate::
18
names are shown. This is the same as the `--decorate` option
19
of the `git log`.
20
21
+log.initialDecorationSet::
22
+ By default, `git log` only shows decorations for certain known ref
23
+ namespaces. If 'all' is specified, then show all refs as
24
+ decorations.
25
+
26
log.excludeDecoration::
27
Exclude the specified patterns from the log decorations. This is
28
similar to the `--decorate-refs-exclude` command-line option, but
Documentation/git-log.txt
+3
-1
@@ -59,7 +59,9 @@ used as decoration if they match `HEAD`, `refs/heads/`, `refs/remotes/`,
59
--clear-decorations::
60
When specified, this option clears all previous `--decorate-refs`
61
or `--decorate-refs-exclude` options and relaxes the default
62
- decoration filter to include all references.
62
+ decoration filter to include all references. This option is
63
+ assumed if the config value `log.initialDecorationSet` is set to
64
+ `all`.
65
66
--source::
67
Print out the ref name given on the command line by which each
builtin/log.c
+12
@@ -179,6 +179,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)
179
static void set_default_decoration_filter(struct decoration_filter *decoration_filter)
180
{
181
int i;
182
+ char *value = NULL;
183
struct string_list *include = decoration_filter->include_ref_pattern;
184
const struct string_list *config_exclude =
185
git_config_get_value_multi("log.excludeDecoration");
@@ -190,6 +191,17 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
191
item->string);
192
}
193
194
+ /*
195
+ * By default, decorate_all is disabled. Enable it if
196
+ * log.initialDecorationSet=all. Don't ever disable it by config,
197
+ * since the command-line takes precedent.
198
+ */
199
+ if (use_default_decoration_filter &&
200
+ !git_config_get_string("log.initialdecorationset", &value) &&
201
+ !strcmp("all", value))
202
+ use_default_decoration_filter = 0;
203
+ free(value);
204
+
205
if (!use_default_decoration_filter ||
206
decoration_filter->exclude_ref_pattern->nr ||
207
decoration_filter->include_ref_pattern->nr ||
t/t4202-log.sh
+3
@@ -1090,6 +1090,9 @@ test_expect_success '--clear-decorations overrides defaults' '
1090
EOF
1091
git log --decorate=full --pretty="tformat:%f%d" \
1092
--clear-decorations >actual &&
1093
+ test_cmp expect.all actual &&
1094
+ git -c log.initialDecorationSet=all log \
1095
+ --decorate=full --pretty="tformat:%f%d" >actual &&
1096
test_cmp expect.all actual
1097
'
1098