From: Siddharth Shrimali Date: Wed, 03 Jun 2026 11:10:42 GMT Subject: [PATCH 0/2] parse-options: introduce die_for_required_opt() helper Message-ID: <20260603111044.39116-1-r.siddharth.shrimali@gmail.com> 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