Skip to content

Commit eb73445

Browse files
Steven Drakegitster
authored andcommitted
Add `log.decorate' configuration variable.
This alows the 'git-log --decorate' to be enabled by default so that normal log outout contains ant ref names of commits that are shown. Signed-off-by: Steven Drake <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8420ccd commit eb73445

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Documentation/config.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,13 @@ log.date::
12321232
following alternatives: {relative,local,default,iso,rfc,short}.
12331233
See linkgit:git-log[1].
12341234

1235+
log.decorate::
1236+
Print out the ref names of any commits that are shown by the log
1237+
command. If 'short' is specified, the ref name prefixes 'refs/heads/',
1238+
'refs/tags/' and 'refs/remotes/' will not be printed. If 'full' is
1239+
specified, the full ref name (including prefix) will be printed.
1240+
This is the same as the log commands '--decorate' option.
1241+
12351242
log.showroot::
12361243
If true, the initial commit will be shown as a big creation event.
12371244
This is equivalent to a diff against an empty tree.

builtin-log.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
static const char *default_date_mode = NULL;
2525

2626
static int default_show_root = 1;
27+
static int decoration_style = 0;
2728
static const char *fmt_patch_subject_prefix = "PATCH";
2829
static const char *fmt_pretty;
2930

@@ -35,7 +36,6 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
3536
struct rev_info *rev)
3637
{
3738
int i;
38-
int decoration_style = 0;
3939

4040
rev->abbrev = DEFAULT_ABBREV;
4141
rev->commit_format = CMIT_FMT_DEFAULT;
@@ -252,6 +252,13 @@ static int git_log_config(const char *var, const char *value, void *cb)
252252
return git_config_string(&fmt_patch_subject_prefix, var, value);
253253
if (!strcmp(var, "log.date"))
254254
return git_config_string(&default_date_mode, var, value);
255+
if (!strcmp(var, "log.decorate")) {
256+
if (!strcmp(value, "full"))
257+
decoration_style = DECORATE_FULL_REFS;
258+
else if (!strcmp(value, "short"))
259+
decoration_style = DECORATE_SHORT_REFS;
260+
return 0;
261+
}
255262
if (!strcmp(var, "log.showroot")) {
256263
default_show_root = git_config_bool(var, value);
257264
return 0;

0 commit comments

Comments
 (0)