Preserve indexed executable modes in WASI git

This commit is contained in:
2026-11-06 20:04:06 +00:00
parent 3e33a85a6c
commit cd324678fe
3 changed files with 37 additions and 3 deletions
+17 -1
View File
@@ -238,6 +238,22 @@ pub fn status(repo: &gix::Repository) -> Result<Status> {
.map_err(|e| error("status", e))?;
for item in iter {
let item = item.map_err(|e| error("status", e))?;
#[cfg(target_os = "wasi")]
if matches!(
&item,
Item::Modification {
status: gix::status::plumbing::index_as_worktree::EntryStatus::Change(
gix::status::plumbing::index_as_worktree::Change::Modification {
executable_bit_changed: true,
content_change: None,
..
}
),
..
}
) {
continue;
}
let path = item.rela_path().to_str_lossy().into_owned();
let Some(summary) = item.summary() else {
continue;
@@ -332,7 +348,7 @@ fn worktree_file(
} else {
entry.mode
};
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "wasi")))]
let mode = if mode != 0o120000 && caps.executable_bit {
use std::os::unix::fs::PermissionsExt;
if meta.permissions().mode() & 0o111 != 0 {
+2 -2
View File
@@ -229,7 +229,7 @@ fn work_entry(
Mode::SYMLINK,
)
} else if m.is_file() {
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "wasi")))]
let mode = {
use std::os::unix::fs::PermissionsExt;
if m.permissions().mode() & 0o111 != 0 {
@@ -238,7 +238,7 @@ fn work_entry(
Mode::FILE
}
};
#[cfg(not(unix))]
#[cfg(any(not(unix), target_os = "wasi"))]
let mode = if previous == Some(Mode::FILE_EXECUTABLE) {
Mode::FILE_EXECUTABLE
} else {