aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichele Locati <michele@locati.it>2018-03-16 11:22:40 +0100
committerMichele Locati <michele@locati.it>2018-03-16 16:56:39 +0100
commit54cf93763dbfd00146f8f2352d4f70f61af01831 (patch)
tree2226b4f2f6f62ece713363f7c29d4da06bb2503a /test
parent15cdf13edbda73edb829102b4e20e998bce5f355 (diff)
downloadincremental-git-filter-branch-54cf93763dbfd00146f8f2352d4f70f61af01831.tar.gz
incremental-git-filter-branch-54cf93763dbfd00146f8f2352d4f70f61af01831.tar.bz2
incremental-git-filter-branch-54cf93763dbfd00146f8f2352d4f70f61af01831.zip
Add --prune-branches and --prune-tags options
Diffstat (limited to 'test')
-rwxr-xr-xtest/bootstrap5
-rwxr-xr-xtest/tests/filter-directory-prune-branches.success27
-rwxr-xr-xtest/tests/filter-directory-prune-tags.success27
3 files changed, 59 insertions, 0 deletions
diff --git a/test/bootstrap b/test/bootstrap
index fe9c0ba..ea781c9 100755
--- a/test/bootstrap
+++ b/test/bootstrap
@@ -88,3 +88,8 @@ 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'
}
+
+getBranchList () {
+ getBranchList_multiline=$(git -C "${1}" show-ref --heads | sed -E 's:^.*?refs/heads/::' || true)
+ printf '%s' "${getBranchList_multiline}" | sort -b | tr '\n' ' ' | sed -E 's:^ | $::g'
+}
diff --git a/test/tests/filter-directory-prune-branches.success b/test/tests/filter-directory-prune-branches.success
new file mode 100755
index 0000000..9d39fec
--- /dev/null
+++ b/test/tests/filter-directory-prune-branches.success
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. "$(cd -- "$(dirname -- "${0}")" && pwd -P)/../bootstrap"
+
+initializeRepositories
+
+"${BIN_MAIN}" --workdir "${DIR_TEMP}" -- "${DIR_SOURCE}" '--prune-empty --subdirectory-filter subdir' "${DIR_DESTINATION}"
+
+echo 'Fetching initial branches'
+actualBranches="$(getBranchList "${DIR_DESTINATION}")"
+expectedBrances='master slave'
+if test "${actualBranches}" != "${expectedBrances}"
+then
+ printf 'Expected branches: %s\nResulting branches: %s\n' "${expectedBrances}" "${actualBranches}">&2
+ exit 1
+fi
+
+"${BIN_MAIN}" --workdir "${DIR_TEMP}" --branch-blacklist 'slave' --prune-branches -- "${DIR_SOURCE}" '--prune-empty --subdirectory-filter subdir' "${DIR_DESTINATION}"
+
+echo 'Fetching final branches'
+actualBranches="$(getBranchList "${DIR_DESTINATION}")"
+expectedBrances='master'
+if test "${actualBranches}" != "${expectedBrances}"
+then
+ printf 'Expected branches: %s\nResulting branches: %s\n' "${expectedBrances}" "${actualBranches}">&2
+ exit 1
+fi
diff --git a/test/tests/filter-directory-prune-tags.success b/test/tests/filter-directory-prune-tags.success
new file mode 100755
index 0000000..15c6d71
--- /dev/null
+++ b/test/tests/filter-directory-prune-tags.success
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. "$(cd -- "$(dirname -- "${0}")" && pwd -P)/../bootstrap"
+
+initializeRepositories
+
+"${BIN_MAIN}" --workdir "${DIR_TEMP}" --branch-whitelist 'master' -- "${DIR_SOURCE}" '--prune-empty --subdirectory-filter subdir' "${DIR_DESTINATION}"
+
+echo 'Fetching initial tags'
+actualTags="$(getTagList "${DIR_DESTINATION}")"
+expectedTags='tag-02'
+if test "${actualTags}" != "${expectedTags}"
+then
+ printf 'Expected tags: %s\nResulting tags: %s\n' "${expectedTags}" "${actualTags}">&2
+ exit 1
+fi
+
+"${BIN_MAIN}" --workdir "${DIR_TEMP}" --branch-whitelist 'master' --prune-tags --tag-blacklist 'rx:tag-.*' -- "${DIR_SOURCE}" '--prune-empty --subdirectory-filter subdir' "${DIR_DESTINATION}"
+
+echo 'Fetching final tags'
+actualTags="$(getTagList "${DIR_DESTINATION}")"
+expectedTags=''
+if test "${actualTags}" != "${expectedTags}"
+then
+ printf 'Expected tags: %s\nResulting tags: %s\n' "${expectedTags}" "${actualTags}">&2
+ exit 1
+fi

© 2014-2024 Faster IT GmbH | imprint | privacy policy