From 02af44ee7ae6efa846297beceeccfa5487f14491 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 02:20:28 +0000 Subject: [PATCH 1/4] plan: use git cat-file blob instead of git show in readBlobAsBase64 Agent-Logs-Url: https://github.com/github/gh-aw/sessions/399a3c88-0473-46c9-b47e-197bd513dccb Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .mcp.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .mcp.json diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 00000000000..96e7285c803 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,11 @@ +{ + "servers": { + "github-agentic-workflows": { + "command": "gh", + "args": [ + "aw", + "mcp-server" + ] + } + } +} \ No newline at end of file From a73ccdd094457b72e09efd6fb29fded781b89ae1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 02:22:03 +0000 Subject: [PATCH 2/4] refactor: use git cat-file blob instead of git show in readBlobAsBase64 Agent-Logs-Url: https://github.com/github/gh-aw/sessions/399a3c88-0473-46c9-b47e-197bd513dccb Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/push_signed_commits.cjs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/actions/setup/js/push_signed_commits.cjs b/actions/setup/js/push_signed_commits.cjs index 9f7beccd32e..a86a5633423 100644 --- a/actions/setup/js/push_signed_commits.cjs +++ b/actions/setup/js/push_signed_commits.cjs @@ -77,21 +77,20 @@ function unquoteCPath(s) { } /** - * Read a blob from a specific commit as a base64-encoded string using - * `git show :`. The raw bytes emitted by git are collected via - * the `exec.exec` stdout listener so that binary files are not corrupted by - * any UTF-8 decoding layer (unlike `exec.getExecOutput` which always passes + * Read a blob object as a base64-encoded string using `git cat-file blob + * `. The raw bytes emitted by git are collected via the + * `exec.exec` stdout listener so that binary files are not corrupted by any + * UTF-8 decoding layer (unlike `exec.getExecOutput` which always passes * stdout through a `StringDecoder('utf8')`). * - * @param {string} sha - Commit SHA to read the blob from - * @param {string} filePath - Repo-relative path of the file + * @param {string} blobHash - Object hash of the blob (from `git diff-tree --raw` dstHash field) * @param {string} cwd - Working directory of the local git checkout * @returns {Promise} Base64-encoded file contents */ -async function readBlobAsBase64(sha, filePath, cwd) { +async function readBlobAsBase64(blobHash, cwd) { /** @type {Buffer[]} */ const chunks = []; - await exec.exec("git", ["show", `${sha}:${filePath}`], { + await exec.exec("git", ["cat-file", "blob", blobHash], { cwd, silent: true, listeners: { @@ -200,6 +199,7 @@ async function pushSignedCommits({ githubClient, owner, repo, branch, baseRef, c } const srcMode = modeFields[0]; // source file mode (e.g. 100644, 100755, 120000, 160000) const dstMode = modeFields[1]; // destination file mode (e.g. 100644, 100755, 120000, 160000) + const dstHash = modeFields[3]; // destination blob hash (object ID of the file in this commit) const status = modeFields[4]; // A=Added, M=Modified, D=Deleted, R=Renamed, C=Copied const paths = line.slice(tabIdx + 1).split("\t"); @@ -231,7 +231,7 @@ async function pushSignedCommits({ githubClient, owner, repo, branch, baseRef, c if (dstMode === "100755") { core.warning(`pushSignedCommits: executable bit on ${renamedPath} will be lost in signed commit (GitHub GraphQL does not support mode 100755)`); } - additions.push({ path: renamedPath, contents: await readBlobAsBase64(sha, renamedPath, cwd) }); + additions.push({ path: renamedPath, contents: await readBlobAsBase64(dstHash, cwd) }); } else if (status && status.startsWith("C")) { // Copy: source path is kept (no deletion), only the destination path is added const copiedPath = unquoteCPath(paths[1]); @@ -250,7 +250,7 @@ async function pushSignedCommits({ githubClient, owner, repo, branch, baseRef, c if (dstMode === "100755") { core.warning(`pushSignedCommits: executable bit on ${copiedPath} will be lost in signed commit (GitHub GraphQL does not support mode 100755)`); } - additions.push({ path: copiedPath, contents: await readBlobAsBase64(sha, copiedPath, cwd) }); + additions.push({ path: copiedPath, contents: await readBlobAsBase64(dstHash, cwd) }); } else { // Added or Modified if (dstMode === "160000") { @@ -264,7 +264,7 @@ async function pushSignedCommits({ githubClient, owner, repo, branch, baseRef, c if (dstMode === "100755") { core.warning(`pushSignedCommits: executable bit on ${filePath} will be lost in signed commit (GitHub GraphQL does not support mode 100755)`); } - additions.push({ path: filePath, contents: await readBlobAsBase64(sha, filePath, cwd) }); + additions.push({ path: filePath, contents: await readBlobAsBase64(dstHash, cwd) }); } } From 7bedfc9ec06b77e5f29bda95f46ae2daf30f66ef Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 02:34:48 +0000 Subject: [PATCH 3/4] fix: fix JSDoc backtick span and remove unrelated .mcp.json Agent-Logs-Url: https://github.com/github/gh-aw/sessions/1d42345b-7c51-488d-8742-525aea3c0abd Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .mcp.json | 11 ----------- actions/setup/js/push_signed_commits.cjs | 10 +++++----- 2 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 .mcp.json diff --git a/.mcp.json b/.mcp.json deleted file mode 100644 index 96e7285c803..00000000000 --- a/.mcp.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "servers": { - "github-agentic-workflows": { - "command": "gh", - "args": [ - "aw", - "mcp-server" - ] - } - } -} \ No newline at end of file diff --git a/actions/setup/js/push_signed_commits.cjs b/actions/setup/js/push_signed_commits.cjs index a86a5633423..2546e0e9bd3 100644 --- a/actions/setup/js/push_signed_commits.cjs +++ b/actions/setup/js/push_signed_commits.cjs @@ -77,11 +77,11 @@ function unquoteCPath(s) { } /** - * Read a blob object as a base64-encoded string using `git cat-file blob - * `. The raw bytes emitted by git are collected via the - * `exec.exec` stdout listener so that binary files are not corrupted by any - * UTF-8 decoding layer (unlike `exec.getExecOutput` which always passes - * stdout through a `StringDecoder('utf8')`). + * Read a blob object as a base64-encoded string using `git cat-file blob `. + * The raw bytes emitted by git are collected via the `exec.exec` stdout + * listener so that binary files are not corrupted by any UTF-8 decoding + * layer (unlike `exec.getExecOutput` which always passes stdout through a + * `StringDecoder('utf8')`). * * @param {string} blobHash - Object hash of the blob (from `git diff-tree --raw` dstHash field) * @param {string} cwd - Working directory of the local git checkout From 19de8b2633a2689c666937207efb52efac5453ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 02:47:51 +0000 Subject: [PATCH 4/4] Add changeset --- .changeset/patch-use-git-cat-file-for-blob-read.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/patch-use-git-cat-file-for-blob-read.md diff --git a/.changeset/patch-use-git-cat-file-for-blob-read.md b/.changeset/patch-use-git-cat-file-for-blob-read.md new file mode 100644 index 00000000000..bb7dc573511 --- /dev/null +++ b/.changeset/patch-use-git-cat-file-for-blob-read.md @@ -0,0 +1,5 @@ +--- +"gh-aw": patch +--- + +Use `git cat-file blob ` instead of `git show :` when reading destination blobs in signed commit push operations, simplifying blob lookup and improving robustness for renamed or copied files.