]> git.ipfire.org Git - thirdparty/git.git/commit
show-branch: reject --[no-](topo|date)-order
authorJunio C Hamano <gitster@pobox.com>
Wed, 19 Jul 2023 16:32:36 +0000 (09:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Jul 2023 05:00:39 +0000 (22:00 -0700)
commit68cbb20e737218bcd067bb5b5be658378095d0ed
treea51e0a0b11bca46d83f6f4ae18cb8698011dcf0f
parent83bb8e5a0689e236f06a24ffede0b4c823b4a0b2
show-branch: reject --[no-](topo|date)-order

"git show-branch --no-topo-order" behaved exactly the same way as
"git show-branch --topo-order" did, which was nonsense.  This was
because we choose between topo- and date- by setting a variable to
either REV_SORT_IN_GRAPH_ORDER or REV_SORT_BY_COMMIT_DATE with
OPT_SET_INT() and REV_SORT_IN_GRAPH_ORDER happens to be 0.  The
OPT_SET_INT() macro assigns 0 to the target variable in respose to
the negated form of its option.

"--no-date-order" by luck behaves identically to "--topo-order"
exactly for the same reason, and it sort-of makes sense right now,
but the "sort-of makes sense" will quickly break down once we add a
third way to sort.  Not-A may be B when there are only two choices
between A and B, but once your choices become among A, B, and C,
not-A does not mean B.

Just mark these two ordering options to reject negation, and add a
test, which was missing.  "git show-branch --no-reflog" is also
unnegatable, so throw in a test for that while we are at it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/show-branch.c
t/t3202-show-branch.sh