[PATCH 04/10] fetch tests: add a helper to avoid boilerplate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a new test_configured_prune_type_branch() helper to avoid the
boilerplate introduced in 97716d217c1 (fetch: add a --prune-tags
option and fetch.pruneTags config, 2018-02-09).

Back then it was somewhat necessary, but since 6317972cff9 (fetch:
make the --prune-tags work with <url>, 2018-02-09) these tests have
been regular enough that we can always pass the "kept" argument for
"link", and "pruned" for "name".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 t/t5510-fetch.sh | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 799e69dc1b1..5d118a6a806 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -1006,22 +1006,19 @@ test_configured_prune unset unset unset true pruned  kept \
 # remote. However, because there's no implicit
 # +refs/heads/*:refs/remotes/origin/* refspec and supplying it on the
 # command-line negates --prune-tags, the branches will not be pruned.
+test_configured_prune_type_branch () {
+	test_configured_prune_type "$1" "$2" "$3" "$4" pruned "$6" "$7" "name"
+	test_configured_prune_type "$1" "$2" "$3" "$4" kept   "$6" "$7" "link"
+}
 test_configured_prune_type unset unset unset unset kept   kept   "origin --prune-tags" "name"
 test_configured_prune_type unset unset unset unset kept   kept   "origin --prune-tags" "link"
-test_configured_prune_type unset unset unset unset pruned pruned "origin --prune --prune-tags" "name"
-test_configured_prune_type unset unset unset unset kept   pruned "origin --prune --prune-tags" "link"
-test_configured_prune_type unset unset unset unset pruned pruned "--prune --prune-tags origin" "name"
-test_configured_prune_type unset unset unset unset kept   pruned "--prune --prune-tags origin" "link"
-test_configured_prune_type unset unset true  unset pruned pruned "--prune origin" "name"
-test_configured_prune_type unset unset true  unset kept   pruned "--prune origin" "link"
-test_configured_prune_type unset unset unset true  pruned pruned "--prune origin" "name"
-test_configured_prune_type unset unset unset true  kept   pruned "--prune origin" "link"
-test_configured_prune_type true  unset true  unset pruned pruned "origin" "name"
-test_configured_prune_type true  unset true  unset kept   pruned "origin" "link"
-test_configured_prune_type unset  true true  unset pruned pruned "origin" "name"
-test_configured_prune_type unset  true true  unset kept   pruned "origin" "link"
-test_configured_prune_type unset  true unset true  pruned pruned "origin" "name"
-test_configured_prune_type unset  true unset true  kept   pruned "origin" "link"
+test_configured_prune_type_branch unset unset unset unset - pruned "origin --prune --prune-tags"
+test_configured_prune_type_branch unset unset unset unset - pruned "--prune --prune-tags origin"
+test_configured_prune_type_branch unset unset true  unset - pruned "--prune origin"
+test_configured_prune_type_branch unset unset unset true  - pruned "--prune origin"
+test_configured_prune_type_branch true  unset true  unset - pruned "origin"
+test_configured_prune_type_branch unset  true true  unset - pruned "origin"
+test_configured_prune_type_branch unset  true unset true  - pruned "origin"
 
 # When all remote.origin.fetch settings are deleted a --prune
 # --prune-tags still implicitly supplies refs/tags/*:refs/tags/* so
-- 
2.36.1.1239.gfba91521d90




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux