Skip to content

Commit 951c0d7

Browse files
committed
ensure all tags are returned if no message is sent - closes #170
1 parent 0accffa commit 951c0d7

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

examples/gulpfile.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ gulp.task('tagsec', function() {
166166
});
167167
});
168168

169+
gulp.task('tagall', function() {
170+
git.tag(function(err, tags) {
171+
console.log(tags);
172+
});
173+
});
174+
169175
gulp.task('push-tag', function() {
170176
git.push('origin', 'v1.1.1', function (err) {
171177
if (err) {

lib/tag.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ module.exports = function (version, message, opt, cb) {
1717
}
1818
if (!cb || typeof cb !== 'function') cb = function () {};
1919
if (!opt) opt = {};
20-
if (!message) opt.lightWeight = true; else message = escape([message]);
20+
if (!message) {
21+
opt.lightWeight = true;
22+
message = '';
23+
}
24+
else message = escape([message]);
2125
if (!opt.cwd) opt.cwd = process.cwd();
2226
if (!opt.args) opt.args = ' ';
2327

test/tag.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,13 @@ module.exports = function(git) {
3333
});
3434
});
3535
});
36+
37+
it('should return all tags', function(done) {
38+
git.tag(function(err, tags) {
39+
should(tags).not.be.null();
40+
should(tags[0]).not.be.null();
41+
should(tags[0]).equal('0.5.1');
42+
done();
43+
});
44+
});
3645
};

0 commit comments

Comments
 (0)