Re: [PATCH v3 1/3] replay: use die_for_incompatible_opt2() for option validation
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 13, 2025, 19:54 UTC
- Message-ID
- <xmqq347m1stg.fsf@gitster.g>
- In-Reply-To
- <20251013182530.33041-2-siddharthasthana31@gmail.com>
Siddharth Asthana <siddharthasthana31@gmail.com> writes:
Show 5 quoted lines
> - if (advance_name_opt && contained)
> - die(_("options '%s' and '%s' cannot be used together"),
> - "--advance", "--contained");
> + die_for_incompatible_opt2(!!advance_name_opt, "--advance",
> + contained, "--contained");OK. die_for_incompatible_optN() takes "int" for values of individual options, so "turn this into Boolean" operator "!!" is used for advance_name_opt that is a character pointer, but contained is already an integer, so you do not use it there.
Makes sense. Even though the resulting code may look slightly strange, there is nothing wrong here.
> advance_name = xstrdup_or_null(advance_name_opt); > > repo_init_revisions(repo, &revs, prefix);