diff options
author | Michele Locati <michele@locati.it> | 2018-03-15 18:36:04 +0100 |
---|---|---|
committer | Michele Locati <michele@locati.it> | 2018-03-15 18:36:04 +0100 |
commit | 30bf11d417eb0d65cb3620e44afe4efb8c7a1d09 (patch) | |
tree | 00588f51459a5cb2fe9258bd229717192f6c6854 /test/bootstrap | |
parent | d07138f8e7001fc4e497510dcf1ac432725ae6c0 (diff) | |
download | incremental-git-filter-branch-30bf11d417eb0d65cb3620e44afe4efb8c7a1d09.tar.gz incremental-git-filter-branch-30bf11d417eb0d65cb3620e44afe4efb8c7a1d09.tar.bz2 incremental-git-filter-branch-30bf11d417eb0d65cb3620e44afe4efb8c7a1d09.zip |
Remove useless .sh file extension
Diffstat (limited to 'test/bootstrap')
-rwxr-xr-x | test/bootstrap | 90 |
1 files changed, 90 insertions, 0 deletions
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' +} |