Skip to content

Commit

Permalink
Merge pull request #1600 from Earthmark/earthmark/wasi_identity
Browse files Browse the repository at this point in the history
Implemented `is_path_owned_by_current_user` for wasi.
  • Loading branch information
Byron committed Sep 21, 2024
2 parents 5ef4d5d + 67536a0 commit be2f093
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ jobs:
- name: Install Rust
run: rustup update stable && rustup default stable && rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: set +x; for name in gix-sec; do (cd $name && cargo build --target ${{ matrix.target }}); done
name: "WASI only: crates without feature toggle"
if: endsWith(matrix.target, '-wasi')
- run: set +x; for name in gix-actor gix-attributes gix-bitmap gix-chunk gix-command gix-commitgraph gix-config-value gix-date gix-glob gix-hash gix-hashtable gix-mailmap gix-object gix-packetline gix-path gix-pathspec gix-prompt gix-quote gix-refspec gix-revision gix-traverse gix-url gix-validate; do (cd $name && cargo build --target ${{ matrix.target }}); done
name: crates without feature toggles
- run: set +x; for feature in progress fs-walkdir-parallel parallel io-pipe crc32 zlib zlib-rust-backend fast-sha1 rustsha1 cache-efficiency-debug; do (cd gix-features && cargo build --features $feature --target ${{ matrix.target }}); done
Expand Down
10 changes: 9 additions & 1 deletion gix-sec/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ pub fn is_path_owned_by_current_user(path: &Path) -> std::io::Result<bool> {
impl_::is_path_owned_by_current_user(path)
}

#[cfg(not(windows))]
// Wasi doesn't have a concept of a user, so this is implicitly true.
#[cfg(target_os = "wasi")]
mod impl_ {
pub fn is_path_owned_by_current_user(_path: &std::path::Path) -> std::io::Result<bool> {
Ok(true)
}
}

#[cfg(all(not(windows), not(target_os = "wasi")))]
mod impl_ {
use std::path::Path;

Expand Down

0 comments on commit be2f093

Please sign in to comment.