|
55 | 55 | }
|
56 | 56 |
|
57 | 57 | 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); |
61 | 60 | });
|
62 | 61 | }
|
63 | 62 | }
|
|
86 | 85 | function onDescPrompt(field, desc, tagTitleLength) {
|
87 | 86 | if (!desc) { return Promise.resolve(''); }
|
88 | 87 | return onAskFor(field, desc).then(function (commitDesc) {
|
89 |
| - parseDesc(commitDesc, tagTitleLength); |
| 88 | + return parseDesc(commitDesc, tagTitleLength); |
90 | 89 | });
|
91 | 90 | }
|
92 | 91 |
|
93 | 92 | function parseDesc(commitDesc, tagTitleLength) {
|
94 |
| - var newDesc; |
| 93 | + var newDesc = ''; |
95 | 94 |
|
96 |
| - if (!commitDesc) { return ''; } |
| 95 | + if (!commitDesc) { return; } |
97 | 96 |
|
98 |
| - newDesc = '\n\n'; |
99 | 97 | newDesc += new Array(tagTitleLength).join(' ');
|
100 | 98 | newDesc += ' - ' + commitDesc;
|
101 |
| - |
102 | 99 | return newDesc;
|
103 | 100 | }
|
104 | 101 |
|
|
114 | 111 | });
|
115 | 112 | }
|
116 | 113 |
|
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) { |
119 | 122 | if (error) {
|
120 | 123 | utils.showError('Nothing to commit, you need to do a `git add` before commit');
|
121 | 124 | }
|
|
0 commit comments