From 4ebe65d7dda10909995c7460050811f05205e0ee Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 30 Apr 2018 22:55:13 +0300 Subject: Add support for default and excluding git ref filters --- tests/rep-fetch.test | 149 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 144 insertions(+), 5 deletions(-) (limited to 'tests/rep-fetch.test') diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test index 47be179..6f563d4 100644 --- a/tests/rep-fetch.test +++ b/tests/rep-fetch.test @@ -610,15 +610,14 @@ else $* 2>>~%EOE% &cfg/.bpkg/repos/*/*** %fetching git:.+libfox#master% %querying .+libfox\.git% - %.{0,2} %fetching from .+libfox\.git% + %warning: .+%{0,2} %querying .+libbar\.git%? - %.{0,2} %fetching submodule 'libbar' from .+libbar\.git% + %warning: .+%{0,2} %submodule path 'libbar': checked out '.+'% 2 package(s) in 1 repository(s) EOE - } : re-fetching @@ -635,8 +634,8 @@ else $* 2>>~%EOE% %fetching git:.+libfoo#master% %info: location changed for git:.+libfoo#master% - % info: new location https://.+libfoo.git#master% - % info: old location git://.+libfoo.git#master% + % info: new location https://.+libfoo\.git#master% + % info: old location git://.+libfoo\.git#master% %querying .+libfoo\.git% 1 package(s) in 1 repository(s) EOE @@ -671,4 +670,144 @@ else $pkg_status libfoo >'libfoo unknown' } + + : ref-filters + : + { + test.cleanups += &?cfg/.bpkg/repos/*/*** + + : pattern + : + { + : matching + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git#v**" 2>>~%EOE% + %added .+libfoo#v\*\*% + %querying .+libfoo\.git% + %fetching from .+libfoo\.git% + %warning: .+%{0,2} + 2 package(s) in 1 repository(s) + EOE + } + + : non-matching + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git#tags/mast*" 2>>~%EOE% + %added .+libfoo#tags/mast\*% + %querying .+libfoo\.git% + 0 package(s) in 1 repository(s) + EOE + } + } + + : name + : + { + : non-matching + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git#foo" 2>>~%EOE% != 0 + %added .+libfoo#foo% + %querying .+libfoo\.git% + error: reference 'foo' is not found + EOE + } + } + + : commit + : + { + : non-matching-pattern + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git#foo*@9ab039761936802d61b8e591d6812a4dd4605029" 2>>~%EOE% != 0 + %added .+libfoo#foo\*@9ab039761936802d61b8e591d6812a4dd4605029% + %querying .+libfoo\.git% + error: no names match pattern 'foo*' + EOE + } + + : unexisting + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git#9ab039761936802d61b8e591d6812a4dd4605029" 2>>~%EOE% != 0 + %added .+libfoo#9ab039761936802d61b8e591d6812a4dd4605029% + %querying .+libfoo\.git% + %fetching from .+libfoo\.git% + %warning: .+%{0,2} + error: unable to fetch commit 9ab039761936802d61b8e591d6812a4dd4605029 + EOE + } + } + + : exclusion + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git#mast*,-master" 2>>~%EOE% + %added .+libfoo#mast\*,-master% + %querying .+libfoo\.git% + 0 package(s) in 1 repository(s) + EOE + } + + : inclusion + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git#tags/mast*,+master" 2>>~%EOE% + %added .+libfoo#tags/mast\*,\+master% + %querying .+libfoo\.git% + %fetching from .+libfoo\.git% + %warning: .+%{0,2} + 1 package(s) in 1 repository(s) + EOE + } + + : default + : + { + : no-fragment + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git" 2>>~%EOE% + %added .+libfoo% + %querying .+libfoo\.git% + %fetching from .+libfoo\.git% + %warning: .+%{0,2} + 2 package(s) in 1 repository(s) + EOE + } + + : with-exclusion + : + { + $clone_root_cfg; + + $* "$rep_git/state0/libfoo.git##-/tags/v1*" 2>>~%EOE% + %added .+libfoo##-/tags/v1\*% + %querying .+libfoo\.git% + %fetching from .+libfoo\.git% + %warning: .+%{0,2} + 1 package(s) in 1 repository(s) + EOE + } + } + } } -- cgit v1.1