Check if git repo root in plugin update

8ad7b5dcc58465135ae5c8b7ed522280c892cd65

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +4 -4Ignore whitespace
plugins.js+2 -2
@@ -8,7 +8,7 @@ import path from 'node:path';
8import process from 'node:process';8import process from 'node:process';
9import { fileURLToPath } from 'node:url';9import { fileURLToPath } from 'node:url';
1010
11import { default as git } from 'simple-git';11import { default as git, CheckRepoActions } from 'simple-git';
12import { color } from './src/util.js';12import { color } from './src/util.js';
1313
14const __dirname = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));14const __dirname = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
@@ -49,7 +49,7 @@ async function updatePlugins() {
49 const pluginPath = path.join(pluginsPath, directory);49 const pluginPath = path.join(pluginsPath, directory);
50 const pluginRepo = git(pluginPath);50 const pluginRepo = git(pluginPath);
5151
52 const isRepo = await pluginRepo.checkIsRepo();52 const isRepo = await pluginRepo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
53 if (!isRepo) {53 if (!isRepo) {
54 console.log(`Directory ${color.yellow(directory)} is not a Git repository`);54 console.log(`Directory ${color.yellow(directory)} is not a Git repository`);
55 continue;55 continue;
src/plugin-loader.js+2 -2
@@ -3,7 +3,7 @@ import path from 'node:path';
3import url from 'node:url';3import url from 'node:url';
44
5import express from 'express';5import express from 'express';
6import { default as git } from 'simple-git';6import { default as git, CheckRepoActions } from 'simple-git';
7import { sync as commandExistsSync } from 'command-exists';7import { sync as commandExistsSync } from 'command-exists';
8import { getConfigValue, color } from './util.js';8import { getConfigValue, color } from './util.js';
99
@@ -256,7 +256,7 @@ async function updatePlugins(pluginsPath) {
256 const pluginPath = path.join(pluginsPath, directory);256 const pluginPath = path.join(pluginsPath, directory);
257 const pluginRepo = git(pluginPath);257 const pluginRepo = git(pluginPath);
258258
259 const isRepo = await pluginRepo.checkIsRepo();259 const isRepo = await pluginRepo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
260 if (!isRepo) {260 if (!isRepo) {
261 continue;261 continue;
262 }262 }