Git development
 help / color / mirror / Atom feed
* [PATCH 0/2] parse-options: introduce die_for_required_opt() helper
@ 2026-06-03 11:10 Siddharth Shrimali
  2026-06-03 11:10 ` [PATCH 1/2] parse-options: introduce die_for_required_opt() Siddharth Shrimali
  2026-06-03 11:10 ` [PATCH 2/2] builtin/add: use die_for_required_opt() helper Siddharth Shrimali
  0 siblings, 2 replies; 4+ messages in thread
From: Siddharth Shrimali @ 2026-06-03 11:10 UTC (permalink / raw)
  To: git; +Cc: gitster, christian.couder, toon, jn.avila, r.siddharth.shrimali

Many built-in commands in Git manually check for option prerequisites 
(i.e., option X relies on option Y being present) using explicit 
conditional blocks and duplicated error message strings.

This short series comes out of a discussion with Christian about 
localization and code duplication. To address these issues, it 
introduces a centralized API helper that handles simple option 
prerequisites safely.

- Patch 1 introduces the `die_for_required_opt()` helper function 
  inside parse-options.
  
- Patch 2 cleans up `builtin/add.c` as a proof-of-concept by migrating 
  its manual prerequisite checks for '--ignore-missing' and 
  '--pathspec-file-nul' over to the new helper.

If this initial approach looks good, we can later extend the helper 
to handle more complex multi-option dependencies.

Siddharth Shrimali (2):
  parse-options: introduce die_for_required_opt()
  builtin/add: use die_for_required_opt() helper

 builtin/add.c   | 7 +++----
 parse-options.c | 7 +++++++
 parse-options.h | 3 +++
 3 files changed, 13 insertions(+), 4 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-03 19:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-03 11:10 [PATCH 0/2] parse-options: introduce die_for_required_opt() helper Siddharth Shrimali
2026-06-03 11:10 ` [PATCH 1/2] parse-options: introduce die_for_required_opt() Siddharth Shrimali
2026-06-03 19:48   ` Jean-Noël AVILA
2026-06-03 11:10 ` [PATCH 2/2] builtin/add: use die_for_required_opt() helper Siddharth Shrimali

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox