Skip to content

materialize does not restore the executable bit on checkout #237

Closed

Description

@tonibergholm-codento

Found while reviewing #236 (Codex review comment on worktree::lay_out_added_view).

worktree::materialize (and the widen helper added in #236, which mirrors it) ignores the recorded FileMode and writes with std::fs::write. On Unix a tracked EXEC file therefore comes back without execute bits after switch, merge, rebase or sparse set, and the next commit reads it back as FILE. read_worktree does read the mode from the filesystem (worktree.rs ~143), so the round trip is lossy.

Suggested fix: apply the mode in one shared write helper used by materialize and lay_out_added_view, with a test per entry point. Needs a check that it does not flip modes on filesystems without a mode bit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions