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

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);
Previous: Siddharth AsthanaNext: Siddharth Asthana
Message 3 of 8 in “replay: make atomic ref updates the default”
  1. 0/3 replay: make atomic ref updates the defaultSiddharth Asthana, Oct 13, 2025
  2. 1/3 replay: use die_for_incompatible_opt2() for option validationSiddharth Asthana, Oct 13, 2025
  3. Junio C HamanoOct 13, 2025
  4. 2/3 replay: make atomic ref updates the default behaviorSiddharth Asthana, Oct 13, 2025
  5. 3/3 replay: add replay.defaultAction config optionSiddharth Asthana, Oct 13, 2025
  6. Siddharth AsthanaOct 13, 2025
  7. Junio C HamanoOct 14, 2025
  8. Siddharth AsthanaOct 15, 2025

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.