git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] builtin/add: use die_for_required_opt() helper

From
Christian Couder <christian.couder@gmail.com>
Date
Jun 4, 2026, 08:27 UTC
Message-ID
<CAP8UFD2A6GGwt0=NQQu9oUM2fz+dQzRkB8oHNwE-PJsFdh9wsA@mail.gmail.com>
In-Reply-To
<20260603111044.39116-3-r.siddharth.shrimali@gmail.com>

On Wed, Jun 3, 2026 at 1:11 PM Siddharth Shrimali <r.siddharth.shrimali@gmail.com> wrote:

Show 7 quoted lines
>
> Clean up manual option dependency checks by replacing explicit conditional
> blocks with the newly introduced die_for_required_opt() helper function.
>
> Specifically, simplify the prerequisite check logic for both
> '--ignore-missing' (which requires '--dry-run') and '--pathspec-file-nul'
> (which requires '--pathspec-from-file').

It's a good idea to use the new helper function for '--pathspec-file-nul' requiring '--pathspec-from-file' because it looks like this is tested a lot already:

$ git grep requires | grep 'the option' t2026-checkout-pathspec-file.sh: test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err t2072-restore-pathspec-file.sh: test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && t3601-rm-pathspec-file.sh: test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && t3704-add-pathspec-file.sh: test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && t3909-stash-pathspec-file.sh: test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err t7107-reset-pathspec-file.sh: test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && t7526-commit-pathspec-file.sh: test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&

You could mention this in the commit message.
Also it might be worth squashing this patch into the previous one.
Thanks.
Previous: Siddharth ShrimaliNext: Junio C Hamano
Message 7 of 10 in “parse-options: introduce die_for_required_opt() helper”
  1. 0/2 parse-options: introduce die_for_required_opt() helperSiddharth Shrimali, Jun 3, 2026
  2. 1/2 parse-options: introduce die_for_required_opt()Siddharth Shrimali, Jun 3, 2026
  3. Jean-Noël AVILAJun 3, 2026
  4. Christian CouderJun 4, 2026
  5. Christian CouderJun 4, 2026
  6. 2/2 builtin/add: use die_for_required_opt() helperSiddharth Shrimali, Jun 3, 2026
  7. Christian CouderJun 4, 2026
  8. Junio C HamanoJun 8, 2026
  9. Christian CouderJun 4, 2026
  10. parse-options: introduce die_for_missing_opt()Siddharth Shrimali, Jun 8, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.