Skip to content
This repository was archived by the owner on Apr 14, 2023. It is now read-only.

Commit 1b18a77

Browse files
committed
Improve handling for non-deploy branches and no changes
1 parent eb0f67e commit 1b18a77

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

index.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = function(options) {
8383
}
8484
});
8585
if (!found) {
86-
return callback(new gutil.PluginError('gulp-deploy-git', 'branch ' + branch + ' is not configured to deploy'));
86+
return callback('doNotDeployBranch');
8787
}
8888
callback(null);
8989
}
@@ -191,8 +191,7 @@ module.exports = function(options) {
191191
});
192192
cmdCommit.on('exit', function(code) {
193193
if (code === 1) {
194-
gutil.log(gutil.colors.magenta('No changes to deployment files, skipping'));
195-
return callback(null);
194+
return callback('noChanges');
196195
}
197196
if (code !== 0) {
198197
return callback(new gutil.PluginError('gulp-deploy-git', 'git commit exited with code ' + code));
@@ -227,7 +226,16 @@ module.exports = function(options) {
227226
}
228227
], function(err) {
229228
if (err) {
230-
self.emit('error', err);
229+
switch (err) {
230+
case 'doNotDeployBranch':
231+
gutil.log(gutil.colors.magenta('Branch ' + branch + ' not configured to deploy, skipping'));
232+
break;
233+
case 'noChanges':
234+
gutil.log(gutil.colors.magenta('No changes to deployment files, skipping'));
235+
break;
236+
default:
237+
self.emit('error', err);
238+
}
231239
}
232240
done(err);
233241
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-deploy-git",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "Deploy Git projects to remote Git repositories.",
55
"author": "Thomas Lokshall <[email protected]>",
66
"license": "MIT",

0 commit comments

Comments
 (0)