plugin-updater 1.0.44 → 1.0.45
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/git.js +11 -10
- package/package.json +1 -1
package/dist/git.js
CHANGED
|
@@ -63,19 +63,20 @@ export function updatePlugin(pluginName, gitUrl, branch, commitHash, updateInter
|
|
|
63
63
|
// this checkout — a loader running against a stale core/core-auth is the
|
|
64
64
|
// top cause of "looks broken but it's just stale". Rebuild if they moved.
|
|
65
65
|
if (fs.existsSync(path.join(targetDir, ".gitmodules"))) {
|
|
66
|
-
|
|
66
|
+
// Cheap LOCAL drift check first: `git submodule status` prefixes a line
|
|
67
|
+
// with '+' when the submodule is off its pinned commit and '-' when it is
|
|
68
|
+
// uninitialized. Only pay for the expensive recursive sync/update when one
|
|
69
|
+
// of those is true — otherwise this ran a full submodule update on every
|
|
70
|
+
// plugin every launch, which was the bulk of the startup delay.
|
|
71
|
+
let status = "";
|
|
67
72
|
try {
|
|
68
|
-
|
|
73
|
+
status = execSync("git submodule status --recursive", { cwd: targetDir }).toString();
|
|
69
74
|
}
|
|
70
75
|
catch { /* ignore */ }
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
after = execSync("git submodule status --recursive", { cwd: targetDir }).toString();
|
|
76
|
-
}
|
|
77
|
-
catch { /* ignore */ }
|
|
78
|
-
if (before !== after) {
|
|
76
|
+
const drifted = status.split("\n").some((line) => line.startsWith("+") || line.startsWith("-"));
|
|
77
|
+
if (drifted) {
|
|
78
|
+
executeGit("git submodule sync --recursive", targetDir);
|
|
79
|
+
executeGit("git submodule update --init --recursive", targetDir);
|
|
79
80
|
writeLog(`Fast-path: ${pluginName} submodules were out of sync — resynced, forcing rebuild`);
|
|
80
81
|
return { success: true, changed: true };
|
|
81
82
|
}
|