@devries-cameron20 / t3code-1 / commits / 2b0f08b524
Fork 0

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

fix(shared): ignore unfinished quoted Git config continuations (#30743)

Harjot Singh committed Nov 6, 2026 at 10:06 UTC 2b0f08b5246f59fa57610dcc63e05266d55717ab
2 files changed +5 -3
packages/shared/src/git.test.ts
+2
@@ -112,6 +112,8 @@ describe("isBareGitConfig", () => {
112
113 expect(isBareGitConfig(config)).toBe(true);
114 expect(isBareGitConfig("[core]\nbare = tr\\\nue\\")).toBe(true);
115 + expect(isBareGitConfig('[core]\nbare = "true\\')).toBe(false);
116 + expect(isBareGitConfig('[core]\nbare = "true\\\n')).toBe(false);
117 });
118 });
119
packages/shared/src/git.ts
+3 -3
@@ -175,7 +175,7 @@ function* gitConfigLines(configText: string) {
175 let quoted = false;
176 for (const line of configText.split(/\r?\n/)) {
177 let continued = false;
178 - if (line.endsWith("\\")) {
178 + if (line.endsWith("\\") || pending.length > 0) {
179 for (const [token] of line.matchAll(/\\[\s\S]?|["#;]/g)) {
180 if (token === '"') quoted = !quoted;
181 else if (!quoted && (token === "#" || token === ";")) break;
@@ -186,11 +186,11 @@ function* gitConfigLines(configText: string) {
186 pending += line.slice(0, -1);
187 continue;
188 }
189 - yield pending + line;
189 + if (!quoted) yield pending + line;
190 pending = "";
191 quoted = false;
192 }
193 - if (pending.length > 0) yield pending;
193 + if (pending.length > 0 && !quoted) yield pending;
194 }
195
196 function parseGitConfigValue(raw: string): string {