Check if git repo root in plugin update

This commit is contained in:
Cohee 2025-02-20 23:13:23 +02:00
parent 3f5b63bba0
commit 8ad7b5dcc5
2 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import { default as git } from 'simple-git';
import { default as git, CheckRepoActions } from 'simple-git';
import { color } from './src/util.js';
const __dirname = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
@ -49,7 +49,7 @@ async function updatePlugins() {
const pluginPath = path.join(pluginsPath, directory);
const pluginRepo = git(pluginPath);
const isRepo = await pluginRepo.checkIsRepo();
const isRepo = await pluginRepo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
if (!isRepo) {
console.log(`Directory ${color.yellow(directory)} is not a Git repository`);
continue;

View File

@ -3,7 +3,7 @@ import path from 'node:path';
import url from 'node:url';
import express from 'express';
import { default as git } from 'simple-git';
import { default as git, CheckRepoActions } from 'simple-git';
import { sync as commandExistsSync } from 'command-exists';
import { getConfigValue, color } from './util.js';
@ -256,7 +256,7 @@ async function updatePlugins(pluginsPath) {
const pluginPath = path.join(pluginsPath, directory);
const pluginRepo = git(pluginPath);
const isRepo = await pluginRepo.checkIsRepo();
const isRepo = await pluginRepo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
if (!isRepo) {
continue;
}