I'm integrating some filterchains in my Ant build script which add build date, program version, and git head sha to the source files when packaging, however I'm not sure how to determine if the source repo is "clean", as-in if there are no changes since the HEAD commit in the current source-to-be-built.
To tag the HEAD commit, I'm using the git.revision
target made in this question: How to lookup the latest git commit hash from an ant build script
I'd like to do something similar but indicate repo status, ie. "SOURCE: @STATUS@" which would filter to: "SOURCE: CLEAN" / "SOURCE: DIRTY", or similar.
Just running a git status
command in an exec
from ant returns a lot of stuff and makes it harder to work with. Is there an easier way?