@@ -6,23 +6,33 @@ function _command (cmd, cb) {
6
6
} )
7
7
}
8
8
9
- module . exports = {
10
- short : function ( cb ) {
9
+ module . exports = {
10
+ short : function ( cb ) {
11
11
_command ( 'git rev-parse --short HEAD' , cb )
12
12
}
13
- , long : function ( cb ) {
13
+ , long : function ( cb ) {
14
14
_command ( 'git rev-parse HEAD' , cb )
15
15
}
16
- , branch : function ( cb ) {
16
+ , branch : function ( cb ) {
17
17
_command ( 'git rev-parse --abbrev-ref HEAD' , cb )
18
18
}
19
- , tag : function ( cb ) {
19
+ , tag : function ( cb ) {
20
20
_command ( 'git describe --always --tag --abbrev=0' , cb )
21
21
}
22
- , log : function ( cb ) {
22
+ , log : function ( cb ) {
23
23
_command ( 'git log --no-color --pretty=format:\'[ "%H", "%s", "%cr", "%an" ],\' --abbrev-commit' , function ( str ) {
24
24
str = str . substr ( 0 , str . length - 1 )
25
25
cb ( JSON . parse ( '[' + str + ']' ) )
26
26
} )
27
27
}
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
+ }
28
38
}
0 commit comments