Repository navigation
diff: compare DIR/FILE with FILE when stdin is a directory - #318
Conversation
|
GNU diffutils testsuite comparison: |
Merging this PR will degrade performance by 9.11%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes |
cbfb6e5 to
45a2513
Compare
45a2513 to
dd4a948
Compare
dd4a948 to
a7499b5
Compare
a7499b5 to
cc55f08
Compare
There was a problem hiding this comment.
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.
cc55f08 to
2dd7cc3
Compare
There was a problem hiding this comment.
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.
2dd7cc3 to
b5da98a
Compare
There was a problem hiding this comment.
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
1 open issue
Review effort: Lite
| /// When standard input is a directory, returns the path of the entry in it | ||
| /// that has the same name as `other`, provided `other` is not a directory. | ||
| /// Entries are reached through `/dev/fd/0`, which only names the directory | ||
| /// itself where it links to the open file, as with Linux procfs. | ||
| #[cfg(any(target_os = "linux", target_os = "android"))] | ||
| fn stdin_directory_entry(other: &OsString) -> Option<OsString> { | ||
| use std::os::fd::AsFd; | ||
| use std::path::Path; | ||
|
|
||
| let stdin_is_dir = io::stdin() | ||
| .as_fd() | ||
| .try_clone_to_owned() | ||
| .ok() | ||
| .and_then(|fd| fs::File::from(fd).metadata().ok()) | ||
| .is_some_and(|metadata| metadata.is_dir()); | ||
| let other = Path::new(other); | ||
| if !stdin_is_dir || other.is_dir() { | ||
| return None; | ||
| } | ||
| Some( | ||
| Path::new("/dev/fd/0") | ||
| .join(other.file_name()?) | ||
| .into_os_string(), | ||
| ) | ||
| } |

Stack created with GitHub Stacks CLI • Give Feedback 💬