#!/bin/bash
# Written in bash just because that's easier with all the file manipulation
set -eu
scriptdir=$(cd $(dirname $0) && pwd)
version="$1"
target_dir="$2"


if [[ ! -f "$2/skip-tests.txt" ]]; then
  echo "$2: does not look like a test root directory." >&2
  exit 1
fi


candidate_dir="${scriptdir}/../resources/cli-regression-patches/v${version}"

if [[ -d "$candidate_dir" ]]; then
  echo "Found patch directory: ${candidate_dir}"
  cp -vR "${candidate_dir}/"* "$2"
else
  echo "No patch directory named: ${candidate_dir}"
fi
