| ... | @@ -1177,6 +1177,31 @@ it.layer(TestLayer)("git integration", (it) => { | ... | @@ -1177,6 +1177,31 @@ it.layer(TestLayer)("git integration", (it) => { |
| 1177 | }), | 1177 | }), |
| 1178 | ); | 1178 | ); |
| 1179 | | 1179 | |
| | 1180 | it.effect("pushes with upstream setup when no comparable base branch exists", () => |
| | 1181 | Effect.gen(function* () { |
| | 1182 | const tmp = yield* makeTmpDir(); |
| | 1183 | const remote = yield* makeTmpDir(); |
| | 1184 | yield* git(tmp, ["init", "--initial-branch=trunk"]); |
| | 1185 | yield* git(tmp, ["config", "user.email", "test@test.com"]); |
| | 1186 | yield* git(tmp, ["config", "user.name", "Test"]); |
| | 1187 | yield* writeTextFile(path.join(tmp, "README.md"), "hello\n"); |
| | 1188 | yield* git(tmp, ["add", "README.md"]); |
| | 1189 | yield* git(tmp, ["commit", "-m", "initial"]); |
| | 1190 | yield* git(remote, ["init", "--bare"]); |
| | 1191 | yield* git(tmp, ["remote", "add", "origin", remote]); |
| | 1192 | yield* git(tmp, ["checkout", "-b", "feature/no-base"]); |
| | 1193 | |
| | 1194 | const core = yield* GitCore; |
| | 1195 | const pushed = yield* core.pushCurrentBranch(tmp, null); |
| | 1196 | expect(pushed.status).toBe("pushed"); |
| | 1197 | expect(pushed.setUpstream).toBe(true); |
| | 1198 | expect(pushed.upstreamBranch).toBe("origin/feature/no-base"); |
| | 1199 | expect(yield* git(tmp, ["rev-parse", "--abbrev-ref", "@{upstream}"])).toBe( |
| | 1200 | "origin/feature/no-base", |
| | 1201 | ); |
| | 1202 | }), |
| | 1203 | ); |
| | 1204 | |
| 1180 | it.effect("includes command context when worktree removal fails", () => | 1205 | it.effect("includes command context when worktree removal fails", () => |
| 1181 | Effect.gen(function* () { | 1206 | Effect.gen(function* () { |
| 1182 | const tmp = yield* makeTmpDir(); | 1207 | const tmp = yield* makeTmpDir(); |