Do not call cmd_*() as a subroutine
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | describe: do not use cmd_*() as a subroutinebuiltin/ | +11 | 2 replies | |
| 2/2 | merge-ours: do not use cmd_*() as a subroutinebuiltin/ | +7 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] Do not call cmd_*() as a subroutine
These two patches are for a recent #leftoverbits topic.
https://public-inbox.org/git/[email protected]/
The cmd_foo() function is a moral equivalent of 'main' for a Git subcommand 'git foo', and as such, it is allowed to do many things that make it unsuitable to be called as a subroutine, including
- call exit(3) to terminate the process;
- allocate resource held and used throughout its lifetime, without releasing it upon return/exit;
- rely on global variables being initialized at program startup, and update them as needed, making another clean invocation of the function impossible.
Correcting two callers by using helper API calls is not so hard.
Junio C Hamano (2):
describe: do not use cmd_*() as a subroutine
merge-ours: do not use cmd_*() as a subroutine
builtin/describe.c | 15 +++++++++++---- builtin/merge-ours.c | 16 +++++++--------- 2 files changed, 18 insertions(+), 13 deletions(-)
Signature · 1 line
2.15.0-rc0-203-g4c8d0e28b1