;; left matched against [ "v0.0.4" ahead? dirty? ]
;; right matched against git describe --tags output "v0.0.4-5-ge2028de"
:lein-git-inject {[#"v\d+\.\d+\.\d+" false? (constantly true)] #"v(\d+\.\d+\.\d+).*"
[#"v\d+\.\d+\.\d+" true? (constantly true)] [#"v(\d+\.\d+\.\d+-\d+-[a-z0-9][8])" "-SNAPSHOT"]}
;; same but with static values instead of fns
;; except there is an issue with using `_` which is idiomatic syntax as we cannot write as a macro and:
;; WARNING: Can't take value of macro cljs.core/_ at line..
:lein-git-inject-2 {[#"v\d+\.\d+\.\d+" false _] #"v(\d+\.\d+\.\d+).*"
[#"v\d+\.\d+\.\d+" true _] [#"v(\d+\.\d+\.\d+-\d+-[a-z0-9][8])" "-SNAPSHOT"]}
;; simpler right side by providing git describe --tags output "v0.0.4-5-ge2028de" as
;; %semver v0.0.4
;; %ahead 5
;; %hash ge2028de
:lein-git-inject-3 {[#"v\d+\.\d+\.\d+" false _] "%semver"
[#"v\d+\.\d+\.\d+" true _] "%semver-%ahead-%hash-SNAPSHOT"}
Last active
December 30, 2019 04:26
-
-
Save superstructor/fd5b8b21e910cbbc384330d28e722e1d to your computer and use it in GitHub Desktop.
lein-git-inject.md
Author
Some useful information includes:
- https://stackoverflow.com/questions/43991602/list-tags-in-git-repo-sorted-by-how-they-appear-in-graph
- https://stackoverflow.com/questions/1006775/how-to-reference-the-initial-commit
- https://unix.stackexchange.com/questions/47659/how-to-find-the-first-tag-that-contains-a-git-commit
- https://git-scm.com/docs/git-show-branch
- https://git-scm.com/docs/git-rev-list
- https://git-scm.com/docs/git-describe
- https://git-scm.com/docs/git-tag
- https://git-scm.com/docs/git-name-rev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.