lein-git-inject icon indicating copy to clipboard operation
lein-git-inject copied to clipboard

Difference between git describe and injected version number

Open sebastibe opened this issue 4 years ago • 1 comments

In my batch deployment script I am trying to generate the release version from git describe as mentioned in the README using git describe --tags --dirty=-SNAPSHOT (returning for example 1.1.9-7-gf2e285aa-SNAPSHOT). However, The version number doesn't match with the one in my Clojure code as the "g" prefix on the commit number is missing (i.e. 1.1.9-7-f2e285aa-SNAPSHOT).

Would you have any recommendations on how to have them match?

sebastibe avatar Jun 30 '21 03:06 sebastibe

Would you have any recommendations on how to have them match? The default describe pattern used in lein-git-inject does not include the "g" prefix the ref group:

   :describe-pattern  #"(?<tag>.*)-(?<ahead>\d+)-g(?<ref>[0-9a-f]*)(?<dirty>(-dirty)?)"
   

You can customize the pattern to include the "g" prefix in your project.clj:

  :git-inject {:ignore-dirty? true
               :describe-pattern  #"(?<tag>.*)-(?<ahead>\d+)-(?<ref>g[0-9a-f]*)(?<dirty>(-dirty)?)"}

juergenhoetzel avatar Jan 16 '22 13:01 juergenhoetzel