aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/buildfile2
-rwxr-xr-xtests/common/git/init16
-rwxr-xr-xtests/common/git/pack5
-rw-r--r--tests/common/git/state0/libbar.tarbin71680 -> 71680 bytes
-rw-r--r--tests/common/git/state0/libfoo.tarbin296960 -> 296960 bytes
-rw-r--r--tests/common/git/state0/libfox.tarbin0 -> 133120 bytes
-rw-r--r--tests/common/git/state0/style-basic.tarbin71680 -> 71680 bytes
-rw-r--r--tests/common/git/state0/style.tarbin133120 -> 133120 bytes
-rw-r--r--tests/common/git/state1/libbaz.tarbin61440 -> 61440 bytes
-rw-r--r--tests/common/git/state1/libfoo.tarbin378880 -> 378880 bytes
-rw-r--r--tests/common/git/state1/libfox.tarbin0 -> 133120 bytes
-rw-r--r--tests/common/git/state1/style-basic.tarbin71680 -> 71680 bytes
-rw-r--r--tests/common/git/state1/style.tarbin133120 -> 133120 bytes
-rw-r--r--tests/rep-add.test10
-rw-r--r--tests/rep-fetch-git-branch.test156
-rw-r--r--tests/rep-fetch-git-commit.test77
-rw-r--r--tests/rep-fetch-git-refname.test148
-rw-r--r--tests/rep-fetch-git.test32
-rw-r--r--tests/rep-fetch.test57
19 files changed, 256 insertions, 247 deletions
diff --git a/tests/buildfile b/tests/buildfile
index 4716658..d37b8f0 100644
--- a/tests/buildfile
+++ b/tests/buildfile
@@ -6,7 +6,7 @@ define common: file
common{*}: extension = test
commons = common config auth remote \
- remote-git rep-fetch-git rep-fetch-git-branch rep-fetch-git-commit
+ remote-git rep-fetch-git rep-fetch-git-refname rep-fetch-git-commit
# The common/ directory contains repositories that are reused, being symlinked
# in source repositories specific for testscripts.
diff --git a/tests/common/git/init b/tests/common/git/init
index 691799e..e80ebf4 100755
--- a/tests/common/git/init
+++ b/tests/common/git/init
@@ -37,8 +37,8 @@ if [ -n "$unpack" ]; then
done
fi
-# Create the initial state of the repositories libfoo.git, libbar.git,
-# style.git, and style-basic.git.
+# Create the initial state of the repositories libfoo.git, libfox.git,
+# libbar.git, style.git, and style-basic.git.
#
cd state0
@@ -48,6 +48,10 @@ rm -f libfoo.git/README
rm -f -r libfoo.git/libbar
rm -f -r libfoo.git/doc/style
+rm -f -r libfox.git/.git
+rm -f libfox.git/.gitmodules
+rm -f -r libfox.git/libbar
+
rm -f -r libbar.git/.git
rm -f -r style.git/.git
@@ -113,6 +117,14 @@ touch libfoo.git/README
git -C libfoo.git add README
git -C libfoo.git commit -am 'README'
+# Create master branch for libfox.git, adding libbar.git as a submodule.
+#
+git -C libfox.git init
+git -C libfox.git add '*'
+git -C libfox.git submodule add ../libbar.git libbar
+git -C libfox.git submodule update --init --recursive # Recursive for safety.
+git -C libfox.git commit -am 'Create'
+
# Create the modified state of the repositories, replacing libbar.git submodule
# of libfoo with the newly created libbaz.git repository. Also advance master
# branches and tags for libfoo.git and it's submodule style.git.
diff --git a/tests/common/git/pack b/tests/common/git/pack
index f53e794..f9d9772 100755
--- a/tests/common/git/pack
+++ b/tests/common/git/pack
@@ -13,8 +13,9 @@ set -o errtrace # Trap in functions.
function info () { echo "$*" 1>&2; }
function error () { info "$*"; exit 1; }
-projects=('state0/libfoo' 'state0/libbar' 'state0/style' 'state0/style-basic' \
- 'state1/libfoo' 'state1/libbaz' 'state1/style' 'state1/style-basic')
+projects=(\
+ state0/libfoo state0/libfox state0/libbar state0/style state0/style-basic \
+ state1/libfoo state1/libfox state1/libbaz state1/style state1/style-basic)
for p in "${projects[@]}"; do
d=$p.git
diff --git a/tests/common/git/state0/libbar.tar b/tests/common/git/state0/libbar.tar
index bbb6f81..8be7c94 100644
--- a/tests/common/git/state0/libbar.tar
+++ b/tests/common/git/state0/libbar.tar
Binary files differ
diff --git a/tests/common/git/state0/libfoo.tar b/tests/common/git/state0/libfoo.tar
index 6f9af32..31b5519 100644
--- a/tests/common/git/state0/libfoo.tar
+++ b/tests/common/git/state0/libfoo.tar
Binary files differ
diff --git a/tests/common/git/state0/libfox.tar b/tests/common/git/state0/libfox.tar
new file mode 100644
index 0000000..b4037c5
--- /dev/null
+++ b/tests/common/git/state0/libfox.tar
Binary files differ
diff --git a/tests/common/git/state0/style-basic.tar b/tests/common/git/state0/style-basic.tar
index 6a7a1f2..80731dd 100644
--- a/tests/common/git/state0/style-basic.tar
+++ b/tests/common/git/state0/style-basic.tar
Binary files differ
diff --git a/tests/common/git/state0/style.tar b/tests/common/git/state0/style.tar
index 6295f34..1a88771 100644
--- a/tests/common/git/state0/style.tar
+++ b/tests/common/git/state0/style.tar
Binary files differ
diff --git a/tests/common/git/state1/libbaz.tar b/tests/common/git/state1/libbaz.tar
index ee8ad3e..298712c 100644
--- a/tests/common/git/state1/libbaz.tar
+++ b/tests/common/git/state1/libbaz.tar
Binary files differ
diff --git a/tests/common/git/state1/libfoo.tar b/tests/common/git/state1/libfoo.tar
index 4221cdd..2f2e3b4 100644
--- a/tests/common/git/state1/libfoo.tar
+++ b/tests/common/git/state1/libfoo.tar
Binary files differ
diff --git a/tests/common/git/state1/libfox.tar b/tests/common/git/state1/libfox.tar
new file mode 100644
index 0000000..d296973
--- /dev/null
+++ b/tests/common/git/state1/libfox.tar
Binary files differ
diff --git a/tests/common/git/state1/style-basic.tar b/tests/common/git/state1/style-basic.tar
index 8bc8b85..7391b66 100644
--- a/tests/common/git/state1/style-basic.tar
+++ b/tests/common/git/state1/style-basic.tar
Binary files differ
diff --git a/tests/common/git/state1/style.tar b/tests/common/git/state1/style.tar
index feedcaa..4be977b 100644
--- a/tests/common/git/state1/style.tar
+++ b/tests/common/git/state1/style.tar
Binary files differ
diff --git a/tests/rep-add.test b/tests/rep-add.test
index 8ee1b9d..9b52efd 100644
--- a/tests/rep-add.test
+++ b/tests/rep-add.test
@@ -45,13 +45,13 @@ rep_list += -d cfg
EOE
}
- : git-no-branch
+ : git-invalid-fragment
:
{
$clone_cfg;
- $* 'git://example.org/repo' 2>>EOE != 0
- error: invalid git repository location 'git://example.org/repo': missing branch/tag or commit id for git repository
+ $* 'git://example.org/repo#' 2>>EOE != 0
+ error: invalid git repository location 'git://example.org/repo#': missing reference name or commit id for git repository
EOE
}
@@ -108,8 +108,8 @@ rep_list += -d cfg
:
$clone_cfg && mkdir -p repo/.git;
- $* 'repo' 2>>~%EOE% != 0
- %error: invalid git repository location '.+repo': missing branch/tag or commit id for git repository%
+ $* 'repo' 2>>/~%EOE%
+ %added git:.+/repo%
EOE
: file-pkg
diff --git a/tests/rep-fetch-git-branch.test b/tests/rep-fetch-git-branch.test
deleted file mode 100644
index 6e23e20..0000000
--- a/tests/rep-fetch-git-branch.test
+++ /dev/null
@@ -1,156 +0,0 @@
-# file : tests/rep-fetch-git-branch.test
-# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
-# license : MIT; see accompanying LICENSE file
-
-reason_dumb = ' (dumb HTTP)'
-reason_unadv = ' (unadvertised commit)'
-
-warn_dumb='
-warning: fetching over dumb HTTP, no progress will be shown'
-
-: clone
-:
-{
- $clone_root_cfg && $rep_add "$rep/state0/libfoo.git#$branch";
-
- # Note that the commit for doc/style/basic submodule is not at the branch tip
- # and so is not advertised.
- #
- if ($git_protocol == 'local' || \
- $git_protocol == 'https-smart' || \
- $git_protocol == 'git')
- warn1 = '%.{0}'
- warn2 = '%.{0}'
- warn3 = "warning: fetching whole repository history for submodule 'doc/style/basic'$reason_unadv"
- fetch = '%.{0}'
- warn4 = '%.{0}'
- elif ($git_protocol == 'https-dumb')
- warn1 = "warning: fetching whole branch history$reason_dumb$warn_dumb"
- warn2 = "warning: fetching whole repository history for submodule 'doc/style'$reason_dumb$warn_dumb"
- warn3 = "warning: fetching whole repository history for submodule 'doc/style/basic'$reason_dumb$warn_dumb"
- fetch = '%.{0}'
- warn4 = "warning: fetching whole repository history for submodule 'libbar'$reason_dumb$warn_dumb"
- elif ($git_protocol == 'https-smart-unadv')
- warn1 = '%.{0}'
- warn2 = '%.{0}'
- warn3 = '%.{0}'
- fetch = "%fetching in '.+style/basic'.+%"
- warn4 = '%.{0}'
- end;
-
- $* 2>>~"%EOE%"
- %fetching git:.+libfoo#$branch%
- $warn1
- %Cloning into '.+$branch'.+%
- %Submodule 'doc/style' .+ registered for path 'doc/style'%
- %Submodule 'libbar' .+ registered for path 'libbar'%
- $warn2
- %Cloning into '.+doc/style'.+%
- %submodule path 'doc/style': checked out .+%
- %Submodule 'basic' .+ registered for path 'doc/style/basic'%
- $warn3
- %Cloning into '.+doc/style/basic'.+%
- $fetch
- %submodule path 'doc/style/basic': checked out .+%
- $warn4
- %Cloning into '.+libbar'.+%
- %submodule path 'libbar': checked out .+%
- 1 package\(s\) in 1 repository\(s\)
- EOE
-}
-
-: fetch
-:
-{
- : same
- :
- {
- $clone_root_cfg && $rep_add "$rep/state0/libfoo.git#$branch";
-
- # Convert specific warnings to infos as we expect them to appear. This, in
- # particular, prevents bbot workers to set task result status to warning.
- #
- $* 2>&1 | sed -e 's/warning: (fetching (over|whole) .*)/info: \1/' >&2 2>!;
-
- if ($git_protocol == 'https-dumb')
- warn = "warning: fetching whole branch history$reason_dumb$warn_dumb"
- else
- warn = '%.{0}'
- end;
-
- $* 2>>~"%EOE%"
- %fetching git:.+libfoo#$branch%
- $warn
- %fetching in '.+$branch'.+%
- 1 package\(s\) in 1 repository\(s\)
- EOE
- }
-
- : changed
- :
- {
- g = git -C
- u = "$rep_git/state1"
-
- $clone_root_cfg && $rep_add "$rep/state0/libfoo.git#$branch";
-
- # Extract the repository path from the output line like this:
- #
- # Cloning into 'cfg\.bpkg\tmp\f9be881264703b5d\master'...
- #
- $* 2>&1 | sed -n -e "s/Cloning into '\(.+$branch\)'\.{3}/\$1/p" | \
- sed -n -e 's%(.+[\\/])tmp([\\/].+)%$1repos$2%p' | \
- set r;
-
- $g "$r" config remote.origin.url "$u/libfoo.git";
-
- $g "$r" config submodule.libbar.url "$u/libbar.git";
- $g "$r" config submodule.doc/style.url "$u/style.git";
-
- $g "$r/libbar" config remote.origin.url "$u/libbar.git";
-
- $g "$r/doc/style" config remote.origin.url "$u/style.git";
- $g "$r/doc/style" config submodule.basic.url "$u/style-basic.git";
-
- $g "$r/doc/style/basic" config remote.origin.url "$u/style-basic.git";
-
- # Preconditions.
- #
- test -f $r/tests/TODO;
- test -f $r/libbar/libbar/manifest;
- test -f $r/doc/style/README != 0;
- test -d $r/libbaz != 0;
-
- if ($git_protocol == 'https-dumb')
- warn1 = "warning: fetching whole branch history$reason_dumb$warn_dumb"
- warn2 = "warning: fetching whole repository history for submodule 'doc/style'$reason_dumb$warn_dumb"
- warn3 = "warning: fetching whole repository history for submodule 'libbaz'$reason_dumb$warn_dumb"
- else
- warn1 = '%.{0}'
- warn2 = '%.{0}'
- warn3 = '%.{0}'
- end;
-
- $* 2>>~"%EOE%" 1>&2;
- %fetching git:.+libfoo#$branch%
- $warn1
- %fetching in '.+$branch'.+%
- %warning: unable to rmdir '?libbar'?:.+%
- %Submodule 'libbaz' .+ registered for path 'libbaz'%
- $warn2
- %fetching in '.+doc/style'.+%
- %submodule path 'doc/style': checked out .+%
- $warn3
- %Cloning into '.+libbaz'.+%
- %submodule path 'libbaz': checked out .+%
- 1 package\(s\) in 1 repository\(s\)
- EOE
-
- # Postconditions.
- #
- test -d $r/tests != 0;
- test -d $r/libbar != 0;
- test -f $r/doc/style/README;
- test -f $r/libbaz/manifest
- }
-}
diff --git a/tests/rep-fetch-git-commit.test b/tests/rep-fetch-git-commit.test
index 3169904..da08718 100644
--- a/tests/rep-fetch-git-commit.test
+++ b/tests/rep-fetch-git-commit.test
@@ -2,12 +2,6 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-reason_dumb = ' (dumb HTTP)'
-reason_unadv = ' (unadvertised commit)'
-
-warn_dumb='
-warning: fetching over dumb HTTP, no progress will be shown'
-
+git clone "$rep_git/state0/style-basic.git" 2>! &style-basic/***
: unadvertised
@@ -16,35 +10,22 @@ warning: fetching over dumb HTTP, no progress will be shown'
+git -C ../style-basic log '--pretty=format:%H' --all --grep='README' | \
set commit
- +git -C ../style-basic log '--pretty=format:%h' --all --grep='README' \
- --abbrev=16 | \
- set abbr_commit
-
: no-branch
:
{
$clone_root_cfg && $rep_add "$rep/state0/style-basic.git#@$commit";
- if ($git_protocol == 'https-smart-unadv')
- warn = '%.{0}'
- fetch = "%fetching in '.+$abbr_commit'.+%"
- else
- warn = "warning: fetching whole repository history"
-
- if ($git_protocol == 'https-dumb')
- warn = "$warn$reason_dumb$warn_dumb"
- else
- warn = "$warn$reason_unadv"
- end
-
- fetch = '%.{0}'
+ if ($git_protocol == 'https-dumb')
+ warn = "$warn_repo_hist$reason_dumb$warn_dumb"
+ elif ($git_protocol != 'https-smart-unadv')
+ warn = "$warn_repo_hist$reason_unadv"
end;
$* 2>>~"%EOE%"
%fetching git:.+style-basic#@$commit%
+ %querying .+style-basic\.git%?
$warn
- %Cloning into '.+$abbr_commit'.+%
- $fetch
+ %fetching from .+style-basic\.git%
1 package\(s\) in 1 repository\(s\)
EOE
}
@@ -54,26 +35,17 @@ warning: fetching over dumb HTTP, no progress will be shown'
{
$clone_root_cfg && $rep_add "$rep/state0/style-basic.git#stable@$commit";
- if ($git_protocol == 'https-smart-unadv')
- warn = '%.{0}'
- fetch = "%fetching in '.+$abbr_commit'.+%"
- else
- warn = "warning: fetching whole branch history"
-
- if ($git_protocol == 'https-dumb')
- warn = "$warn$reason_dumb$warn_dumb"
- else
- warn = "$warn$reason_unadv"
- end
-
- fetch = '%.{0}'
+ if ($git_protocol == 'https-dumb')
+ warn = "$warn_ref_hist$reason_dumb$warn_dumb"
+ elif ($git_protocol != 'https-smart-unadv')
+ warn = "$warn_ref_hist$reason_unadv"
end;
$* 2>>~"%EOE%"
%fetching git:.+style-basic#stable@$commit%
+ %querying .+style-basic\.git%?
$warn
- %Cloning into '.+$abbr_commit'.+%
- $fetch
+ %fetching from .+style-basic\.git%
1 package\(s\) in 1 repository\(s\)
EOE
}
@@ -85,24 +57,20 @@ warning: fetching over dumb HTTP, no progress will be shown'
+git -C ../style-basic log '--pretty=format:%H' --all --grep='INSTALL' | \
set commit
+ +if ($git_protocol == 'https-dumb')
+ warn = "$warn_ref_hist$reason_dumb$warn_dumb"
+ end
+
: no-branch
:
{
$clone_root_cfg && $rep_add "$rep/state0/style-basic.git#@$commit";
- if ($git_protocol == 'https-dumb')
- warn = "warning: fetching whole repository history$reason_dumb$warn_dumb"
- fetch = '%.{0}'
- else
- warn = '%.{0}'
- fetch = "%fetching in '.+$abbr_commit'.+%"
- end;
-
$* 2>>~"%EOE%"
%fetching git:.+style-basic#@$commit%
+ %querying .+style-basic\.git%?
$warn
- %Cloning into '.+$abbr_commit'.+%
- $fetch
+ %fetching from .+style-basic.\git%
1 package\(s\) in 1 repository\(s\)
EOE
}
@@ -112,16 +80,11 @@ warning: fetching over dumb HTTP, no progress will be shown'
{
$clone_root_cfg && $rep_add "$rep/state0/style-basic.git#stable@$commit";
- if ($git_protocol == 'https-dumb')
- warn ="warning: fetching whole branch history$reason_dumb$warn_dumb"
- else
- warn = '%.{0}'
- end;
-
$* 2>>~"%EOE%"
%fetching git:.+style-basic#stable@$commit%
+ %querying .+style-basic\.git%?
$warn
- %Cloning into '.+$abbr_commit'.+%
+ %fetching from .+style-basic\.git%
1 package\(s\) in 1 repository\(s\)
EOE
}
diff --git a/tests/rep-fetch-git-refname.test b/tests/rep-fetch-git-refname.test
new file mode 100644
index 0000000..ca1e0ff
--- /dev/null
+++ b/tests/rep-fetch-git-refname.test
@@ -0,0 +1,148 @@
+# file : tests/rep-fetch-git-refname.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+: fetch
+:
+{
+ $clone_root_cfg && $rep_add "$rep/state0/libfoo.git$fragment";
+
+ if ($git_protocol == 'https-dumb')
+ warn = "$warn_ref_hist$reason_dumb$warn_dumb"
+ end;
+
+ $* 2>>~"%EOE%"
+ %fetching git:.+libfoo$fragment%
+ %querying .+libfoo\.git%
+ $warn
+ %fetching from .+libfoo\.git%
+ 1 package\(s\) in 1 repository\(s\)
+ EOE
+}
+
+: re-fetch
+:
+{
+ : unchanged
+ :
+ {
+ $clone_root_cfg && $rep_add "$rep/state0/libfoo.git$fragment";
+
+ $* 2>!;
+
+ $* 2>>~"%EOE%"
+ %fetching git:.+libfoo$fragment%
+ %querying .+libfoo\.git%
+ 1 package\(s\) in 1 repository\(s\)
+ EOE
+ }
+
+ : changed
+ :
+ {
+ g = git -C
+ u = "$rep_git/state1"
+ d = cfg/libfoo-1.0.0
+
+ $clone_root_cfg && $rep_add "$rep/state0/libfoo.git$fragment";
+
+ # Extract the repository path from the output line like this:
+ #
+ # fetching from <url> in 'cfg/.bpkg/tmp/4bde15f59461'...
+ #
+ $* --verbose 2 2>&1 | \
+ sed -n -e "s/fetching from .+ in '\(.+\)'/\$1/p" | \
+ sed -n -e 's%(.+[\\/])tmp([\\/].+)%$1repos$2%p' | \
+ set r;
+
+ # Note that the commit for doc/style/basic submodule is not at the branch
+ # tip and so is not advertised.
+ #
+ warn1 = '%.{0}';
+ warn2 = '%.{0}';
+ warn3 = '%.{0}';
+
+ if ($git_protocol == 'local' || \
+ $git_protocol == 'https-smart' || \
+ $git_protocol == 'git')
+ warn2 = "$warn_repo_hist for submodule 'doc/style/basic'$reason_unadv"
+ elif ($git_protocol == 'https-dumb')
+ warn1 = "$warn_ref_hist for submodule 'doc/style'$reason_dumb$warn_dumb"
+ warn2 = "$warn_repo_hist for submodule 'doc/style/basic'$reason_dumb$warn_dumb"
+ warn3 = "$warn_ref_hist for submodule 'libbar'$reason_dumb$warn_dumb"
+ end;
+
+ $pkg_checkout libfoo/1.0.0 2>>~"%EOE%";
+ checking out libfoo/1.0.0
+ %querying .+style\.git%?
+ $warn1
+ %fetching submodule 'doc/style' from .+style\.git%
+ %submodule path 'doc/style': checked out .+%
+ %querying .+style-basic\.git%?
+ $warn2
+ %fetching submodule 'doc/style/basic' from .+style-basic\.git%
+ %submodule path 'doc/style/basic': checked out .+%
+ %querying .+libbar\.git%?
+ $warn3
+ %fetching submodule 'libbar' from .+libbar\.git%
+ %submodule path 'libbar': checked out .+%
+ distributing libfoo/1.0.0
+ checked out libfoo/1.0.0
+ EOE
+
+ $g "$r" config remote.origin.url "$u/libfoo.git";
+
+ # Preconditions.
+ #
+ test -f $d/tests/TODO;
+ test -f $d/libbar/libbar/manifest;
+ test -f $d/doc/style/README != 0;
+ test -d $d/libbaz != 0;
+
+ if ($git_protocol == 'https-dumb')
+ warn = "$warn_ref_hist$reason_dumb$warn_dumb"
+ end;
+
+ $* 2>>~"%EOE%" 1>&2;
+ %fetching git:.+libfoo$fragment%
+ %querying .+libfoo\.git%
+ $warn
+ %fetching from .+libfoo\.git%
+ %warning: unable to rmdir .?libbar.?: .+%
+ 1 package\(s\) in 1 repository\(s\)
+ EOE
+
+ $pkg_drop libfoo;
+
+ warn1 = '%.{0}';
+ warn2 = '%.{0}';
+
+ if ($git_protocol == 'https-dumb')
+ warn1 = "$warn_ref_hist for submodule 'doc/style'$reason_dumb$warn_dumb"
+ warn2 = "$warn_ref_hist for submodule 'libbaz'$reason_dumb$warn_dumb"
+ end;
+
+ $pkg_checkout libfoo/1.0.0 2>>~"%EOE%";
+ checking out libfoo/1.0.0
+ %querying .+style\.git%?
+ $warn1
+ %fetching submodule 'doc/style' from .+style\.git%
+ %submodule path 'doc/style': checked out .+%
+ %querying .+libbaz\.git%?
+ $warn2
+ %fetching submodule 'libbaz' from .+libbaz\.git%
+ %submodule path 'libbaz': checked out .+%
+ distributing libfoo/1.0.0
+ checked out libfoo/1.0.0
+ EOE
+
+ # Postconditions.
+ #
+ test -d $d/tests != 0;
+ test -d $d/libbar != 0;
+ test -f $d/doc/style/README;
+ test -f $d/libbaz/manifest;
+
+ $pkg_drop libfoo
+ }
+}
diff --git a/tests/rep-fetch-git.test b/tests/rep-fetch-git.test
index 1dbea3f..4b2a597 100644
--- a/tests/rep-fetch-git.test
+++ b/tests/rep-fetch-git.test
@@ -6,6 +6,17 @@
# the final states. See tests/common/git/init script for more details.
#
+reason_dumb = ' (dumb HTTP)'
+reason_unadv = ' (unadvertised commit)'
+
+warn_dumb='
+warning: fetching over dumb HTTP, no progress will be shown'
+
+warn_repo_hist = "warning: fetching whole repository history"
+warn_ref_hist = "warning: fetching whole reference history"
+
+warn = '%.{0}' # None.
+
test.cleanups += &cfg/.bpkg/repos/*/***
+if ($git_protocol == 'local')
@@ -33,25 +44,32 @@ else
rep_git = "$rep"
end
-: branch
+: none
+:
+{
+ fragment = ''
+ .include rep-fetch-git-refname.test
+}
+
+: refname
:
{
- branch = 'master'
- .include rep-fetch-git-branch.test
+ refname = '#master'
+ .include rep-fetch-git-refname.test
}
: ltag
:
{
- branch = 'ltag'
- .include rep-fetch-git-branch.test
+ fragment = '#ltag'
+ .include rep-fetch-git-refname.test
}
: atag
:
{
- branch = 'atag'
- .include rep-fetch-git-branch.test
+ fragment = '#atag'
+ .include rep-fetch-git-refname.test
}
: commit
diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test
index db0f801..5028bf9 100644
--- a/tests/rep-fetch.test
+++ b/tests/rep-fetch.test
@@ -99,6 +99,7 @@
# Create git repositories.
#
$git_extract $src/git/state0/libfoo.tar
+ $git_extract $src/git/state0/libfox.tar
$git_extract $src/git/state0/libbar.tar
$git_extract $src/git/state0/style.tar
$git_extract $src/git/state0/style-basic.tar &$out_git/state0/***
@@ -115,8 +116,9 @@ rep_remove += -d cfg 2>!
pkg_status += -d cfg
pkg_fetch += -d cfg 2>!
pkg_unpack += -d cfg 2>!
-pkg_checkout += -d cfg 2>!
+pkg_checkout += -d cfg
pkg_purge += -d cfg
+pkg_drop += -d cfg --yes 2>!
: no-repos
:
@@ -514,15 +516,14 @@ if ($remote != true)
$clone_root_cfg;
+ $* "$rep/style.git#master" 2>! &cfg/.bpkg/repos/*/***;
+
# Convert specific warnings to infos as we expect them to appear. This,
# in particular, prevents bbot workers to set task result status to
# warning.
#
- $* "$rep/style.git#master" 2>&1 | \
- sed -e 's/warning: (fetching (over|whole) .*)/info: \1/' >&2 2>! \
- &cfg/.bpkg/repos/*/***;
-
- $pkg_checkout "style/1.0.0" 2>!;
+ $pkg_checkout "style/1.0.0" 2>&1 | \
+ sed -e 's/warning: (fetching (over|whole) .*)/info: \1/' >&2 2>!;
$rep_add $rep/style.git;
$* 2>!;
@@ -598,9 +599,31 @@ else
}
}
- : re-clone
+ : checkout-submodules
+ :
+ : Test that if some of the packages are located in the repository
+ : submodules directory, then rep-fetch checks out submoodules.
+ :
+ {
+ $clone_root_cfg && $rep_add "$rep_git/state0/libfox.git#master";
+
+ $* 2>>~%EOE% &cfg/.bpkg/repos/*/***
+ %fetching git:.+libfox#master%
+ %querying .+libfox\.git%
+ %.{0,2}
+ %fetching from .+libfox\.git%
+ %querying .+libbar\.git%?
+ %.{0,2}
+ %fetching submodule 'libbar' from .+libbar\.git%
+ %submodule path 'libbar': checked out '.+'%
+ 2 package(s) in 1 repository(s)
+ EOE
+
+ }
+
+ : re-fetching
:
- : Test that repository is re-cloned on the location change. Here this happens
+ : Test that repository is re-fetched on the location change. Here it happens
: due to the scheme change.
:
if ($remote == true)
@@ -609,14 +632,13 @@ else
$* 2>! &cfg/.bpkg/repos/*/***;
$rep_add "$rep_git_https_smart_unadv/state0/libfoo.git#master";
- $* 2>>~"%EOE%"
+ $* 2>>~%EOE%
%fetching git:.+libfoo#master%
- %info: re-cloning git:.+libfoo#master due to location change%
+ %info: location changed for git:.+libfoo#master%
% info: new location https://.+libfoo.git#master%
% info: old location git://.+libfoo.git#master%
- %.+
- %Submodule 'libbar' .+https://.+libbar.+%
- %.+
+ %querying .+libfoo\.git%
+ 1 package(s) in 1 repository(s)
EOE
}
@@ -630,11 +652,12 @@ else
# Extract the repository path from the output line like this:
#
- # Cloning into 'cfg\.bpkg\tmp\f9be881264703b5d\master'...
+ # fetching from <url> in 'cfg/.bpkg/tmp/4bde15f59461'...
#
- $* 2>&1 | sed -n -e "s/Cloning into '\(.+master\)'\.{3}/\$1/p" | \
- sed -n -e 's%(.+[\\/])tmp([\\/].+)%$1repos$2%p' | \
- set r;
+ $* --verbose 2 2>&1 | \
+ sed -n -e "s/fetching from .+ in '\(.+\)'/\$1/p" | \
+ sed -n -e 's%(.+[\\/])tmp([\\/].+)%$1repos$2%p' | \
+ set r;
# Break the repo (drop the remote repository URL) and try to re-fetch.
#