Skip to content

Commit

Permalink
ensure all tags are returned if no message is sent - closes #170
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlacy committed Aug 9, 2017
1 parent 0accffa commit 951c0d7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions examples/gulpfile.js
Expand Up @@ -166,6 +166,12 @@ gulp.task('tagsec', function() {
});
});

gulp.task('tagall', function() {
git.tag(function(err, tags) {
console.log(tags);
});
});

gulp.task('push-tag', function() {
git.push('origin', 'v1.1.1', function (err) {
if (err) {
Expand Down
6 changes: 5 additions & 1 deletion lib/tag.js
Expand Up @@ -17,7 +17,11 @@ module.exports = function (version, message, opt, cb) {
}
if (!cb || typeof cb !== 'function') cb = function () {};
if (!opt) opt = {};
if (!message) opt.lightWeight = true; else message = escape([message]);
if (!message) {
opt.lightWeight = true;
message = '';
}
else message = escape([message]);
if (!opt.cwd) opt.cwd = process.cwd();
if (!opt.args) opt.args = ' ';

Expand Down
9 changes: 9 additions & 0 deletions test/tag.js
Expand Up @@ -33,4 +33,13 @@ module.exports = function(git) {
});
});
});

it('should return all tags', function(done) {
git.tag(function(err, tags) {
should(tags).not.be.null();
should(tags[0]).not.be.null();
should(tags[0]).equal('0.5.1');
done();
});
});
};

0 comments on commit 951c0d7

Please sign in to comment.