mirror of
https://gitea.computerliebe.org/ComputerLiebe_ORG_private/Gitea-VSCode-Clone-Plugin.git
synced 2024-12-27 15:51:52 +00:00
* chore(gitea-git-clone): update changelog for version 1.2.1
* fix(gitea-git-clone): cloning into existing subpath working again * fix(gitea-git-clone): update German translation for targetExists message * fix(gitea-git-clone): update English translation for targetExists message * fix(gitea-git-clone): update cloneGiteaRepository function to check if target directory already exists before cloning
This commit is contained in:
parent
5273dbc30f
commit
3e77dd62f7
@ -10,6 +10,13 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
|
|||||||
- if working in PR show different Icon with hint
|
- if working in PR show different Icon with hint
|
||||||
- fix progress bar in notification
|
- fix progress bar in notification
|
||||||
|
|
||||||
|
## 1.2.1
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- cloning into existing subpath working again
|
||||||
|
|
||||||
|
|
||||||
## 1.2.0
|
## 1.2.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
"giteaClone.selectPullRequest": "Wähle einen Pull Request zum Anzeigen aus",
|
"giteaClone.selectPullRequest": "Wähle einen Pull Request zum Anzeigen aus",
|
||||||
"giteaClone.repoInfoError": "Konnte Repository-Informationen nicht abrufen.",
|
"giteaClone.repoInfoError": "Konnte Repository-Informationen nicht abrufen.",
|
||||||
"giteaClone.pullRequestsError": "Fehler beim Abrufen der Pull Requests.",
|
"giteaClone.pullRequestsError": "Fehler beim Abrufen der Pull Requests.",
|
||||||
"giteaClone.showOpenPullRequestsTooltip": "Offene Pull Requests anzeigen"
|
"giteaClone.showOpenPullRequestsTooltip": "Offene Pull Requests anzeigen",
|
||||||
|
"giteaClone.targetExists": "Das Zielverzeichnis \"{0}\" existiert bereits."
|
||||||
}
|
}
|
||||||
|
|
@ -33,6 +33,7 @@
|
|||||||
"giteaClone.selectPullRequest": "Select a pull request to view",
|
"giteaClone.selectPullRequest": "Select a pull request to view",
|
||||||
"giteaClone.repoInfoError": "Could not retrieve repository information.",
|
"giteaClone.repoInfoError": "Could not retrieve repository information.",
|
||||||
"giteaClone.pullRequestsError": "Error retrieving pull requests.",
|
"giteaClone.pullRequestsError": "Error retrieving pull requests.",
|
||||||
"giteaClone.showOpenPullRequestsTooltip": "Show open pull requests"
|
"giteaClone.showOpenPullRequestsTooltip": "Show open pull requests",
|
||||||
|
"giteaClone.targetExists": "The target directory \"{0}\" already exists."
|
||||||
}
|
}
|
||||||
|
|
@ -2,6 +2,8 @@ import * as vscode from 'vscode';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { exec } from 'child_process';
|
import { exec } from 'child_process';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
|
||||||
// Initialisiere die Lokalisierung
|
// Initialisiere die Lokalisierung
|
||||||
const localize = nls.config({ messageFormat: nls.MessageFormat.file })();
|
const localize = nls.config({ messageFormat: nls.MessageFormat.file })();
|
||||||
@ -203,6 +205,14 @@ async function cloneGiteaRepository() {
|
|||||||
|
|
||||||
if (folderUri && folderUri[0]) {
|
if (folderUri && folderUri[0]) {
|
||||||
const folderPath = folderUri[0].fsPath;
|
const folderPath = folderUri[0].fsPath;
|
||||||
|
const repoName = repo.name;
|
||||||
|
const targetPath = path.join(folderPath, repoName);
|
||||||
|
|
||||||
|
// Überprüfen, ob das Zielverzeichnis bereits existiert
|
||||||
|
if (fs.existsSync(targetPath)) {
|
||||||
|
vscode.window.showErrorMessage(localize('giteaClone.targetExists', `The target directory "${targetPath}" already exists.`));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vscode.window.withProgress({
|
vscode.window.withProgress({
|
||||||
location: vscode.ProgressLocation.Notification,
|
location: vscode.ProgressLocation.Notification,
|
||||||
@ -212,7 +222,7 @@ async function cloneGiteaRepository() {
|
|||||||
progress.report({ message: localize('giteaClone.cloningProgress', 'Cloning in progress...'), increment: 0 });
|
progress.report({ message: localize('giteaClone.cloningProgress', 'Cloning in progress...'), increment: 0 });
|
||||||
|
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
exec(`git clone ${repo.ssh_url} ${folderPath}`, (error, stdout, stderr) => {
|
exec(`git clone ${repo.ssh_url} "${targetPath}"`, (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
vscode.window.showErrorMessage(localize('giteaClone.cloneError', 'Error cloning the repository.'));
|
vscode.window.showErrorMessage(localize('giteaClone.cloneError', 'Error cloning the repository.'));
|
||||||
console.error(stderr);
|
console.error(stderr);
|
||||||
@ -223,7 +233,7 @@ async function cloneGiteaRepository() {
|
|||||||
|
|
||||||
// Öffne das geklonte Repository im VSCode
|
// Öffne das geklonte Repository im VSCode
|
||||||
try {
|
try {
|
||||||
vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(folderPath), true)
|
vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(targetPath), true)
|
||||||
.then(() => resolve());
|
.then(() => resolve());
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
vscode.window.showErrorMessage(localize('giteaClone.openRepoError', 'Error opening the cloned repository.'));
|
vscode.window.showErrorMessage(localize('giteaClone.openRepoError', 'Error opening the cloned repository.'));
|
||||||
|
Loading…
Reference in New Issue
Block a user