From b32efb5b17eb560a95dfae79c36134fd36a8dc2d Mon Sep 17 00:00:00 2001 From: nyncral Date: Thu, 18 Jul 2024 16:24:40 +0200 Subject: [PATCH] 0.1.3 Update git commands and fix commit --- CHANGELOG.md | 31 ++++++++++++++++++++----------- extension.js | 12 +++++++----- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b99f6f..6355841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,28 +2,37 @@ All notable changes to the "dwm-git-simpleuse" extension will be documented in this file. -## [Unreleased] +## [Unreleased] _(not in order)_ - Task API -- no git warnings as errors -- progress bar for git commands +- No git msgs as errors +- check if in git repository before running commands +- Progress bar for git commands +- Upload only active file +- Make it possible to receive a webhook to send info to user + +## [0.1.3] - 2024-07-18 + +- Fixed "commit message auto increment" +- Fixed commit message couldn't have `'` in it +- added "--ff" to git pull ## [0.1.2] - 2024-07-11 -- fixed "initialize existing repository" command -- renamed commands with "gitDWM : " prefix +- Fixed "initialize existing repository" command +- Renamed commands with "gitDWM : " prefix ## [0.1.0] - 2024-04-10 -- choose commmit message -- commit message auto increment -- command to initialize existing repository -- activation event set to "onStartupFinished" +- Choose commmit message +- Commit message auto increment +- Command to initialize existing repository +- Activation event set to "onStartupFinished" ## [0.0.2] - 2024-02-02 -- renamed command to something else than "helloworld" => ("full push") +- Renamed command to something else than "helloworld" => ("full push") ## [0.0.1] - 2024-02-01 -- Initial release \ No newline at end of file +- Initial release diff --git a/extension.js b/extension.js index 51a3095..0fcbc35 100644 --- a/extension.js +++ b/extension.js @@ -49,7 +49,7 @@ function activate(context) { lastGitCommitMsg = gitCommitMsg; chp.exec( - `git add . && git commit -am '${gitCommitMsg}' && git pull && git push`, + `git add . && git commit -am "${gitCommitMsg.replace(/"/g, '\\"')}" && git pull --ff && git push`, { cwd: vscode.workspace.workspaceFolders[0].uri.fsPath }, (err, stdout, stderr) => { if (err) { @@ -147,8 +147,10 @@ module.exports = { }; String.prototype.incrementSuffixe = function () { - if (this == "") return ""; - return this.replace(/(\d+)?$/, function (match, p1) { - return p1 === undefined ? "(1)" : `(${parseInt(p1) + 1})`; - }); + const match = this.match(/\s*\((\d+)\)\s*$/); + return match + ? this.replace(match[0], ` (${+match[1] + 1})`) + : this.trim().length + ? this + " (1)" + : this.trim(); };