summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2017-12-08 15:58:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-08 17:58:52 (GMT)
commit3aa6694fb3d38a3afe623ccbdf59fb15f338a94d (patch)
tree53b7b4a33b1ed0d521996b0a14b7497fa3d9beeb /t
parentaa57b871dad3cca07abead9a8d1fefceffe7578d (diff)
downloadgit-3aa6694fb3d38a3afe623ccbdf59fb15f338a94d.zip
git-3aa6694fb3d38a3afe623ccbdf59fb15f338a94d.tar.gz
git-3aa6694fb3d38a3afe623ccbdf59fb15f338a94d.tar.bz2
t5616: test bulk prefetch after partial fetch
Add test to t5616 to bulk fetch missing objects following a partial fetch. A technique like this could be used in a pre-command hook for example. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5616-partial-clone.sh32
1 files changed, 31 insertions, 1 deletions
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 433e07e..29d8631 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -105,7 +105,7 @@ test_expect_success 'push new commits to server for file.2.txt' '
git -C src push -u srv master
'
-# Do FULL fetch by disabling filter-spec using --no-filter.
+# Do FULL fetch by disabling inherited filter-spec using --no-filter.
# Verify we have all the new blobs.
test_expect_success 'override inherited filter-spec using --no-filter' '
git -C pc1 fetch --no-filter origin &&
@@ -113,4 +113,34 @@ test_expect_success 'override inherited filter-spec using --no-filter' '
test_line_count = 0 observed
'
+# create new commits in "src" repo to establish a history on file.3.txt
+# and push to "srv.bare".
+test_expect_success 'push new commits to server for file.3.txt' '
+ for x in a b c d e f
+ do
+ echo "Mod file.3.txt $x" >>src/file.3.txt
+ git -C src add file.3.txt
+ git -C src commit -m "mod $x"
+ done &&
+ git -C src push -u srv master
+'
+
+# Do a partial fetch and then try to manually fetch the missing objects.
+# This can be used as the basis of a pre-command hook to bulk fetch objects
+# perhaps combined with a command in dry-run mode.
+test_expect_success 'manual prefetch of missing objects' '
+ git -C pc1 fetch --filter=blob:none origin &&
+ git -C pc1 rev-list master..origin/master --quiet --objects --missing=print \
+ | awk -f print_1.awk \
+ | sed "s/?//" \
+ | sort >observed.oids &&
+ test_line_count = 6 observed.oids &&
+ git -C pc1 fetch-pack --stdin "file://$(pwd)/srv.bare" <observed.oids &&
+ git -C pc1 rev-list master..origin/master --quiet --objects --missing=print \
+ | awk -f print_1.awk \
+ | sed "s/?//" \
+ | sort >observed.oids &&
+ test_line_count = 0 observed.oids
+'
+
test_done