forked from GitoxideLabs/gitoxide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request GitoxideLabs#1764 from EliahKagan/finalize-entry
Refine how `finalize_entry` sets executable bits
- Loading branch information
Showing
5 changed files
with
172 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#[test] | ||
#[cfg(unix)] | ||
#[cfg_attr(not(target_os = "linux"), ignore = "The test itself uses /proc")] | ||
fn umask() { | ||
use std::fs::File; | ||
use std::io::{BufRead, BufReader}; | ||
|
||
use bstr::ByteSlice; | ||
// Check against the umask obtained via a less portable but also completely safe method. | ||
let less_portable = BufReader::new(File::open("/proc/self/status").expect("can open")) | ||
.split(b'\n') | ||
.find_map(|line| line.expect("can read").strip_prefix(b"Umask:\t").map(ToOwned::to_owned)) | ||
.expect("has umask line") | ||
.to_str() | ||
.expect("umask line is valid UTF-8") | ||
.to_owned(); | ||
let more_portable = format!("{:04o}", gix_testtools::umask()); | ||
assert_eq!(more_portable, less_portable); | ||
} |