codeowners icon indicating copy to clipboard operation
codeowners copied to clipboard

feat: codeowners case sensitivity

Open chrisgarber opened this issue 3 years ago • 6 comments

CODEOWNERS is a case sensitive file. We can still use the ignore library, we just need to update it and pass a flag.

  • adds tests (jest)
  • adds a launcher for VS code to debug tests
  • updates ignore library
  • passes flag to ensure case sensitivity to ignore library

chrisgarber avatar Nov 11 '21 18:11 chrisgarber

love this but how does this affect people on e.g. macOS with case-insensitive file systems?

beaugunderson avatar Nov 11 '21 19:11 beaugunderson

I don't think it should have an effect. The issue is that GitHub cares, because it doesn't know what os you're using. If your file system is case insensitive, that's great, but your CODEOWNERS still needs to match the case of the files in your project.

chrisgarber avatar Nov 11 '21 19:11 chrisgarber

I'm trying to think of a case where this would mess up someone working on a mac. I work on a mac as well and was curious why github has behaving differently to this library, this was what I found. Do you have a case where this wouldn't work or would break something in mind?

chrisgarber avatar Nov 11 '21 19:11 chrisgarber

we've had issues where mac git doesn't care, and our software doesn't care, but devs end up with files with different case on their machines (maybe someone changed case of a file later or something); and this would now prevent codeowners from seeing that file as the same

maybe we could make this a flag and change the default using a module like this?

https://www.npmjs.com/package/fs-file-name-sensitive https://www.npmjs.com/package/dir-is-case-sensitive

On Thu, Nov 11, 2021 at 11:30 AM, chrisgarber @.***> wrote:

I don't think it should have an effect. The issue is that GitHub cares, because it doesn't know what os you're using. If your file system is case insensitive, that's great, but your CODEOWNERS still needs to match the case of the files in your project.

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/beaugunderson/codeowners/pull/23#issuecomment-966568013, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAPCX7NS22WW6UN4AFDRALULQKWPANCNFSM5H3EHMUA .

beaugunderson avatar Nov 11 '21 19:11 beaugunderson

I'm beginning to see the fundamental problem here. Git's file system is always case sensitive, but on case-insensitive systems differently cased files/dirs can't be distinguished. This can lead to hidden files: if you have a image.jpg and an image.JPG the insensitive file system will only display one of them, but the remote will hold both.

Unfortunately, for CODEOWNERS it doesn't matter how the OS sees the file system, because the git remote is the true arbiter of how it is applied. When it comes down to it case insensitive file systems can become out sync with the file system of their remotes. Teams that work with a mix of file systems should be aware of these challenges and endeavor to come to file naming standards. Since CODEOWNERS enforces case sensitivity I believe this repo should as well. I could be convinced to allow a case insensitive check with a flag, but I think this would lead users in the wrong direction, as CODEOWNERS is always case sensitive.

It does seem like there's a tool or two missing in the ecosystem to either ensure that files and dirs are lowercased, or to correct potential casing issues. There is this action to check for those conflicting file paths I mentioned earlier, but it would be nice if there were a utility I could run on my case insensitive system to "correct" the casing of files.

chrisgarber avatar Nov 12 '21 15:11 chrisgarber

yes, we used a webpack plugin to enforce that the on-disk capitalization matched the import capitalization because we had one Linux developer who ran into issues when it was not enforced (rare, but they did happen)

On Fri, Nov 12, 2021 at 7:57 AM, chrisgarber @.***> wrote:

I'm beginning to see the fundamental problem here. Git's file system is always case sensitive, but on case-insensitive systems differently cased files/dirs can't be distinguished. This can lead to hidden files: if you have a image.jpg and an image.JPG the insensitive file system will only display one of them, but the remote will hold both.

Unfortunately, for CODEOWNERS it doesn't matter how the OS sees the file system, because the git remote is the true arbiter of how it is applied. When it comes down to it case insensitive file systems can become out sync with the file system of their remotes. Teams that work with a mix of file systems should be aware of these challenges and endeavor to come to file naming standards. Since CODEOWNERS enforces case sensitivity I believe this repo should as well. I could be convinced to allow a case insensitive check with a flag, but I think this would lead users in the wrong direction, as CODEOWNERS is always case sensitive.

It does seem like there's a tool or two missing in the ecosystem to either ensure the casing of a file system, or to correct potential casing issues. There is this action https://github.com/marketplace/actions/case-sensitivity-checker to check for those conflicting file paths I mentioned earlier, but it would be nice if there were a utility I could run on my case insensitive system to "correct" the casing of files.

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/beaugunderson/codeowners/pull/23#issuecomment-967224353, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAPCX4WAUBU3XBS2QCGDULULU2O3ANCNFSM5H3EHMUA .

beaugunderson avatar Nov 12 '21 17:11 beaugunderson