| ... | ... | @@ -294,6 +294,18 @@ function configureRemote( |
| 294 | 294 | }); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | function configureVisibleRemoteUrlWithLocalRewrite( |
| 298 | cwd: string, |
| 299 | remoteName: string, |
| 300 | visibleUrl: string, |
| 301 | localRemotePath: string, |
| 302 | ): Effect.Effect<void, GitCommandError, GitVcsDriver.GitVcsDriver> { |
| 303 | return Effect.gen(function* () { |
| 304 | yield* runGit(cwd, ["config", `remote.${remoteName}.url`, visibleUrl]); |
| 305 | yield* runGit(cwd, ["config", `url.${localRemotePath}.insteadOf`, visibleUrl]); |
| 306 | }); |
| 307 | } |
| 308 | |
| 297 | 309 | function createTextGeneration(overrides: Partial<FakeGitTextGeneration> = {}): TextGenerationShape { |
| 298 | 310 | const implementation: FakeGitTextGeneration = { |
| 299 | 311 | generateCommitMessage: (input) => |
| ... | ... | @@ -1012,11 +1024,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { |
| 1012 | 1024 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]); |
| 1013 | 1025 | yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-488/statemachine"]); |
| 1014 | 1026 | yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]); |
| 1015 | | yield* runGit(repoDir, [ |
| 1016 | | "config", |
| 1017 | | "remote.fork-seed.url", |
| 1027 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 1028 | repoDir, |
| 1029 | "fork-seed", |
| 1018 | 1030 | "git@github.com:jasonLaster/codething-mvp.git", |
| 1019 | | ]); |
| 1031 | forkDir, |
| 1032 | ); |
| 1020 | 1033 | |
| 1021 | 1034 | const { manager, ghCalls } = yield* makeManager({ |
| 1022 | 1035 | ghScenario: { |
| ... | ... | @@ -1076,17 +1089,19 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { |
| 1076 | 1089 | yield* runGit(repoDir, ["checkout", "-b", "effect-atom"]); |
| 1077 | 1090 | yield* runGit(repoDir, ["push", "-u", "origin", "effect-atom"]); |
| 1078 | 1091 | yield* runGit(repoDir, ["push", "-u", "my-org/upstream", "effect-atom"]); |
| 1079 | | yield* runGit(repoDir, [ |
| 1080 | | "config", |
| 1081 | | "remote.origin.url", |
| 1092 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 1093 | repoDir, |
| 1094 | "origin", |
| 1082 | 1095 | "git@github.com:pingdotgg/codething-mvp.git", |
| 1083 | | ]); |
| 1096 | originDir, |
| 1097 | ); |
| 1084 | 1098 | yield* runGit(repoDir, ["config", "remote.origin.pushurl", originDir]); |
| 1085 | | yield* runGit(repoDir, [ |
| 1086 | | "config", |
| 1087 | | "remote.my-org/upstream.url", |
| 1088 | | "git@github.com:pingdotgg/codething-mvp.git", |
| 1089 | | ]); |
| 1099 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 1100 | repoDir, |
| 1101 | "my-org/upstream", |
| 1102 | "ssh://git@github.com/pingdotgg/codething-mvp.git", |
| 1103 | upstreamDir, |
| 1104 | ); |
| 1090 | 1105 | yield* runGit(repoDir, ["config", "remote.my-org/upstream.pushurl", upstreamDir]); |
| 1091 | 1106 | yield* runGit(repoDir, ["checkout", "main"]); |
| 1092 | 1107 | yield* runGit(repoDir, ["branch", "-D", "effect-atom"]); |
| ... | ... | @@ -1861,11 +1876,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { |
| 1861 | 1876 | const forkDir = yield* createBareRemote(); |
| 1862 | 1877 | yield* runGit(repoDir, ["remote", "add", "fork-seed", forkDir]); |
| 1863 | 1878 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]); |
| 1864 | | yield* runGit(repoDir, [ |
| 1865 | | "config", |
| 1866 | | "remote.fork-seed.url", |
| 1879 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 1880 | repoDir, |
| 1881 | "fork-seed", |
| 1867 | 1882 | "git@github.com:octocat/codething-mvp.git", |
| 1868 | | ]); |
| 1883 | forkDir, |
| 1884 | ); |
| 1869 | 1885 | |
| 1870 | 1886 | const { manager, ghCalls } = yield* makeManager({ |
| 1871 | 1887 | ghScenario: { |
| ... | ... | @@ -1923,17 +1939,19 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { |
| 1923 | 1939 | yield* runGit(repoDir, ["checkout", "-b", "effect-atom"]); |
| 1924 | 1940 | yield* runGit(repoDir, ["push", "-u", "origin", "effect-atom"]); |
| 1925 | 1941 | yield* runGit(repoDir, ["push", "-u", "my-org/upstream", "effect-atom"]); |
| 1926 | | yield* runGit(repoDir, [ |
| 1927 | | "config", |
| 1928 | | "remote.origin.url", |
| 1942 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 1943 | repoDir, |
| 1944 | "origin", |
| 1929 | 1945 | "git@github.com:pingdotgg/codething-mvp.git", |
| 1930 | | ]); |
| 1946 | originDir, |
| 1947 | ); |
| 1931 | 1948 | yield* runGit(repoDir, ["config", "remote.origin.pushurl", originDir]); |
| 1932 | | yield* runGit(repoDir, [ |
| 1933 | | "config", |
| 1934 | | "remote.my-org/upstream.url", |
| 1935 | | "git@github.com:pingdotgg/codething-mvp.git", |
| 1936 | | ]); |
| 1949 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 1950 | repoDir, |
| 1951 | "my-org/upstream", |
| 1952 | "ssh://git@github.com/pingdotgg/codething-mvp.git", |
| 1953 | upstreamDir, |
| 1954 | ); |
| 1937 | 1955 | yield* runGit(repoDir, ["config", "remote.my-org/upstream.pushurl", upstreamDir]); |
| 1938 | 1956 | yield* runGit(repoDir, ["checkout", "main"]); |
| 1939 | 1957 | yield* runGit(repoDir, ["branch", "-D", "effect-atom"]); |
| ... | ... | @@ -2013,11 +2031,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { |
| 2013 | 2031 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]); |
| 2014 | 2032 | yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]); |
| 2015 | 2033 | yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]); |
| 2016 | | yield* runGit(repoDir, [ |
| 2017 | | "config", |
| 2018 | | "remote.fork-seed.url", |
| 2034 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 2035 | repoDir, |
| 2036 | "fork-seed", |
| 2019 | 2037 | "git@github.com:octocat/codething-mvp.git", |
| 2020 | | ]); |
| 2038 | forkDir, |
| 2039 | ); |
| 2021 | 2040 | |
| 2022 | 2041 | const { manager, ghCalls } = yield* makeManager({ |
| 2023 | 2042 | ghScenario: { |
| ... | ... | @@ -2083,11 +2102,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { |
| 2083 | 2102 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]); |
| 2084 | 2103 | yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-142/statemachine"]); |
| 2085 | 2104 | yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]); |
| 2086 | | yield* runGit(repoDir, [ |
| 2087 | | "config", |
| 2088 | | "remote.fork-seed.url", |
| 2105 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 2106 | repoDir, |
| 2107 | "fork-seed", |
| 2089 | 2108 | "git@github.com:octocat/codething-mvp.git", |
| 2090 | | ]); |
| 2109 | forkDir, |
| 2110 | ); |
| 2091 | 2111 | |
| 2092 | 2112 | const { manager, ghCalls } = yield* makeManager({ |
| 2093 | 2113 | ghScenario: { |
| ... | ... | @@ -2263,11 +2283,12 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { |
| 2263 | 2283 | yield* runGit(repoDir, ["push", "-u", "fork-seed", "statemachine"]); |
| 2264 | 2284 | yield* runGit(repoDir, ["checkout", "-b", "t3code/pr-91/statemachine"]); |
| 2265 | 2285 | yield* runGit(repoDir, ["branch", "--set-upstream-to", "fork-seed/statemachine"]); |
| 2266 | | yield* runGit(repoDir, [ |
| 2267 | | "config", |
| 2268 | | "remote.fork-seed.url", |
| 2286 | yield* configureVisibleRemoteUrlWithLocalRewrite( |
| 2287 | repoDir, |
| 2288 | "fork-seed", |
| 2269 | 2289 | "git@github.com:octocat/codething-mvp.git", |
| 2270 | | ]); |
| 2290 | forkDir, |
| 2291 | ); |
| 2271 | 2292 | |
| 2272 | 2293 | const { manager, ghCalls } = yield* makeManager({ |
| 2273 | 2294 | ghScenario: { |
| ... | ... | @@ -3147,7 +3168,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => { |
| 3147 | 3168 | fs.writeFileSync(path.join(repoDir, "hooked.txt"), "hooked\n"); |
| 3148 | 3169 | fs.writeFileSync( |
| 3149 | 3170 | path.join(repoDir, ".git", "hooks", "pre-commit"), |
| 3150 | | '#!/bin/sh\necho "hook: start" >&2\nsleep 1\necho "hook: end" >&2\n', |
| 3171 | '#!/bin/sh\necho "hook: start" >&2\nsleep 0.05\necho "hook: end" >&2\n', |
| 3151 | 3172 | { mode: 0o755 }, |
| 3152 | 3173 | ); |
| 3153 | 3174 | |