#!/usr/bin/env bash
## This script selects changed files.
##
## Copyright (c) 2012-2014 Sylvain Benner
## Copyright (c) 2014-2018 Sylvain Benner & Contributors
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
## This file is not part of GNU Emacs.
## License: GPLv3
skip_when_branch_update
fail_when_undefined_pr_number
echo "PATCH_URL: \"${pr_patch_URL}\""
curl "${pr_patch_URL}" --output /tmp/patch --silent
first_commit=$(echo $(head -n 1 /tmp/patch) | sed -n 's/From \([a-zA-Z0-9]\+\).*/\1/p')
if [[ -z "${first_commit// }" ]]; then
echo "Can't find first commit"
exit 1
else
echo "First commit: ${first_commit}"
fi
git diff --name-only "${first_commit}^" HEAD > /tmp/changed_files
if [ $? -ne 0 ]; then
echo "Git diff failed"
echo_headline "CHANGED FILES:"
cat /tmp/changed_files