From 30bf11d417eb0d65cb3620e44afe4efb8c7a1d09 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 15 Mar 2018 18:36:04 +0100 Subject: Remove useless .sh file extension --- test/bootstrap | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 test/bootstrap (limited to 'test/bootstrap') diff --git a/test/bootstrap b/test/bootstrap new file mode 100755 index 0000000..fe9c0ba --- /dev/null +++ b/test/bootstrap @@ -0,0 +1,90 @@ +#!/bin/sh + +set -o errexit +set -o nounset +IFS=' +' + +if test "${IS_TEST_CASE:-1}" -eq '1' +then + DIR_TESTCASES="$(cd -- "$(dirname -- "$0")" && pwd -P)" + DIR_TEST="$(dirname "${DIR_TESTCASES}")" +else + DIR_TEST="$(cd -- "$(dirname -- "$0")" && pwd -P)" + DIR_TESTCASES="${DIR_TEST}/tests" +fi +DIR_ROOT="$(dirname "${DIR_TEST}")" +DIR_BIN="${DIR_ROOT}/bin" +DIR_TEMP="${DIR_TEST}/temp" +DIR_SOURCE="${DIR_TEMP}/source" +DIR_DESTINATION="${DIR_TEMP}/destination" + +BIN_MAIN="${DIR_BIN}/incremental-git-filterbranch" +if test ! -f "${BIN_MAIN}" +then + echo 'Failed to detect environment'>&2 + exit 1 +fi + +initializeRepositories () { + rm -rf "${DIR_TEMP}" + mkdir "${DIR_TEMP}" + + git init --quiet "${DIR_SOURCE}" + git -C "${DIR_SOURCE}" config --local user.email 'email@example.com' + git -C "${DIR_SOURCE}" config --local user.name 'John Doe' + mkdir "${DIR_SOURCE}/subdir" + + touch "${DIR_SOURCE}/rootfile1" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #1' + + git -C "${DIR_SOURCE}" tag tag-01 + + touch "${DIR_SOURCE}/subdir/subfile1" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #2' + + touch "${DIR_SOURCE}/subdir/subfile2" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #3' + + git -C "${DIR_SOURCE}" tag tag-02 + + touch "${DIR_SOURCE}/subdir/subfile3" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #4' + + touch "${DIR_SOURCE}/rootfile2" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #5' + + git -C "${DIR_SOURCE}" tag tag-03 + + touch "${DIR_SOURCE}/rootfile3" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #6' + + touch "${DIR_SOURCE}/subdir/subfile3b" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #4b' + + git -C "${DIR_SOURCE}" checkout --quiet -b slave tag-02 + + touch "${DIR_SOURCE}/in-root-2" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #7' + + git -C "${DIR_SOURCE}" tag tag-04 + + touch "${DIR_SOURCE}/in-root-3" + git -C "${DIR_SOURCE}" add --all + git -C "${DIR_SOURCE}" commit --quiet --message 'Commit #8' + + git init --bare --quiet "${DIR_DESTINATION}" +} + +getTagList () { + getTagList_multiline=$(git -C "${1}" show-ref --tags | sed -E 's:^.*?refs/tags/::' || true) + printf '%s' "${getTagList_multiline}" | sort -b | tr '\n' ' ' | sed -E 's:^ | $::g' +} -- cgit v1.2.3