Skip to content

Conversation

@kayoch1n
Copy link

@kayoch1n kayoch1n commented Nov 3, 2025

This PR tries to implement the core.filemode and fix the issue 771, which addresses compatibility issues of go-git on Windows.

C git implements core.filemode in two ways:

  1. Detect via flipping the executable bit and set at the beginning of init/clone
  2. Compute the effective mode value from index via st_mode_from_ce depending on the value of trust_executable_bit, which derives from core.filemode

I've tried to align the implementation with how C git handles core.filemode to ensure consistency:

  1. PlainInit/PlainClone will detect and set the value of core.filemode in .git/config
  2. core.filemode(trustExecutableBit) only takes effect during hash comparison. When an index entry is an
    executable and trustExecutableBit is false, a mode value of 0644 will be used for hashing purposes—while the actual mode stored in the index remains unchanged.

@kayoch1n kayoch1n changed the title git: worktree, implement core.filemode. Fixes #711 git: worktree, implement core.filemode. Fixes #771 Nov 9, 2025
@kayoch1n
Copy link
Author

kayoch1n commented Nov 9, 2025

Hi @pjbgf , would you mind taking a look at this PR when you have a moment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant