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

Re: [PATCH] test-chmtime: use parse_options() to parse command-line flags

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 27, 2026, 18:48 UTC
Message-ID
<xmqqv76nj7ys.fsf@gitster.g>
In-Reply-To
<pull.2280.git.1793099688076.gitgitgadget@gmail.com>
"Shashank S via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>  t/helper/test-chmtime.c | 46 +++++++++++++++++++----------------------
>  1 file changed, 21 insertions(+), 25 deletions(-)

Forgot to mention one thing. Do we have any tests to cover the behaviour of this test helper? If not, should we add some (not a rhetorical question)?

Also, one thing I missed is that the original ignored --verbose when --get was given, since they contradict with each other. Shouldn't we make them explicitly incompatible with each other, perhaps before where we call timespec_arg()?

Show 10 quoted lines
> @@ -68,40 +71,37 @@ static int timespec_arg(const char *arg, long int *set_time, int *set_eq)
>  
>  int cmd__chmtime(int argc, const char **argv)
>  {
> ...
> +	argc = parse_options(argc, argv, NULL, options, chmtime_usage,
> +			     PARSE_OPT_KEEP_UNKNOWN_OPT);
>  
> +	if (argc < 1 || (!get && !verbose && argc < 2))
> +		usage_with_options(chmtime_usage, options);
	die_for_incompatible_opt2(get, "--get", verbose, "--verbose");
Show 6 quoted lines
>  	if (timespec_arg(argv[i], &set_time, &set_eq)) {
>  		++i;
> ...
>  }
>
> base-commit: 7e34d8174dcda3435d1404c9a30bef46afe6c13e
Previous: Shashank SNext: Shashank S
Message 4 of 6 in “test-chmtime: use parse_options() to parse command-line flags”
  1. test-chmtime: use parse_options() to parse command-line flagsShashank S via GitGitGadget, Oct 27, 2026
  2. Junio C HamanoOct 27, 2026
  3. Shashank SOct 29, 2026
  4. Junio C HamanoOct 27, 2026
  5. Shashank SOct 29, 2026
  6. test-chmtime: use parse_options() to parse command-line flagsShashank S via GitGitGadget, Oct 30, 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.