title: Determine If Any File Changed In Directory For Latest Git Commit
body: <p>I'm writing a <code>post-commit</code> hook for <code>git</code>. I would like to know if the latest commit changed any of the files in a particular directory. If there were any changes I can then proceed and call some expensive code, otherwise I can just skip it.</p>
  
  <p>So, <a href="https://gist.github.com/dciccale/5560837" rel="noreferrer">far I'm getting the short hash like so</a>:</p>
  
  <pre><code># get last commit hash prepended with @ (i.e. @8a323d0)
  function parse_git_hash() {
    git rev-parse --short HEAD 2&gt; /dev/null | sed "s/\(.*\)/@\1/"
  }
  </code></pre>
  
  <p>Now, I need to determine if there were any changes to the specified directory. But I'm not sure how to go about that. I've looked at and played with <code>git-log</code> and <code>git-show</code> but without success so far.</p>
  
  <p>So, I need to do something like this.</p>
  
  <pre><code>if [directory-changed()] {
    echo "start expensive operation"
  }
  </code></pre>
  
  <p><strike>This actually gets me part way there:</strike> Actually it grabs the last commit not the one specified.</p>
  
  <pre><code>git log  -U a79851b -1 my/directory/path
  </code></pre>
  
  <p>Thanks in advance.</p>