summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-12-23 06:48:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-23 06:48:11 (GMT)
commit67b7017593d1ee878dd4aae9c51f81db1742752e (patch)
tree5c6952be4373bb3d72a537431132fb02d27d58d7
parentdcaf17c75d925531ba399a211e63664784d96821 (diff)
parent368b58431588e0468ac66b013b91c50bc4c4c718 (diff)
downloadgit-67b7017593d1ee878dd4aae9c51f81db1742752e.zip
git-67b7017593d1ee878dd4aae9c51f81db1742752e.tar.gz
git-67b7017593d1ee878dd4aae9c51f81db1742752e.tar.bz2
Merge branch 'ab/common-main-cleanup'
Code clean-up. * ab/common-main-cleanup: common-main.c: call exit(), don't return
-rw-r--r--common-main.c9
-rw-r--r--t/helper/test-trace2.c5
2 files changed, 9 insertions, 5 deletions
diff --git a/common-main.c b/common-main.c
index 71e21dd..eafc707 100644
--- a/common-main.c
+++ b/common-main.c
@@ -51,7 +51,10 @@ int main(int argc, const char **argv)
result = cmd_main(argc, argv);
- trace2_cmd_exit(result);
-
- return result;
+ /*
+ * We define exit() to call trace2_cmd_exit_fl() in
+ * git-compat-util.h. Whether we reach this or exit()
+ * elsewhere we'll always run our trace2 exit handler.
+ */
+ exit(result);
}
diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c
index f93633f..59b124b 100644
--- a/t/helper/test-trace2.c
+++ b/t/helper/test-trace2.c
@@ -262,8 +262,9 @@ static int print_usage(void)
* [] the "cmd_name" event has been generated.
* [] this writes various "def_param" events for interesting config values.
*
- * We further assume that if we return (rather than exit()), trace2_cmd_exit()
- * will be called by test-tool.c:cmd_main().
+ * We return from here and let test-tool.c::cmd_main() pass the exit
+ * code to common-main.c::main(), which will use it to call
+ * trace2_cmd_exit().
*/
int cmd__trace2(int argc, const char **argv)
{