title: Run a build task only when changes have been pulled from a git repository
body: <p>I have a C++ program hosted in Bitbucket git repository that I'm compiling with CMake. The current play can be seen below. It works fine except <code>build</code>-task is run every time the play is run. Instead I'd like <code>build</code>-task to run only when new software version is pulled by <a href="http://docs.ansible.com/git_module.html" rel="noreferrer">git</a>-module. How I can tell in <code>build</code>-task if <code>clone</code>-task found new version ?</p>
  
  <pre><code>---
  # tasks of role: foo
  
  - name: clone repository
    git: repo=git@bitbucket.org:foo/foo.git
         dest={{ foo.dir }}
         accept_hostkey=yes
  
  - name: create build dir
    file: state=directory path={{ foo.build_dir }}
  
  - name: build
    command: "{{ item }} chdir={{ foo.build_dir }}"
    with_items:
      - cmake ..
      - make
  </code></pre>