title: git hook getting changeset after an auto commit
body: <p>I have a hook that takes the changed files and copies them to a directory it works for standard commits but the auto-commit of a merge breaks it as the last two commits doesn't contain any changed files</p>
  
  <p>Here is my current code</p>
  
  <pre><code>generateChangeSet() {
      if [ ! -d $WORKDIR ];then
          mkdir $WORKDIR
      fi
  
      CHANGESET=$(git log -1 --name-status $oldrev $newrev | grep -v -e "^Merge" -e "^commit" -e "^Author" -e "^Date" -e "^ " -e "^$")
      if [ -z $CHANGESET ]; then
        echo Could not detect any files in the change set, aborting push
        exit $RETVAL
      fi
  
      # Get a list of deleted files
      DELFILES=$WORKDIR/deletedFiles.sh
      if [ -f $DELFILES ];then
          rm -rf $DELFILES
      fi
  
      for dFile in $(echo $CHANGESET | grep "^D" | awk '{print $2}'); do
          echo deleted file $dFile
          echo rm -f $dFile &gt;&gt; $DELFILES
      done
      if [ -f $DELFILES ];then
          sed -i '1s/^/#!\/bin\/bash\n/' $DELFILES
          chmod +x $DELFILES
          echo find . -depth -type d -empty &gt;&gt; $DELFILES
          echo rm deletedFiles.sh &gt;&gt; $DELFILES
      fi
  
      echo "Generating diff between $newrev and $oldrev"
      git archive HEAD $(echo $CHANGESET | grep -v "^D" | awk '{print $2}') | (cd $WORKDIR &amp;&amp; tar xf -)
  }
  </code></pre>
  
  <p>Any ideas on how get the script to get the latest changed files at all times?</p>
  
  <p>Thanks</p>