Skip to content

Name the file that has no conflict markers - #1041

Open
VXNCXNX wants to merge 3 commits into
Wilfred:masterfrom
VXNCXNX:fix/help-order-and-single-file-message
Open

Name the file that has no conflict markers#1041
VXNCXNX wants to merge 3 commits into
Wilfred:masterfrom
VXNCXNX:fix/help-order-and-single-file-message

Conversation

@VXNCXNX

@VXNCXNX VXNCXNX commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #764 and #830. Two small commits, one each.

Disclosure per AI_POLICY.md: written with AI assistance (Claude Code). I have read every line of both changes and am accountable for them; happy to discuss any part.

#764 — error message on a single file

Before, any single-file invocation gave the same generic message, whether the file had markers or not:

$ difft /tmp/no_conflict.rs
error: Difftastic requires two paths, or a single file with conflict markers <<<<<<<.

After:

error: /tmp/no_conflict.rs does not contain any conflict markers <<<<<<<. Difftastic requires two paths, or a single file with conflict markers.

You asked that it "explicitly mention that foo.ts had no conflict markers", so the file is named and the reason stated; the USAGE block below is unchanged.

I checked that this message can't lie about a different failure: a nonexistent path, a directory, and a binary file all exit earlier with their own messages (No such file, Expected a file, got a directory, Expected a text file with conflict markers, got a binary file). Only a text file with zero conflicts reaches this branch. An empty file correctly reports having no markers.

#830 — sort options in --help

.next_display_order(None), so clap sorts alphabetically:

before: --context --width --tab-width --display --color --background ...
after:  --background --byte-limit --check-only --color --context --display ...

Sorting is within groups, so DEBUG OPTIONS remains a separate heading, still last, with its three entries. This affects --help only — no shell completions are committed, and manual/difft.1.md is hand-maintained and already alphabetical, so this actually brings --help into agreement with the man page rather than making anything stale. I didn't run just man, since nothing there changed.

Gates

cargo build         clean
cargo test          122 passed; 0 failed; 1 ignored
                     23 passed; 0 failed
cargo fmt --check   clean

Total diff is 5 insertions, 1 deletion across the two commits.

When difftastic is given a single file, the error message did not say
which file was inspected or why it was rejected. Name the file and
state that it contains no conflict markers.

Closes Wilfred#764

Written with AI assistance (Claude Code); I have read the change and am accountable for it.
The options were listed in declaration order, which is essentially
arbitrary. Ask clap to sort them alphabetically instead.

Closes Wilfred#830

Written with AI assistance (Claude Code); I have read the change and am accountable for it.
@Wilfred

Wilfred commented Aug 15, 2026

Copy link
Copy Markdown
Owner

These are unrelated, could you split the PRs?

@VXNCXNX VXNCXNX changed the title Improve the single-file error message, and sort --help options Name the file that has no conflict markers Aug 15, 2026
@VXNCXNX

VXNCXNX commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

Split done. This one is now just the error message change, and the --help sorting moved to #1043.

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.

Improve error message on a single file

2 participants