From 4e8a68c685a7b6c136fbf0995b1405bc53b9d731 Mon Sep 17 00:00:00 2001 From: Eosellmay Li <2507917746@qq.com> Date: Mon, 12 Feb 2024 19:14:12 +0000 Subject: [PATCH 1/2] fix: able multi-line commit on Windows (#211) As #133 and #211 said, at least Windows 10 cannot commit when there are many lines. I have fixed it for standalone mode. --- standalone.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/standalone.js b/standalone.js index 4327fdf..791a4d4 100755 --- a/standalone.js +++ b/standalone.js @@ -10,7 +10,13 @@ log.info('cz-customizable standalone version'); const commit = (commitMessage) => { try { - execSync(`git commit -m "${commitMessage}"`, { stdio: [0, 1, 2] }); + execSync( + `git commit${commitMessage + .split('\n') + .map((n) => ` -m "${n}"`) + .join(' ')}`, + { stdio: [0, 1, 2] }, + ); } catch (error) { log.error('>>> ERROR', error.error); } From a49cf14e6c3dfbd8756b37123af6f21ee8add149 Mon Sep 17 00:00:00 2001 From: Eosellmay Li <2507917746@qq.com> Date: Tue, 13 Feb 2024 03:21:10 +0800 Subject: [PATCH 2/2] fix: repeated spaces in code I fixed some repeated space I unexpected, which makes the code more elegant. --- standalone.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/standalone.js b/standalone.js index 791a4d4..1bd3fb1 100755 --- a/standalone.js +++ b/standalone.js @@ -11,9 +11,9 @@ log.info('cz-customizable standalone version'); const commit = (commitMessage) => { try { execSync( - `git commit${commitMessage + `git commit ${commitMessage .split('\n') - .map((n) => ` -m "${n}"`) + .map((n) => `-m "${n}"`) .join(' ')}`, { stdio: [0, 1, 2] }, );