Changeset View
Changeset View
Standalone View
Standalone View
contrib/source-control-tools/test/test-autopatch.sh
#!/usr/bin/env bash | #!/usr/bin/env bash | ||||
# Copyright (c) 2019 The Bitcoin developers | # Copyright (c) 2019 The Bitcoin developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
export LC_ALL=C.UTF-8 | export LC_ALL=C.UTF-8 | ||||
set -euxo pipefail | set -euxo pipefail | ||||
TOPLEVEL=$(git rev-parse --show-toplevel) | TOPLEVEL=$(git rev-parse --show-toplevel) | ||||
CURRENT_DIR=$(dirname $(readlink -f "$0")) | CURRENT_DIR=$(dirname $(readlink -f "$0")) | ||||
TEST_PATCH="${CURRENT_DIR}/test-commit.patch" | TEST_PATCH="${CURRENT_DIR}/test-commit.patch" | ||||
: "${REMOTE:=origin}" | : "${REMOTE:=origin}" | ||||
: "${MASTER_BRANCH:=master}" | : "${MASTER_BRANCH:=master}" | ||||
REMOTE_AND_BRANCH="${REMOTE}/${MASTER_BRANCH}" | REMOTE_AND_BRANCH="${REMOTE}/${MASTER_BRANCH}" | ||||
LATEST_MASTER=$(git rev-parse "${REMOTE_AND_BRANCH}") | LATEST_MASTER=$(git rev-parse "${MASTER_BRANCH}") | ||||
test_autopatch() { | test_autopatch() { | ||||
PATCH_FILE="$1" | PATCH_FILE="$1" | ||||
EXPECTED_EXIT_CODE="$2" | EXPECTED_EXIT_CODE="$2" | ||||
PATCH_ARGS="--patch ${PATCH_FILE}" | PATCH_ARGS="--patch ${PATCH_FILE}" | ||||
# Setting the remote to this repo allows us to simulate an upstream without | # Setting the remote to this repo allows us to simulate an upstream without | ||||
# relying on external services for unit tests. | # relying on external services for unit tests. | ||||
export EDITOR="${CURRENT_DIR}/test-commit-message.sh" | export EDITOR="${CURRENT_DIR}/test-commit-message.sh" | ||||
▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines |