Skip to content

Commit 4b79fdc

Browse files
committed
fix(cli): Favor spawn when no config present
When a config is not present, it makes more sense to use .spawn because of the interactive cli.
1 parent b93af4a commit 4b79fdc

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "commitizen",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Git commit, but play nice with conventions.",
55
"main": "index.js",
66
"scripts": {

src/cz.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var gulp = require('gulp');
66
var git = require('gulp-git');
77
var process = require('process');
88
var minimist = require('minimist');
9+
var child_process = require('child_process');
910

1011
exports.init = function(rawGitArgs, environment, config) {
1112
if(typeof environment === 'undefined') {
@@ -63,20 +64,14 @@ function withoutConfig(rawGitArgs, environment) {
6364
if(environment.debug === true) {
6465
console.error('COMMITIZEN DEBUG: No git-cz friendly config was detected. I looked for .czrc, .cz.json, or czConfig in package.json.');
6566
} else {
66-
// Get a gulp stream based off the config
67-
gulp.src(process.cwd())
67+
var vanillaGitArgs = ["commit"].concat(rawGitArgs);
6868

69-
// Format then commit
70-
.pipe(git.commit(undefined, {args: rawGitArgs, disableMessageRequirement: true}))
71-
72-
// Handle commit success
73-
.on('end', function() {
74-
console.log('✓ Commit succeeded.');
75-
})
69+
var child = child_process.spawn('git', vanillaGitArgs, {
70+
stdio: 'inherit'
71+
});
7672

77-
// Handle commit failure
78-
.on('error', function (error) {
79-
console.error('✗ Commit failed. Did you forget to \'git add\' your files or add a commit message?');
73+
child.on('error', function (e, code) {
74+
console.error(e);
8075
});
8176
}
8277
}

0 commit comments

Comments
 (0)