fix: preserve file permissions in ConflictResolver atomic write#12
Merged
fix: preserve file permissions in ConflictResolver atomic write#12
Conversation
Merged
Co-authored-by: jaseel0 <225665919+jaseel0@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add foundational features for AI-powered Git CLI tool
fix: preserve file permissions in ConflictResolver atomic write
Mar 3, 2026
naheel0
approved these changes
Mar 3, 2026
jaseel0
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The atomic write in
ConflictResolverused a hardcoded mode0o644when creating the temp file, silently stripping execute bits and any non-default permissions from the resolved file on rename.Changes
ConflictResolver.ts: Before opening the temp file,lstat()the target to get its current mode and applymode & 0o777to thefs.open()call. Falls back to0o644when the target doesn't exist yet.lstat(notstat) to avoid following symlinks — consistent withO_NOFOLLOWalready used on the temp file open.Related Issue
Closes #
Type of Change
Checklist
How Has This Been Tested?
TypeScript compilation verified. CodeQL analysis returned no alerts.
Screenshots (if applicable)
N/A
Additional Notes
The fix is localized to the temp file creation step — the rename and error cleanup paths are unchanged.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.