You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[plan] Fix push_signed_commits.cjs to read file content from commit objects, not working tree #26254
Fix push_signed_commits.cjs to read file content from the specific commit object rather than the working tree.
Context
Reported in issue #26156. Currently the code reads file content using fs.readFileSync(path.join(cwd, filePath)) (lines 128, 132), which always reads from the working tree. This is incorrect when replaying older commits in a series, as the working tree reflects the latest commit, not the commit being replayed.
Bug Details
// WRONG: always reads from working tree, not from the commit being processedconstcontent=fs.readFileSync(path.join(cwd,parts[2]));
If commits A → B → C are being pushed, when processing commit A, the code reads files from the working tree (which is at C), so commits A and B will contain the wrong file contents.
Fix
Replace all fs.readFileSync calls with git show <sha>:<path> to read the blob content at the specific commit:
Activity