Lars Hjemli <hjemli@xxxxxxxxx> writes: > diff --git a/builtin-log.c b/builtin-log.c > index 3817bf1..1ed4c76 100644 > --- a/builtin-log.c > +++ b/builtin-log.c > @@ -61,8 +61,15 @@ static void cmd_log_init(int argc, const char > **argv, const char *prefix, > for (i = 1; i < argc; i++) { > const char *arg = argv[i]; > if (!strcmp(arg, "--decorate")) { > - load_ref_decorations(); > - rev->show_decorations = 1; > + rev->show_decorations = DECORATE_SHORT_REFS; > + } else if (!prefixcmp(arg, "--decorate=")) { > + const char *v = skip_prefix(arg, "--decorate="); > + if (!strcmp(v, "full")) > + rev->show_decorations = DECORATE_FULL_REFS; > + else if (!strcmp(v, "short")) > + rev->show_decorations = DECORATE_SHORT_REFS; > + else > + die("invalid --decorate option: %s", arg); > } else if (!strcmp(arg, "--source")) { > rev->show_source = 1; > } else if (!strcmp(arg, "-h")) { > @@ -70,6 +77,8 @@ static void cmd_log_init(int argc, const char > **argv, const char *prefix, > } else > die("unrecognized argument: %s", arg); > } > + if (rev->show_decorations) > + load_ref_decorations(rev->show_decorations); > } If you are deciding whether full refs are given or short ones when you call load_ref_decorations(), I do not think there is any reason for you to change the type of rev->short_decorations from bool to enum. Shouldn't you maintain a local variable in this function and pass it down to this call instead? That is, something like this on top (I had to fix the breakage your MUA has done to your patch, so there might be some fuzz around whitespace). builtin-log.c | 13 ++++++++----- log-tree.c | 2 +- revision.h | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/builtin-log.c b/builtin-log.c index 2a0f5f7..25e21ed 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -35,6 +35,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, struct rev_info *rev) { int i; + int decoration_style = 0; rev->abbrev = DEFAULT_ABBREV; rev->commit_format = CMIT_FMT_DEFAULT; @@ -61,13 +62,13 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, for (i = 1; i < argc; i++) { const char *arg = argv[i]; if (!strcmp(arg, "--decorate")) { - rev->show_decorations = DECORATE_SHORT_REFS; + decoration_style = DECORATE_SHORT_REFS; } else if (!prefixcmp(arg, "--decorate=")) { const char *v = skip_prefix(arg, "--decorate="); if (!strcmp(v, "full")) - rev->show_decorations = DECORATE_FULL_REFS; + decoration_style = DECORATE_FULL_REFS; else if (!strcmp(v, "short")) - rev->show_decorations = DECORATE_SHORT_REFS; + decoration_style = DECORATE_SHORT_REFS; else die("invalid --decorate option: %s", arg); } else if (!strcmp(arg, "--source")) { @@ -77,8 +78,10 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, } else die("unrecognized argument: %s", arg); } - if (rev->show_decorations) - load_ref_decorations(rev->show_decorations); + if (decoration_style) { + rev->show_decorations = 1; + load_ref_decorations(decoration_style); + } } /* diff --git a/log-tree.c b/log-tree.c index 1c767c9..1c9eefe 100644 --- a/log-tree.c +++ b/log-tree.c @@ -25,7 +25,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in struct object *obj = parse_object(sha1); if (!obj) return 0; - if (!cb_data || *(int *)cb_data & DECORATE_SHORT_REFS) + if (!cb_data || *(int *)cb_data == DECORATE_SHORT_REFS) refname = prettify_refname(refname); add_name_decoration("", refname, obj); while (obj->type == OBJ_TAG) { diff --git a/revision.h b/revision.h index 9a644ee..b10984b 100644 --- a/revision.h +++ b/revision.h @@ -59,6 +59,7 @@ struct rev_info { rewrite_parents:1, print_parents:1, show_source:1, + show_decorations:1, reverse:1, reverse_output_stage:1, cherry_pick:1, @@ -98,7 +99,6 @@ struct rev_info { const char *subject_prefix; int no_inline; int show_log_size; - int show_decorations; /* Filter by commit log message */ struct grep_opt grep_filter; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html