I am working on adding a version number to the build process. For versions built on the developer's machines, I want to know whether the workspace contained changes that could be included in the assembly, and the suffix SHA1 with -dirty.
For example:
c2bc0d223739c841c5e810c6c439562aa9d67f5f
c2bc0d223739c841c5e810c6c439562aa9d67f5f-dirty
The first form can be obtained through:
git rev-parse HEAD
However, I cannot figure out how to add a suffix -dirtywhen the work area is dirty. git describeprovides this, but only by tag names. We really do not use tags (the latter were about 400 versions ago), and they are not as convincing as SHA1.
Can this be done in a single command, or do I need to run multiple bash scripts?