Skip to content

Commit

Permalink
implemented exactTag command
Browse files Browse the repository at this point in the history
  • Loading branch information
Giacomo Manna committed Jul 13, 2016
1 parent 143120a commit 583214d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions example/simple.js
Expand Up @@ -35,3 +35,6 @@ git.log(function (array) {
// '2 days ago',
// 'Thomas Blobaum' ] ]
})
git.exactTag(function(str){
console.log('exactTag',str)
})
22 changes: 16 additions & 6 deletions index.js
Expand Up @@ -6,23 +6,33 @@ function _command (cmd, cb) {
})
}

module.exports = {
short : function (cb) {
module.exports = {
short : function (cb) {
_command('git rev-parse --short HEAD', cb)
}
, long : function (cb) {
, long : function (cb) {
_command('git rev-parse HEAD', cb)
}
, branch : function (cb) {
, branch : function (cb) {
_command('git rev-parse --abbrev-ref HEAD', cb)
}
, tag : function (cb) {
, tag : function (cb) {
_command('git describe --always --tag --abbrev=0', cb)
}
, log : function (cb) {
, log : function (cb) {
_command('git log --no-color --pretty=format:\'[ "%H", "%s", "%cr", "%an" ],\' --abbrev-commit', function (str) {
str = str.substr(0, str.length-1)
cb(JSON.parse('[' + str + ']'))
})
}
, exactTag: function(cb){
_command('git describe --exact-match --tags HEAD',function(str){
if (str){
cb(str)
}else{
cb(undefined)
}

})
}
}

0 comments on commit 583214d

Please sign in to comment.