-
Notifications
You must be signed in to change notification settings - Fork 726
Generalize testsupport mode normalization by filetype #11375
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
Generalize testsupport mode normalization by filetype #11375
Conversation
|
@slarse is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
| directory @ 0o40000 => directory | normalize_permission_bits(mode), | ||
| symlink @ 0o120000 => symlink | normalize_permission_bits(mode), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a Git perspective it's a bit weird to propagate permission bits on directories and symlinks, as Git does not store those. But the current snapshots do so.
Do we want to "properly" normalize this to a more Git-aligned view (i.e. zero out the permission bits for these types in existing snapshots), or is this fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that if we don't care about "proper" Git normalization for the snapshots, this entire thing could be reduced to just:
fn normalize_mode(mode: u32) -> u32 {
let normalize_permission_bits = |mode: u32| if mode & 0o100 == 0 { 0o644 } else { 0o755 };
(mode & 0o170000) | normalize_permission_bits(mode)
}Because every match arm is just doing the same thing right now, except for the panic, which I don't feel strongly about keeping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, why not go with the minimal version that also can't panic. Let's merge this as well and you can follow it up.
Byron
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for picking this up!
Despite merging the PR now, I'd also be looking forward to the two-line version that won't panic :).
| directory @ 0o40000 => directory | normalize_permission_bits(mode), | ||
| symlink @ 0o120000 => symlink | normalize_permission_bits(mode), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, why not go with the minimal version that also can't panic. Let's merge this as well and you can follow it up.
🧢 Changes
Continuation of #11363 with a suggestion to generalize the testsupport file mode normalization.