Skip to content

Commit 0f4266a

Browse files
authored
Merge pull request #23 from binoz/feature/exactTag
implemented exactTag command
2 parents 143120a + 583214d commit 0f4266a

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

example/simple.js

+3
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ git.log(function (array) {
3535
// '2 days ago',
3636
// 'Thomas Blobaum' ] ]
3737
})
38+
git.exactTag(function(str){
39+
console.log('exactTag',str)
40+
})

index.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,33 @@ function _command (cmd, cb) {
66
})
77
}
88

9-
module.exports = {
10-
short : function (cb) {
9+
module.exports = {
10+
short : function (cb) {
1111
_command('git rev-parse --short HEAD', cb)
1212
}
13-
, long : function (cb) {
13+
, long : function (cb) {
1414
_command('git rev-parse HEAD', cb)
1515
}
16-
, branch : function (cb) {
16+
, branch : function (cb) {
1717
_command('git rev-parse --abbrev-ref HEAD', cb)
1818
}
19-
, tag : function (cb) {
19+
, tag : function (cb) {
2020
_command('git describe --always --tag --abbrev=0', cb)
2121
}
22-
, log : function (cb) {
22+
, log : function (cb) {
2323
_command('git log --no-color --pretty=format:\'[ "%H", "%s", "%cr", "%an" ],\' --abbrev-commit', function (str) {
2424
str = str.substr(0, str.length-1)
2525
cb(JSON.parse('[' + str + ']'))
2626
})
2727
}
28+
, exactTag: function(cb){
29+
_command('git describe --exact-match --tags HEAD',function(str){
30+
if (str){
31+
cb(str)
32+
}else{
33+
cb(undefined)
34+
}
35+
36+
})
37+
}
2838
}

0 commit comments

Comments
 (0)