From: Junio C Hamano <gitster@pobox.com>
To: Siddharth Asthana <siddharthasthana31@gmail.com>
Cc: git@vger.kernel.org, christian.couder@gmail.com,
phillip.wood123@gmail.com, phillip.wood@dunelm.org.uk,
newren@gmail.com, ps@pks.im, karthik.188@gmail.com,
code@khaugsbakk.name, rybak.a.v@gmail.com, jltobler@gmail.com,
toon@iotcl.com, johncai86@gmail.com,
johannes.schindelin@gmx.de
Subject: Re: [PATCH v3 1/3] replay: use die_for_incompatible_opt2() for option validation
Date: Mon, 13 Oct 2025 12:54:03 -0700 [thread overview]
Message-ID: <xmqq347m1stg.fsf@gitster.g> (raw)
In-Reply-To: <20251013182530.33041-2-siddharthasthana31@gmail.com> (Siddharth Asthana's message of "Mon, 13 Oct 2025 23:55:28 +0530")
Siddharth Asthana <siddharthasthana31@gmail.com> writes:
> - 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);
next prev parent reply other threads:[~2025-10-13 19:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-13 18:25 [PATCH v3 0/3] replay: make atomic ref updates the default Siddharth Asthana
2025-10-13 18:25 ` [PATCH v3 1/3] replay: use die_for_incompatible_opt2() for option validation Siddharth Asthana
2025-10-13 19:54 ` Junio C Hamano [this message]
2025-10-13 18:25 ` [PATCH v3 2/3] replay: make atomic ref updates the default behavior Siddharth Asthana
2025-10-13 18:25 ` [PATCH v3 3/3] replay: add replay.defaultAction config option Siddharth Asthana
2025-10-13 18:55 ` [PATCH v3 0/3] replay: make atomic ref updates the default Siddharth Asthana
2025-10-14 21:13 ` Junio C Hamano
2025-10-15 5:05 ` Siddharth Asthana
-- strict thread matches above, loose matches on Subject: below --
2025-09-26 23:08 [PATCH v2 0/1] replay: make atomic ref updates the default behavior Siddharth Asthana
2025-10-13 18:33 ` [PATCH v3 0/3] replay: make atomic ref updates the default Siddharth Asthana
2025-10-13 18:33 ` [PATCH v3 1/3] replay: use die_for_incompatible_opt2() for option validation Siddharth Asthana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq347m1stg.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=jltobler@gmail.com \
--cc=johannes.schindelin@gmx.de \
--cc=johncai86@gmail.com \
--cc=karthik.188@gmail.com \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
--cc=rybak.a.v@gmail.com \
--cc=siddharthasthana31@gmail.com \
--cc=toon@iotcl.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).