Changeset View
Changeset View
Standalone View
Standalone View
contrib/source-control-tools/test/test-autopatch.sh
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
# Set a temporary git config in case a global config isn't set | # Set a temporary git config in case a global config isn't set | ||||
git config user.name "test-autopatch" | git config user.name "test-autopatch" | ||||
git config user.email "test@test.test" | git config user.email "test@test.test" | ||||
git remote add testorigin "${TOPLEVEL}" | git remote add testorigin "${TOPLEVEL}" | ||||
git pull testorigin "${REMOTE_AND_BRANCH}" | git pull testorigin "${REMOTE_AND_BRANCH}" | ||||
test_cleanup() { | test_cleanup() { | ||||
# Cleanup current branch so that arcanist doesn't run out of branch names | |||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |||||
git checkout "${MASTER_BRANCH}" | |||||
git reset --hard HEAD | git reset --hard HEAD | ||||
git branch -D "${CURRENT_BRANCH}" || true | git clean -xffd || true | ||||
git checkout "${MASTER_BRANCH}" | |||||
} | } | ||||
( | ( | ||||
trap 'test_cleanup' RETURN ERR EXIT | trap 'test_cleanup' RETURN ERR EXIT | ||||
echo "TEST: Simply sanity check that autopatch fast-forwards as expected" | echo "TEST: Simply sanity check that autopatch fast-forwards as expected" | ||||
git reset --hard HEAD~10 | git reset --hard HEAD~10 | ||||
test_autopatch "${TEST_PATCH}" 0 | test_autopatch "${TEST_PATCH}" 0 | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |