Skip to main content

read_worktree_bytes_for_mode

Function read_worktree_bytes_for_mode 

Source
pub fn read_worktree_bytes_for_mode(path: &Path, mode: u32) -> Result<Vec<u8>>
Expand description

Read worktree content for diffing, honoring Git tree modes.

For MODE_SYMLINK entries backed by a symlink on disk this returns the link target path bytes (via read_link), not the contents of the followed file. A symlink entry checked out as a plain file (core.symlinks=false) already holds the target, so it is read like other modes, with a plain read of the path.

ยงErrors

Returns std::io::Error when the path cannot be read.