Skip to content

[plan] Fix copy vs rename handling and double-quoted filenames in push_signed_commits.cjs #26253

@github-actions

Description

@github-actions

Objective

Fix two related bugs in actions/setup/js/push_signed_commits.cjs related to diff parsing.

Context

Reported in issue #26156. The push_signed_commits.cjs file has incorrect handling of file status parsing from git diff --name-status.

Bugs to Fix

1. Copy entries treated as renames (line 125-129)

Currently, when a file status starts with C (copy), the old file is added to deletions. This is wrong — a copy keeps the original file. Only renames (R) should delete the old path.

// WRONG: deletes old file for copies too
} else if (status.startsWith("R") || status.startsWith("C")) {
  deletions.push({ path: parts[1] });  // ← should not happen for copies

Fix: Only add the old path to deletions when status starts with R, not C.

2. C-quoted (double-quoted) filenames not handled (lines 113-134)

git diff may C-quote filenames containing special characters (spaces, unicode, etc.) by surrounding them with double-quotes and escaping special characters. The code doesn't handle this.

Fix: Switch from git diff to git diff-tree (more stable, not affected by user git config), and add a helper to unescape C-quoted filenames (strip surrounding ", unescape \\n, \\t, \\\\, \\", octal sequences, etc.).

Files to Modify

  • actions/setup/js/push_signed_commits.cjs

Approach

  1. Replace git diff --name-status ${sha}^ ${sha} with git diff-tree --no-commit-id -r --name-status ${sha}
  2. Add a unquoteCPath(s) helper function to unescape C-quoted paths (strip leading/trailing ", unescape standard C escape sequences and octal codes)
  3. Apply unquoteCPath to all filename parts before using them
  4. Change the copy/rename branch to only push to deletions when status.startsWith("R")

Acceptance Criteria

  • Files with spaces or special characters in filenames are handled correctly
  • Copied files do not have the original path added to deletions
  • Renamed files still correctly add the old path to deletions
  • git diff-tree is used instead of git diff
    Related to bug: multiple critical issues in push_signed_commits #26156

Generated by Plan Command for issue #26156 · ● 383.5K ·

  • expires on Apr 16, 2026, 4:34 PM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions