Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(source-control): preserve merge-message code indented with spaces before a tab #48282

Opensaphid(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48282/headopened View on GitHub

Showing 2 changed files with 7 additions and 1 deletion.

x
0 of 2 viewed, 2 left
6 additions and 0 deletionspackages/source-control-core/src/server/mergeMessage.test.tsModified
View file
@@ -56,6 +56,12 @@
);
});
​
+ it.each([1, 2, 3])("preserves indented code with %i spaces before a tab", (spaces) => {
+ const content = `Example:\n\n${" ".repeat(spaces)}\tCo-authored-by: Claude <noreply@anthropic.com>`;
+ const message = `${content}\n\nCo-authored-by: Codex <codex@openai.com>`;
+ expect(removeAgentCredits(message)).toBe(content);
+ });
+​
it.each(["``` text ```", " ```", "\t~~~"])(
"removes trailers after a line that cannot open a fence: %s",
(line) => {
1 addition and 1 deletionpackages/source-control-core/src/server/mergeMessage.tsModified
View file
@@ -32,7 +32,7 @@
let removed = false;
const lines = message.split(/(?<=\n)/).filter((rawLine) => {
const line = rawLine.replace(/\r?\n$/, "");
- if (/^(?: {4}|\t)/.test(line)) return true;
+ if (/^(?: {4}| {0,3}\t)/.test(line)) return true;
const delimiter = /^ {0,3}(`{3,}|~{3,})([^\r\n]*)$/.exec(line);
const marker = delimiter?.[1];
const remainder = delimiter?.[2] ?? "";