Skip to content

Commit 33f0c80

Browse files
committed
[FIX] commit description: undefined value
- This started to happend after the inquirer update.
1 parent 920e0dc commit 33f0c80

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lib/commit.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@
5555
}
5656

5757
function nextStepDesc() {
58-
onDescPrompt('desc', fieldTexts.desc, tagTitleLength).then(function (descInput) {
59-
commitText += descInput;
60-
execCommit(commitText);
58+
onDescPrompt('desc', fieldTexts.desc, tagTitleLength).then(function (commitDesc) {
59+
execCommit(commitText , commitDesc);
6160
});
6261
}
6362
}
@@ -86,19 +85,17 @@
8685
function onDescPrompt(field, desc, tagTitleLength) {
8786
if (!desc) { return Promise.resolve(''); }
8887
return onAskFor(field, desc).then(function (commitDesc) {
89-
parseDesc(commitDesc, tagTitleLength);
88+
return parseDesc(commitDesc, tagTitleLength);
9089
});
9190
}
9291

9392
function parseDesc(commitDesc, tagTitleLength) {
94-
var newDesc;
93+
var newDesc = '';
9594

96-
if (!commitDesc) { return ''; }
95+
if (!commitDesc) { return; }
9796

98-
newDesc = '\n\n';
9997
newDesc += new Array(tagTitleLength).join(' ');
10098
newDesc += ' - ' + commitDesc;
101-
10299
return newDesc;
103100
}
104101

@@ -114,8 +111,14 @@
114111
});
115112
}
116113

117-
function execCommit(commitMessage) {
118-
childProcess.exec('git commit -m "' + commitMessage + '"', function (error) {
114+
function execCommit(commitMessage, commitDesc) {
115+
let command = 'git commit -m "' + commitMessage + '"';
116+
117+
if (commitDesc) {
118+
command += ' -m "' + commitDesc + '"';
119+
}
120+
121+
childProcess.exec( command , function (error) {
119122
if (error) {
120123
utils.showError('Nothing to commit, you need to do a `git add` before commit');
121124
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy