@ijfw/install 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/install.js +6 -1
- package/package.json +1 -1
package/dist/install.js
CHANGED
|
@@ -225,8 +225,13 @@ function cloneOrPull(dir, branch) {
|
|
|
225
225
|
}
|
|
226
226
|
const hasGit = existsSync2(join2(dir, ".git"));
|
|
227
227
|
if (hasGit) {
|
|
228
|
-
const { status: remoteStatus } = runCheck("git", ["-C", dir, "remote", "get-url", "origin"]);
|
|
228
|
+
const { status: remoteStatus, stdout } = runCheck("git", ["-C", dir, "remote", "get-url", "origin"]);
|
|
229
229
|
if (remoteStatus === 0) {
|
|
230
|
+
const currentOrigin = (stdout || "").trim();
|
|
231
|
+
if (currentOrigin && currentOrigin !== DEFAULT_REPO) {
|
|
232
|
+
console.log(` origin migration: ${currentOrigin} -> ${DEFAULT_REPO}`);
|
|
233
|
+
spawnSync("git", ["-C", dir, "remote", "set-url", "origin", DEFAULT_REPO], { stdio: "inherit" });
|
|
234
|
+
}
|
|
230
235
|
const fetch = spawnSync("git", ["-C", dir, "fetch", "--depth", "1", "origin", branch], { stdio: "inherit" });
|
|
231
236
|
if (fetch.status !== 0) throw new Error(`IJFW fetch did not complete (exit ${fetch.status}) -- check network access and retry.`);
|
|
232
237
|
const co = spawnSync("git", ["-C", dir, "checkout", "-f", "FETCH_HEAD"], { stdio: "inherit" });
|