Skip to content

Instantly share code, notes, and snippets.

@brianjriddle
Created September 22, 2013 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjriddle/6657796 to your computer and use it in GitHub Desktop.
Save brianjriddle/6657796 to your computer and use it in GitHub Desktop.
Ant tasks to check if working directory is clean.
<?xml version="1.0" encoding="UTF-8"?>
<project name="git" default="is-working-directory-clean">
<target name="-git-status">
<exec executable="git" outputproperty="git.status.message" failifexecutionfails="false" errorproperty="">
<arg value="status"/>
<arg value="--short"/>
</exec>
<condition property="git.clean.wd">
<and>
<equals arg1="${git.status.message}" arg2="" trim="yes"/>
</and>
</condition>
</target>
<target name="is-working-directory-clean"
depends="-git-status">
<fail unless="${git.clean.wd}" message="Working directory is not clean"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment