Line 25 actually loops only the changes made in the last commit. If you push multiple commits at once, the changed files from previous commits are not detected.
This code has worked well for us. Credits to @kosminen.
changed_files=""
while read oldrev newrev refname; do
if [ "$refname" = "refs/heads/master" ]; then
changed_files=$(git diff-tree --name-only -r $oldrev $newrev)
fi
done
Originally posted by @ottok in https://github.com/Seravo/wordpress/issues/102#issuecomment-498664612
Line 25 actually loops only the changes made in the last commit. If you push multiple commits at once, the changed files from previous commits are not detected.
This code has worked well for us. Credits to @kosminen.