log-tree: use ref_namespaces instead of if/else-if
commit94d421b8afa0dc46fcd03143f10b4f3828b20104
authorDerrick Stolee <derrickstolee@github.com>
Fri, 5 Aug 2022 17:58:38 +0000 (5 17:58 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Aug 2022 21:13:12 +0000 (5 14:13 -0700)
treeb992b0357133e3fb655789f39f8915a6c4fea50a
parent97e61e0f9cd96f403504ec97cfdf38f238777560
log-tree: use ref_namespaces instead of if/else-if

The add_ref_decoration() method uses an if/else-if chain to determine if
a ref matches a known ref namespace that has a special decoration
category. That decoration type is later used to assign a color when
writing to stdout.

The newly-added ref_namespaces array contains all namespaces, along
with information about their decoration type. Check this array instead
of this if/else-if chain. This reduces our dependency on string literals
being embedded in the decoration logic.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
log-tree.c