summaryrefslogtreecommitdiff
path: root/submodule.h
diff options
context:
space:
mode:
authorPhilippe Blain <levraiphilippeblain@gmail.com>2022-04-04 17:10:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-04-06 15:55:19 (GMT)
commit465b30a92d4c2c76e434790bdf487d57547a6cc4 (patch)
treeb466d3fec11fd624b398884cc3b9932734910bd4 /submodule.h
parent4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a (diff)
downloadgit-465b30a92d4c2c76e434790bdf487d57547a6cc4.zip
git-465b30a92d4c2c76e434790bdf487d57547a6cc4.tar.gz
git-465b30a92d4c2c76e434790bdf487d57547a6cc4.tar.bz2
submodule.h: use a named enum for RECURSE_SUBMODULES_*
Using a named enum allows casting an integer to the enum type in both GDB and LLDB: $ gdb -q -ex 'b wt-status.c:44' -ex r --args ./git status (gdb) p (enum color_wt_status) slot $1 = WT_STATUS_ONBRANCH $ lldb -o 'b wt-status.c:44' -o r -- ./git status (lldb) p (color_wt_status) slot (color_wt_status) $0 = WT_STATUS_ONBRANCH In LLDB, it's also required to cast in the reversed direction, i.e. cast an enum constant into its corresponding integer: (lldb) p (int) color_wt_status::WT_STATUS_ONBRANCH (int) $1 = 8 Name the enum listing the different RECURSE_SUBMODULES_* modes, to make debugging easier. For example, when stepping through a part of the code where an int is compared with a constant in this enum, it allows casting the int to the enum type or vice-versa, after quickly checking where the enum constant is declared and learning the enum name. As to not make this patch a debug-only change, convert the 'fetch_recurse' member of 'struct submodule' to use the newly named enum. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Reviewed-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.h')
-rw-r--r--submodule.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/submodule.h b/submodule.h
index 6bd2c99..55cf6f0 100644
--- a/submodule.h
+++ b/submodule.h
@@ -13,7 +13,7 @@ struct repository;
struct string_list;
struct strbuf;
-enum {
+enum submodule_recurse_mode {
RECURSE_SUBMODULES_ONLY = -5,
RECURSE_SUBMODULES_CHECK = -4,
RECURSE_SUBMODULES_ERROR = -3,