Skip to content

Status#changed? is case-sensitive despite git config #586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Jul 2, 2022 · 1 comment · Fixed by #724
Closed

Status#changed? is case-sensitive despite git config #586

ghost opened this issue Jul 2, 2022 · 1 comment · Fixed by #724

Comments

@ghost
Copy link

ghost commented Jul 2, 2022

Subject of the issue

When the git repo is configured to track files case-insensitively and a file name has a different letter case, Status#changed? will not report if the file has been modified.

Your environment

  • git (1.11.0)
  • ruby 2.7.3

Steps to reproduce

  • init a new git repo
  • (have default config core.ignoreCase true)
  • commit FILE
  • rename to file
  • edit file
  • in ruby-git, call Status#changed?("file")

Expected behaviour

expected to compare tracked file case-insensitively with given filename (ie "FILE".downcase == "file".downcase)

Actual behaviour

returns false

nevinera added a commit to nevinera/ruby-git that referenced this issue May 26, 2024
Fixes ruby-git#586. Also switch to using a direct hash lookup, instead of the
prettier `changed.member?`, because when the number of files is large,
iterating the hash to construct the "changed" set is nontrivial, and
it's much faster to skip that.
nevinera added a commit to nevinera/ruby-git that referenced this issue May 27, 2024
Fixed ruby-git#586. Include a note about the inconsistent behavior when
ignoreCase is not set to match the case-sensitivity of the file-system
itself.
@nevinera
Copy link
Contributor

I believe #724 will fix this (and the matching issue for added?, deleted?, and untracked?).

Note that the reproduction instructions should also mention that it must be performed on a system with a case insensitive FS - git doesn't actually support setting core.ignoreCase when the filesystem is case-sensitive; you'll get confusing results from both git and this gem in that context.

jcouball pushed a commit that referenced this issue Jun 1, 2024
Fixed #586. Include a note about the inconsistent behavior when
ignoreCase is not set to match the case-sensitivity of the file-system
itself.
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 a pull request may close this issue.

1 participant