arcane-cli 0.17.0 → 0.17.1
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/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1662,6 +1662,8 @@ var READ_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
|
1662
1662
|
"ls-files",
|
|
1663
1663
|
"ls-tree",
|
|
1664
1664
|
"symbolic-ref",
|
|
1665
|
+
"show-ref",
|
|
1666
|
+
"for-each-ref",
|
|
1665
1667
|
"merge-base",
|
|
1666
1668
|
"blame",
|
|
1667
1669
|
"shortlog",
|
|
@@ -1788,10 +1790,25 @@ async function correctUnbornMasterDefault(cwd) {
|
|
|
1788
1790
|
return { corrected: false, to: "main" };
|
|
1789
1791
|
} catch {
|
|
1790
1792
|
}
|
|
1793
|
+
let mainRef;
|
|
1791
1794
|
try {
|
|
1792
|
-
await runGit(cwd, ["
|
|
1793
|
-
return { corrected: false, to: "main" };
|
|
1795
|
+
mainRef = await runGit(cwd, ["for-each-ref", "--format=%(objectname)", "refs/heads/main"]);
|
|
1794
1796
|
} catch {
|
|
1797
|
+
return { corrected: false, to: "main", blockedReason: "target-unreadable" };
|
|
1798
|
+
}
|
|
1799
|
+
if (mainRef.stdout.trim() !== "") {
|
|
1800
|
+
return { corrected: false, to: "main" };
|
|
1801
|
+
}
|
|
1802
|
+
if (mainRef.stderr.trim() !== "") {
|
|
1803
|
+
return { corrected: false, to: "main", blockedReason: "target-unreadable" };
|
|
1804
|
+
}
|
|
1805
|
+
try {
|
|
1806
|
+
await runGit(cwd, ["symbolic-ref", "-q", "refs/heads/main"]);
|
|
1807
|
+
return { corrected: false, to: "main", blockedReason: "target-unreadable" };
|
|
1808
|
+
} catch (error) {
|
|
1809
|
+
if (error.code !== 1) {
|
|
1810
|
+
return { corrected: false, to: "main", blockedReason: "target-unreadable" };
|
|
1811
|
+
}
|
|
1795
1812
|
}
|
|
1796
1813
|
await runGit(cwd, ["symbolic-ref", "HEAD", "refs/heads/main"]);
|
|
1797
1814
|
return { corrected: true, from: current, to: "main" };
|
|
@@ -1907,6 +1924,10 @@ async function runInit(options, targetDir, assetsDir, packageVersion) {
|
|
|
1907
1924
|
printInfo(
|
|
1908
1925
|
`Repointed the unborn branch from "${correction.from}" to "${correction.to}" (avoids the Git for Windows default-branch trap).`
|
|
1909
1926
|
);
|
|
1927
|
+
} else if (correction.blockedReason === "target-unreadable") {
|
|
1928
|
+
printWarning(
|
|
1929
|
+
'This repo\'s "main" branch ref exists but could not be read (broken ref). Left the current branch alone \u2014 repointing onto an unreadable ref risks attaching your staged work to history Arcane cannot see. Check `git for-each-ref refs/heads/main` before committing.'
|
|
1930
|
+
);
|
|
1910
1931
|
}
|
|
1911
1932
|
}
|
|
1912
1933
|
if (gitState.status === "ready" && gitState.uncommittedChanges > 0) {
|