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

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

From
CUCynthia Uche <herroyalpriestess@gmail.com>
Date
Nov 2, 2026, 02:46 UTC
Message-ID
<20261102024623.24897-1-herroyalpriestess@gmail.com>
In-Reply-To
<pull.2280.v2.git.1793350341743.gitgitgadget@gmail.com>
Hi Shashank,

I built v2 (43c96de13e) with NO_RUST=1 and compared it with a build of the base commit (7e34d8174d). t0082 passes 3 of 3. Thanks for taking Junio's three suggestions from v1.

> instead. Pass PARSE_OPT_KEEP_UNKNOWN_OPT so that negative relative time
> offsets (such as '-86400') are not rejected as unknown short options
> and remain in argv for timespec_arg() to parse.

No test covers this. With that argument set to 0, t0082 still passed 3 of 3, while "test-tool chmtime --get -86400 file" failed with "unknown switch `8'" (exit 129). Could you add a test like this one? It passes with v2 and fails without the flag:

  test_expect_success 'negative offset is not taken as an option' '
  	test-tool chmtime =1000000000 file &&
  	test-tool chmtime --get -86400 file >actual &&
  	echo 999913600 >expect &&
  	test_cmp expect actual
  '

Compared with the base build, I also saw three changes that the commit message does not mention:

  - "+0 --get f": base tried to stat "--get"; v2 accepts the flag
    after the timespec and prints the mtime.
  - "-g -v f": base tried to stat "-v" [and still printed the mtime]
    and exited 0; v2 dies (exit 128).
  - usage errors exit with 129 instead of 1.

Could you mention them in the commit message, or let me know if any of them is not intended?

Cynthia
Previous: Shashank S via GitGitGadgetNext: Shashank S
Message 7 of 9 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
  7. Cynthia UcheNov 2, 2026
  8. Shashank SNov 2, 2026
  9. test-chmtime: use parse_options() to parse command-line flagsShashank S via GitGitGadget, Nov 2, 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.