Since 57343652a5 (show-branch: migrate to parse-options API, 2009-05-21) git show-branch has accepted the option --no-sparse, but it does the same as --sparse. That's because it's defined using OPT_SET_INT with a value of 0, which sets 0 when negated, too. Turn --no-sparse into the opposite of --sparse by using OPT_BOOL and storing the option's status directly in a variable named "sparse" instead of in negative form in "dense". Suggested-by: Junio C Hamano <gitster@xxxxxxxxx> Signed-off-by: René Scharfe <l.s.r@xxxxxx> --- builtin/show-branch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/show-branch.c b/builtin/show-branch.c index a86b3c7677..99b3f4a09a 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -649,7 +649,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) int with_current_branch = 0; int head_at = -1; int topics = 0; - int dense = 1; + int sparse = 0; const char *reflog_base = NULL; struct option builtin_show_branch_options[] = { OPT_BOOL('a', "all", &all_heads, @@ -676,8 +676,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) REV_SORT_IN_GRAPH_ORDER), OPT_BOOL(0, "topics", &topics, N_("show only commits not on the first branch")), - OPT_SET_INT(0, "sparse", &dense, - N_("show merges reachable from only one tip"), 0), + OPT_BOOL(0, "sparse", &sparse, + N_("show merges reachable from only one tip")), OPT_SET_INT(0, "date-order", &sort_order, N_("topologically sort, maintaining date order " "where possible"), @@ -940,7 +940,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) !is_merge_point && (this_flag & (1u << REV_SHIFT))) continue; - if (dense && is_merge && + if (!sparse && is_merge && omit_in_dense(commit, rev, num_rev)) continue; for (i = 0; i < num_rev; i++) { -- 2.41.0