Skip to content

Commit e76cc5d

Browse files
committed
test(shared): cover continued core.bare values in the parser
1 parent b1765dc commit e76cc5d

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎apps/server/src/project/AgentSessionScanner.test.ts‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -897,14 +897,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
897897
yield* fileSystem.makeDirectory(bareGitDir);
898898
yield* fileSystem.writeFileString(
899899
path.join(bareGitDir, "config"),
900-
[
901-
"[core] bare = false # ignored backslash \\",
902-
'bare = "tr\\',
903-
'ue"',
904-
'[remote "origin"]',
905-
"url = [email protected]:pingdotgg/t3code.git",
906-
"",
907-
].join("\n"),
900+
'[core] bare = "true" ; bare repository\n[remote "origin"]\nurl = [email protected]:pingdotgg/t3code.git\n',
908901
);
909902
const dev = path.join(bare, "dev");
910903
const prod = path.join(bare, "prod");

‎packages/shared/src/git.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
formatGeneratedBranchName,
88
buildTemporaryWorktreeBranchName,
99
flattenTemporaryWorktreeBranchName,
10+
isBareGitConfig,
1011
isTemporaryWorktreeBranch,
1112
normalizeGitRemoteUrl,
1213
parseOriginUrlFromGitConfig,
@@ -64,6 +65,14 @@ describe("normalizeGitRemoteUrl", () => {
6465
});
6566
});
6667

68+
describe("isBareGitConfig", () => {
69+
it("reads a continued bare value after a comment ending in a backslash", () => {
70+
const config = ["[core] bare = false # ignored backslash \\", 'bare = "tr\\', 'ue"'].join("\n");
71+
72+
expect(isBareGitConfig(config)).toBe(true);
73+
});
74+
});
75+
6776
describe("parseOriginUrlFromGitConfig", () => {
6877
it("reads the origin url and ignores other remotes", () => {
6978
const config = [

0 commit comments

Comments
 (0)