1、将每个代码仓库进行了隔离。2、优化了每个页面的ui对齐。3、增加了飞行器页面的所属项目显示。4、切换页面时对项目进行扫描,实时更新项目的结构,避免复制导致ui不显示的bug
This commit is contained in:
@@ -27,7 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GitService = void 0;
|
||||
// src/panels/services/GitService.ts
|
||||
const fs = __importStar(require("fs"));
|
||||
const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
|
||||
const node_1 = __importDefault(require("isomorphic-git/http/node"));
|
||||
@@ -94,8 +93,7 @@ class GitService {
|
||||
}
|
||||
if (dirExists) {
|
||||
const dirContents = await fs.promises.readdir(localPath);
|
||||
// 修正后的逻辑:过滤掉所有以 "." 开头的隐藏文件/目录。
|
||||
// 只有当存在非 "." 开头的文件或目录时,才阻止克隆。
|
||||
// 过滤掉所有以 "." 开头的隐藏文件/目录。
|
||||
const nonBenignFiles = dirContents.filter(item => !item.startsWith('.'));
|
||||
if (nonBenignFiles.length > 0) {
|
||||
throw new Error('目标目录不为空,请清空目录或选择其他路径');
|
||||
@@ -195,7 +193,6 @@ class GitService {
|
||||
if (username || token) {
|
||||
const u = encodeURIComponent(username || '');
|
||||
const t = encodeURIComponent(token || '');
|
||||
// 注意: 仅在 URL 是 http/https 时添加 auth
|
||||
if (repoUrl.startsWith('http')) {
|
||||
finalUrl = repoUrl.replace('://', `://${u}:${t}@`);
|
||||
}
|
||||
@@ -226,7 +223,7 @@ class GitService {
|
||||
await execAsync(`git push -u origin "${branchName}" --force`, { cwd: localPath });
|
||||
}
|
||||
/**
|
||||
* 使用Git命令提交并推送 (用于原有的 Git 模块更新)
|
||||
* 使用Git命令提交并推送
|
||||
*/
|
||||
static async commitAndPush(localPath) {
|
||||
await execAsync('git add .', { cwd: localPath });
|
||||
@@ -263,15 +260,13 @@ class GitService {
|
||||
await execAsync(commands.join(' && '), { cwd: localPath });
|
||||
}
|
||||
/**
|
||||
* 提交并推送到指定分支和远程 (用于 Project/Aircraft/Container 上传)
|
||||
* 提交并推送到指定分支和远程
|
||||
*/
|
||||
static async commitAndPushToBranch(localPath, branchName, repoUrl, // 这里的 repoUrl 是为了构造带 auth 的 finalUrl
|
||||
username, token) {
|
||||
static async commitAndPushToBranch(localPath, branchName, repoUrl, username, token) {
|
||||
let finalUrl = repoUrl || 'origin';
|
||||
if (repoUrl && (username || token)) {
|
||||
const u = encodeURIComponent(username || '');
|
||||
const t = encodeURIComponent(token || '');
|
||||
// 注意: 仅在 URL 是 http/https 时添加 auth
|
||||
if (repoUrl.startsWith('http')) {
|
||||
finalUrl = repoUrl.replace('://', `://${u}:${t}@`);
|
||||
}
|
||||
@@ -313,13 +308,10 @@ class GitService {
|
||||
const files = await fs.promises.readdir(dir);
|
||||
const tree = [];
|
||||
for (const file of files) {
|
||||
// 1. 不要解析 .git
|
||||
if (file === '.git')
|
||||
continue;
|
||||
// 2. 不要解析项目数据文件
|
||||
if (file === 'dcsp-data.json')
|
||||
continue;
|
||||
// 3. 其它所有隐藏文件/目录统统忽略
|
||||
if (file.startsWith('.'))
|
||||
continue;
|
||||
const filePath = path.join(dir, file);
|
||||
|
||||
Reference in New Issue
Block a user