]> git.ipfire.org Git - thirdparty/git.git/commit
color: return enum from git_config_colorbool()
authorJeff King <peff@peff.net>
Tue, 16 Sep 2025 20:14:07 +0000 (16:14 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Sep 2025 20:37:04 +0000 (13:37 -0700)
commit53e8a435ba94cc222f74efe49efc9f386ad2f490
tree393b329393b6f3cac8b2204ce79160eea500483f
parent3c3e9b830383364316ba07730aecbc47a680b513
color: return enum from git_config_colorbool()

The git_config_colorbool() function returns an integer which is always
one of the GIT_COLOR_* constants UNKNOWN, NEVER, ALWAYS, or AUTO. We
define these constants with macros, but let's switch to using an enum.
Even though the compiler does not strictly enforce enum/int conversions,
this should make the intent clearer to human readers. And as a bonus,
enum names are typically available to debuggers, making it more pleasant
to step through the code there.

This patch updates the return type of git_config_colorbool(), but holds
off on updating all of the callers. There's some trickiness to some of
them, and in the meantime it's perfectly fine to assign an enum into an
int.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
color.c
color.h