Skip to content

Commit 3e103ed

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 748706d commit 3e103ed

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

Documentation/config/log.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ log.decorate::
1818
names are shown. This is the same as the `--decorate` option
1919
of the `git log`.
2020

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+
2126
log.excludeDecoration::
2227
Exclude the specified patterns from the log decorations. This is
2328
similar to the `--decorate-refs-exclude` command-line option, but

Documentation/git-log.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ used as decoration if they match `HEAD`, `refs/heads/`, `refs/remotes/`,
5959
--clear-decorations::
6060
When specified, this option clears all previous `--decorate-refs`
6161
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`.
6365

6466
--source::
6567
Print out the ref name given on the command line by which each

builtin/log.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ static void cmd_log_init_defaults(struct rev_info *rev)
179179
static void set_default_decoration_filter(struct decoration_filter *decoration_filter)
180180
{
181181
int i;
182+
char *value = NULL;
182183
struct string_list *include = decoration_filter->include_ref_pattern;
183184
const struct string_list *config_exclude =
184185
git_config_get_value_multi("log.excludeDecoration");
@@ -190,6 +191,17 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
190191
item->string);
191192
}
192193

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+
193205
if (!use_default_decoration_filter ||
194206
decoration_filter->exclude_ref_pattern->nr ||
195207
decoration_filter->include_ref_pattern->nr ||

t/t4202-log.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,9 @@ test_expect_success '--clear-decorations overrides defaults' '
10901090
EOF
10911091
git log --decorate=full --pretty="tformat:%f%d" \
10921092
--clear-decorations >actual &&
1093+
test_cmp expect.all actual &&
1094+
git -c log.initialDecorationSet=all log \
1095+
--decorate=full --pretty="tformat:%f%d" >actual &&
10931096
test_cmp expect.all actual
10941097
'
10951098

0 commit comments

Comments
 (0)