From 66f193af6e34be4e67f25cfe00f6b9957f160cd3 Mon Sep 17 00:00:00 2001 From: Kai Haase Date: Mon, 12 Sep 2022 19:08:48 +0200 Subject: [PATCH] Optimized commit message for git squash --- package-lock.json | 4 ++-- package.json | 2 +- src/commands/git/squash.ts | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 70e8c46..217559d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lenne.tech/cli", - "version": "0.0.77", + "version": "0.0.78", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@lenne.tech/cli", - "version": "0.0.77", + "version": "0.0.78", "license": "MIT", "dependencies": { "@lenne.tech/cli-plugin-helper": "0.0.11", diff --git a/package.json b/package.json index 68ce170..015fff1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lenne.tech/cli", - "version": "0.0.77", + "version": "0.0.78", "description": "lenne.Tech CLI: lt", "keywords": [ "lenne.Tech", diff --git a/src/commands/git/squash.ts b/src/commands/git/squash.ts index 66f71d3..c36b9cc 100644 --- a/src/commands/git/squash.ts +++ b/src/commands/git/squash.ts @@ -62,6 +62,9 @@ const NewCommand: GluegunCommand = { } mergeBaseSpin.succeed(); + // Get squash message (before reset) + const squashMessage = await git.getFirstBranchCommit(await git.currentBranch(), base); + // Soft reset const resetSpin = spin('Soft reset'); await git.reset(mergeBase, true); @@ -100,7 +103,7 @@ const NewCommand: GluegunCommand = { await ask({ type: 'input', name: 'message', - initial: await git.getFirstBranchCommit(await git.currentBranch(), base), + initial: squashMessage, message: 'Message: ', }) ).message; @@ -124,6 +127,9 @@ const NewCommand: GluegunCommand = { // Success success(`Squashed ${branch} in ${helper.msToMinutesAndSeconds(timer())}m.`); info(''); + if (!toolbox.parameters.options.fromGluegunMenu) { + process.exit(); + } // For tests return `squashed ${branch}`;