Changeset View
Changeset View
Standalone View
Standalone View
contrib/source-control-tools/automated-commits.sh
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
"${SCRIPT}" "${SCRIPT_ARGS[@]}" | "${SCRIPT}" "${SCRIPT_ARGS[@]}" | ||||
# Bail early if there's nothing to land | # Bail early if there's nothing to land | ||||
if [ "$(git rev-parse HEAD)" == "${OLD_HEAD}" ]; then | if [ "$(git rev-parse HEAD)" == "${OLD_HEAD}" ]; then | ||||
echo "No new changes. Nothing to do." | echo "No new changes. Nothing to do." | ||||
exit 0 | exit 0 | ||||
fi | fi | ||||
# Auto-generated changes. These are amended to the patch rather than landed as | |||||
# their own commit. | |||||
for AUTOGEN_SCRIPT in "${TOPLEVEL}"/contrib/source-control-tools/autogen-recipes/* ; do | |||||
"${AUTOGEN_SCRIPT}" | |||||
done | |||||
echo "The following staged changes will be amended to your patch:" | |||||
git --no-pager diff --cached | |||||
# Amend the commit, preserving committer info | |||||
GIT_COMMITTER_EMAIL="$(git show -s --format='%ce')" | |||||
GIT_COMMITTER_NAME="$(git show -s --format='%cn')" | |||||
export GIT_COMMITTER_EMAIL | |||||
export GIT_COMMITTER_NAME | |||||
git commit --amend --no-edit | |||||
# Land the generated commit | # Land the generated commit | ||||
"${TOPLEVEL}"/contrib/source-control-tools/land-patch.sh "${LAND_PATCH_ARGS[@]}" | "${TOPLEVEL}"/contrib/source-control-tools/land-patch.sh "${LAND_PATCH_ARGS[@]}" |