Skip to content

diff: accept clustered short options such as -qst and -ut - #304

Open
SichenLiang wants to merge 1 commit into
uutils:mainfrom
SichenLiang:short-option-clusters
Open

SichenLiang wants to merge 1 commit into
uutils:mainfrom
SichenLiang:short-option-clusters

Conversation

@SichenLiang

Copy link
Copy Markdown

GNU diff allows short options that take no argument to be combined, so diff -qst a b is the same as diff -q -s -t a b. uutils treated the combined form as one unknown option.

$ printf 'a\nb\n' > a; printf 'a\nc\n' > b
$ diff -qst a b; echo $?
Files a and b differ
1

The existing argument-free options (-c, -e, -q, -s, -t, -u and -y) now use the same path whether they are separate or clustered. Output-style conflicts are checked in the same place, while a word containing an unsupported option keeps the old handling.

Fixes #298

Handle the seven short options that take no argument through the same
path in their separate and clustered forms. Keeping the existing fallback
when a word contains an unsupported option, and share the output-style
conflict checks between both forms.

Add parser and command-output tests for clustered options.
@codspeed

codspeed Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 3.15%

⚠️ 24 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 8 improved benchmarks
✅ 18 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ ⚠️ cmd_cmp_gnu_equal[25000] 23 µs 22.3 µs +3.22%
⚡ ⚠️ cmd_cmp_gnu_equal[10000] 23 µs 22.3 µs +3.21%
⚡ ⚠️ cmd_diff_gnu_equal[10000] 23.1 µs 22.3 µs +3.21%
⚡ ⚠️ cmd_diff_gnu_equal[1000] 23.1 µs 22.3 µs +3.21%
⚡ ⚠️ cmd_diff_gnu_equal[25000] 23.1 µs 22.4 µs +3.2%
⚡ ⚠️ cmd_cmp_gnu_equal[100] 23.6 µs 22.9 µs +3.13%
⚡ ⚠️ cmd_diff_gnu_equal[100] 24.4 µs 23.7 µs +3.03%
⚡ ⚠️ cmd_diff_release_equal[1000] 24.4 µs 23.6 µs +3.03%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing SichenLiang:short-option-clusters (385935e) with main (2d605f6)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diff: clustered short options such as -ut and -qst are rejected

1 participant