@devries-cameron20 / t3code-1 / commits / 8bfe94af18
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(source-control): renamed files in GitHub, GitLab and Azure DevOps diffs show as renames (#29774)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>

Alex Southwell committed Nov 3, 2026 at 23:25 UTC 8bfe94af18e11f6a9e57a158bca69e5b3094cb24
6 files changed +11
packages/source-control-azure-devops/src/server/azureDevOpsDiff.test.ts
+2
@@ -80,6 +80,7 @@ describe("azureDevOpsFilePatch", () => {
80 expect(patch.section).toBe(
81 [
82 "diff --git a/docs/old.md b/docs/new.md",
83 + "similarity index 100%",
84 "rename from docs/old.md",
85 "rename to docs/new.md",
86 "--- a/docs/old.md",
@@ -209,6 +210,7 @@ describe("a file Azure names something a patch header cannot carry plainly", ()
210 expect(patch.section).toBe(
211 [
212 'diff --git "a/docs/old\\tname.md" "b/docs/new\\tname.md"',
213 + "similarity index 100%",
214 'rename from "docs/old\\tname.md"',
215 'rename to "docs/new\\tname.md"',
216 '--- "a/docs/old\\tname.md"',
packages/source-control-azure-devops/src/server/azureDevOpsDiff.ts
+2
@@ -91,7 +91,9 @@ function patchHeader(change: AzureDevOpsChangeEntry): string {
91 if (change.changeKind === "new") lines.push("new file mode 100644");
92 if (change.changeKind === "deleted") lines.push("deleted file mode 100644");
93 if (change.changeKind === "rename-pure" || change.changeKind === "rename-changed") {
94 + // Pierre needs this header to keep the rename.
95 lines.push(
96 + `similarity index ${change.changeKind === "rename-pure" ? 100 : 0}%`,
97 `rename from ${quoteGitPatchPath(change.oldPath)}`,
98 `rename to ${quoteGitPatchPath(change.path)}`,
99 );
packages/source-control-github/src/server/gitHubPullRequestJson.test.ts
+2
@@ -1460,6 +1460,7 @@ describe("decodePullRequestFilesJson", () => {
1460 expect(result.patch).toBe(
1461 [
1462 String.raw`diff --git "a/ old\\name.ts " "b/ new\\name.ts "`,
1463 + "similarity index 100%",
1464 String.raw`rename from " old\\name.ts "`,
1465 String.raw`rename to " new\\name.ts "`,
1466 String.raw`--- "a/ old\\name.ts "`,
@@ -1515,6 +1516,7 @@ describe("decodePullRequestFilesJson", () => {
1516 expect(result.patch).toBe(
1517 [
1518 "diff --git a/src/old.ts b/src/new.ts",
1519 + "similarity index 0%",
1520 "rename from src/old.ts",
1521 "rename to src/new.ts",
1522 "--- a/src/old.ts",
packages/source-control-github/src/server/gitHubPullRequestJson.ts
+2
@@ -1639,6 +1639,8 @@ function toFilesPatch(entries: ReadonlyArray<unknown>): GitHubPullRequestFilesPa
1639 ...(status === "removed" ? ["deleted file mode 100644"] : []),
1640 ...(status === "renamed"
1641 ? [
1642 + // The files API has no similarity score; Pierre needs this header to keep the rename.
1643 + `similarity index ${hunks.length > 0 || (value.additions ?? 0) + (value.deletions ?? 0) > 0 ? 0 : 100}%`,
1644 `rename from ${quoteGitPatchPath(oldPath)}`,
1645 `rename to ${quoteGitPatchPath(value.filename)}`,
1646 ]
packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts
+1
@@ -372,6 +372,7 @@ describe("decodeMergeRequestDiffsJson", () => {
372 expect(result.patch).toBe(
373 [
374 String.raw`diff --git "a/ old\\name.ts " "b/ new\\name.ts "`,
375 + "similarity index 100%",
376 String.raw`rename from " old\\name.ts "`,
377 String.raw`rename to " new\\name.ts "`,
378 String.raw`--- "a/ old\\name.ts "`,
packages/source-control-gitlab/src/server/gitLabMergeRequestJson.ts
+2
@@ -724,6 +724,8 @@ function mergeRequestPatch(entries: ReadonlyArray<unknown>): GitLabMergeRequestP
724 ...(value.deleted_file === true ? [`deleted file mode ${value.a_mode ?? "100644"}`] : []),
725 ...(value.renamed_file === true
726 ? [
727 + // GitLab has no similarity score; Pierre needs this header to keep the rename.
728 + `similarity index ${hunks.length > 0 || value.too_large === true || value.collapsed === true ? 0 : 100}%`,
729 `rename from ${quoteGitPatchPath(value.old_path)}`,
730 `rename to ${quoteGitPatchPath(value.new_path)}`,
731 ]