The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 04:30 UTC
fix(server): read continued core.bare values during onboarding (#30174)
Co-authored-by: maria-rcks <maria@kuuro.net>
Harjot Singh committed
Nov 4, 2026 at 05:17 UTC
8bc344bd9c311de4b8cab9e0e5d9db8f2d963502
2 files changed
+34
-1
packages/shared/src/git.test.ts
+10
@@ -7,6 +7,7 @@ import {
7
formatGeneratedBranchName,
8
buildTemporaryWorktreeBranchName,
9
flattenTemporaryWorktreeBranchName,
10
+ isBareGitConfig,
11
isTemporaryWorktreeBranch,
12
normalizeGitRemoteUrl,
13
parseOriginUrlFromGitConfig,
@@ -64,6 +65,15 @@ describe("normalizeGitRemoteUrl", () => {
65
});
66
});
67
68
+describe("isBareGitConfig", () => {
69
+ it("reads continued bare values after comments and at end of input", () => {
70
+ const config = ["[core] bare = false # ignored backslash \\", 'bare = "tr\\', 'ue"'].join("\n");
71
+
72
+ expect(isBareGitConfig(config)).toBe(true);
73
+ expect(isBareGitConfig("[core]\nbare = tr\\\nue\\")).toBe(true);
74
+ });
75
+});
76
+
77
describe("parseOriginUrlFromGitConfig", () => {
78
it("reads the origin url and ignores other remotes", () => {
79
const config = [
packages/shared/src/git.ts
+24
-1
@@ -170,6 +170,29 @@ export function normalizeGitRemoteUrl(value: string): string {
170
return repository === null ? lowerCaseRemote(value) : `${repository.host}/${repository.path}`;
171
}
172
173
+function* gitConfigLines(configText: string) {
174
+ let pending = "";
175
+ let quoted = false;
176
+ for (const line of configText.split(/\r?\n/)) {
177
+ let continued = false;
178
+ if (line.endsWith("\\")) {
179
+ for (const [token] of line.matchAll(/\\[\s\S]?|["#;]/g)) {
180
+ if (token === '"') quoted = !quoted;
181
+ else if (!quoted && (token === "#" || token === ";")) break;
182
+ else if (token === "\\") continued = true;
183
+ }
184
+ }
185
+ if (continued) {
186
+ pending += line.slice(0, -1);
187
+ continue;
188
+ }
189
+ yield pending + line;
190
+ pending = "";
191
+ quoted = false;
192
+ }
193
+ if (pending.length > 0) yield pending;
194
+}
195
+
196
function parseGitConfigValue(raw: string): string {
197
let out = "";
198
let quoted = false;
@@ -193,7 +216,7 @@ function parseGitConfigValue(raw: string): string {
216
export function isBareGitConfig(configText: string): boolean {
217
let inCore = false;
218
let bare = false;
196
- for (const rawLine of configText.split(/\r?\n/)) {
219
+ for (const rawLine of gitConfigLines(configText)) {
220
let line = rawLine.trim();
221
// Git accepts the first setting on the section header's own line.
222
const header = /^\[\s*([^\]]*?)\s*\](.*)$/.exec(line);