Whamcloud - gitweb
LU-3871 osd: Tell QUOTA/NAME_LLOG fid in fid_is_on_ost check
[fs/lustre-release.git] / lustre / scripts / version_tag-git.pl
index 4912de8..1f0dbf4 100644 (file)
@@ -30,10 +30,28 @@ sub get_tag()
 
 }
 
+# "git describe" will just return a tag name if the current commit is
+# tagged.  Otherwise, the output will look something like this:
+#
+#     <tag name>-<commits beyong tag>-g<hash>
+#
+# Examples:
+#     2.0.59-1-g4c20b1f
+#     2.0.59-1somecompany-1-g4c20b1f
+#     foobar-15-g2e937ca
+#
 my $desc=`git describe --tags`;
-$desc =~ /([^-]+)(?:-(.+)-(.+))?\n/;
-$tag = $1;
-$fcoms = $2;
-$hash = $3;
+if ($desc =~ /(.+?)(?:-(\d)+-g([0-9a-f]+))\n?/) {
+    # tag with describe info added
+    $tag = $1;
+    $fcoms = $2;
+    $hash = $3;
+} else {
+    # plain tag
+    $tag = $desc;
+    chomp $tag;
+    $fcoms = 0;
+    $hash = "";
+}
 
 1;