title: Bitbucket Pipeline trying to get list of files changed compared to
body: <p>I have the following bash script I use to perform linting checks in a bitbucket pipeline.</p>
  <pre class="lang-sh prettyprint-override"><code>#!/bin/bash
  set -e
  
  git fetch origin master:refs/remotes/origin/master
  FORK_POINT=$(git merge-base HEAD origin/master)
  PY_FILES=$(git --no-pager diff --name-only HEAD $FORK_POINT | grep &quot;\.py$&quot;)
  
  if [ &quot;$PY_FILES&quot; ]; then
      flake8 $PY_FILES
  else
      echo &quot;No *.py files found&quot;
      exit 0
   fi
  </code></pre>
  <p>This was working fine up until December 4th around 4pm UTC. After some experimenting, I have narrowed the problem down to this line
  <code>PY_FILES=$(git --no-pager diff --name-only HEAD $FORK_POINT | grep &quot;py$&quot;)</code>. When I remove the grep and <code>echo $PY_FILES</code> the script completes successfully but nothing shows up in the log. So, it appears that <code>git --no-pager diff --name-only HEAD $FORK_POINT</code> isn't returning anything when run by the pipeline, which I guess causes grep to error? When I run this locally it is all fine, so <code>git --no-pager diff --name-only HEAD $FORK_POINT</code> should definitely be returning results.</p>
  <p>Can anyone help me find out what went wrong here, or advise me on another way I can get a list of python files changed in a branch to run flake8 on?</p>