Skip to content

Commit 0cc7380

Browse files
rscharfegitster
authored andcommitted
log-tree: call load_ref_decorations() in get_name_decoration()
Load a default set of ref name decorations at the first lookup. This frees direct and indirect callers from doing so. They can still do it if they want to use a filter or are interested in full decorations instead of the default short ones -- the first load_ref_decorations() call wins. This means that the load in builtin/log.c::cmd_log_init_finish() is respected even if --simplify-by-decoration is given, as the previously dominating earlier load in handle_revision_opt() is gone. So a filter given with --decorate-refs-exclude is used for simplification in that case, as expected. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b4ecbcf commit 0cc7380

File tree

4 files changed

+2
-4
lines changed

4 files changed

+2
-4
lines changed

log-tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ void add_name_decoration(enum decoration_type type, const char *name, struct obj
7777

7878
const struct name_decoration *get_name_decoration(const struct object *obj)
7979
{
80+
load_ref_decorations(NULL, DECORATE_SHORT_REFS);
8081
return lookup_decoration(&name_decoration, obj);
8182
}
8283

pretty.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,11 +1239,9 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
12391239
strbuf_addstr(sb, get_revision_mark(NULL, commit));
12401240
return 1;
12411241
case 'd':
1242-
load_ref_decorations(NULL, DECORATE_SHORT_REFS);
12431242
format_decorations(sb, commit, c->auto_color);
12441243
return 1;
12451244
case 'D':
1246-
load_ref_decorations(NULL, DECORATE_SHORT_REFS);
12471245
format_decorations_extended(sb, commit, c->auto_color, "", ", ", "");
12481246
return 1;
12491247
case 'S': /* tag/branch like --source */

revision.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,6 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
20632063
revs->simplify_by_decoration = 1;
20642064
revs->limited = 1;
20652065
revs->prune = 1;
2066-
load_ref_decorations(NULL, DECORATE_SHORT_REFS);
20672066
} else if (!strcmp(arg, "--date-order")) {
20682067
revs->sort_order = REV_SORT_BY_COMMIT_DATE;
20692068
revs->topo_order = 1;

t/t4202-log.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ test_expect_success 'decorate-refs and decorate-refs-exclude' '
837837
test_cmp expect.decorate actual
838838
'
839839

840-
test_expect_failure 'decorate-refs-exclude and simplify-by-decoration' '
840+
test_expect_success 'decorate-refs-exclude and simplify-by-decoration' '
841841
cat >expect.decorate <<-\EOF &&
842842
Merge-tag-reach (HEAD -> master)
843843
reach (tag: reach, reach)

0 commit comments

Comments
 (0)