title: How can I stop an Xcode Archive build if my git working copy is dirty?
body: <p>I do not want an Archive build to succeed unless my working directory is clean. Therefore, I want to add a "Run Script" build phase (or something similar) to my Xcode project such that:</p>
  
  <p><strong>IF</strong> I am performing an Archive build...</p>
  
  <p><strong>AND</strong> there are uncommitted changes in my source directory</p>
  
  <p><strong>THEN</strong> the build fails with an error.</p>
  
  <p>I'm working with Xcode 4 and git 1.7.</p>
  
  <p>What's a good, concise, reusable script that will do the job?</p>