Skip to content

diff: add -S and --ignore-file-name-case - #326

Open
sylvestre wants to merge 1 commit into
diff-quote-namesfrom
diff-starting-file
Open

sylvestre wants to merge 1 commit into
diff-quote-namesfrom
diff-starting-file

Conversation

@sylvestre

Copy link
Copy Markdown
Collaborator

Stack created with GitHub Stacks CLI • Give Feedback 💬

@sylvestre
sylvestre added this pull request to stack #328 October 24, 2026 13:02
@sylvestre
sylvestre marked this pull request as ready for review October 24, 2026 13:14
Copilot AI balanced review requested due to automatic review settings October 24, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI balanced review requested due to automatic review settings October 24, 2026 20:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI balanced review requested due to automatic review settings October 25, 2026 08:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI balanced review requested due to automatic review settings October 25, 2026 09:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI balanced review requested due to automatic review settings November 2, 2026 08:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

5 open issues

Review effort: Lite

Comment thread src/dir_diff.rs
Comment on lines +69 to 80
// -S only applies to the operands, not to their subdirectories.
if let (true, Some(start)) = (self.ancestors.is_empty(), &self.params.starting_file) {
let start = self.name_key(start).into_owned();
from_names.retain(|name| *self.name_key(name) >= *start);
to_names.retain(|name| *self.name_key(name) >= *start);
}
let ancestors_len = self.ancestors.len();
self.ancestors.extend(canonical_dirs);

let entries = pair_entries(&from_names, &to_names, |from, to| {
from.as_encoded_bytes().cmp(to.as_encoded_bytes())
self.name_key(from).cmp(&self.name_key(to))
});
Comment thread src/dir_diff.rs
Comment on lines +140 to +143
if self.params.ignore_file_name_case {
Cow::Owned(fold_file_name_case(name))
} else {
Cow::Borrowed(name.as_encoded_bytes())
Comment thread src/params.rs
Comment on lines +391 to +403
fn directory_entry(dir: &Path, name: &OsStr, params: &Params) -> OsString {
if params.ignore_file_name_case && !dir.join(name).exists() {
let wanted = fold_file_name_case(name);
let entries = std::fs::read_dir(dir).into_iter().flatten().flatten();
if let Some(entry) = entries
.map(|entry| entry.file_name())
.find(|entry| fold_file_name_case(entry) == wanted)
{
return entry;
}
}
name.to_os_string()
}
Comment thread src/params.rs
Comment on lines +420 to +423
param
.strip_prefix(long)
.and_then(|rest| rest.strip_prefix('='))
.or_else(|| param.strip_prefix(short).filter(|value| !value.is_empty()))
Comment thread src/utils.rs
Comment on lines +150 to +156
/// Returns `name` in lowercase, to match file names ignoring case.
pub fn fold_file_name_case(name: &OsStr) -> Vec<u8> {
match name.to_str() {
Some(name) => name.to_lowercase().into_bytes(),
None => name.as_encoded_bytes().to_ascii_lowercase(),
}
}
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

GNU diffutils testsuite comparison:

Test results comparison:
  Current:   TOTAL: 33 / PASSED: 18 / FAILED: 11 / SKIPPED: 4
  Reference: TOTAL: 33 / PASSED: 8 / FAILED: 21 / SKIPPED: 4

Changes from main branch:
  TOTAL: +0
  PASSED: +10
  FAILED: -10

Test improvements (10):
  + binary
  + colliding-file-names
  + colors
  + excess-slash
  + filename-quoting
  + function-line-vs-leading-space
  + label-vs-func
  + new-file
  + starting-file
  + stdin

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.

2 participants