-
-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
This is a great tool to show users when the docs were last updated, but it would be exceptionally helpful to be able to embed the version/tag if available, falling back to head commit and an indicator if the workspace is dirty.
The examples below can only be attempted after confirming .git
exists.
e.g.
# repo with no tags and dirty workspace
$ GIT_REV=$(git describe --dirty || (git show --format="%h" --no-patch | tr -d '\n' && git diff --quiet || echo '-dirty'))
fatal: No names found, cannot describe anything.
$ echo $GIT_REV
27d95e8-dirty
# repo with tags
$ GIT_REV=$(git describe --dirty || (git show --format="%h" --no-patch | tr -d '\n' && git diff --quiet || echo '-dirty'))
$ echo $GIT_REV
2.1.1-1-g50fabe3
## with tags and dirty
$ GIT_REV=$(git describe --dirty || (git show --format="%h" --no-patch | tr -d '\n' && git diff --quiet || echo '-dirty'))
$ echo $GIT_REV
2.1.1-1-g50fabe3-dirty
# with tag checked out
$ GIT_REV=$(git describe --dirty || (git show --format="%h" --no-patch | tr -d '\n' && git diff --quiet || echo '-dirty'))
$ echo $GIT_REV
2.1.0
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request