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>
Jeff Hostetler committed
Dec 8, 2017 at 15:58 UTC
3aa6694fb3d38a3afe623ccbdf59fb15f338a94d
1 file changed
+31
-1
t/t5616-partial-clone.sh
+31
-1
@@ -105,7 +105,7 @@ test_expect_success 'push new commits to server for file.2.txt' '
105
git -C src push -u srv master
106
'
107
108
-# Do FULL fetch by disabling filter-spec using --no-filter.
108
+# Do FULL fetch by disabling inherited filter-spec using --no-filter.
109
# Verify we have all the new blobs.
110
test_expect_success 'override inherited filter-spec using --no-filter' '
111
git -C pc1 fetch --no-filter origin &&
@@ -113,4 +113,34 @@ test_expect_success 'override inherited filter-spec using --no-filter' '
113
test_line_count = 0 observed
114
'
115
116
+# create new commits in "src" repo to establish a history on file.3.txt
117
+# and push to "srv.bare".
118
+test_expect_success 'push new commits to server for file.3.txt' '
119
+ for x in a b c d e f
120
+ do
121
+ echo "Mod file.3.txt $x" >>src/file.3.txt
122
+ git -C src add file.3.txt
123
+ git -C src commit -m "mod $x"
124
+ done &&
125
+ git -C src push -u srv master
126
+'
127
+
128
+# Do a partial fetch and then try to manually fetch the missing objects.
129
+# This can be used as the basis of a pre-command hook to bulk fetch objects
130
+# perhaps combined with a command in dry-run mode.
131
+test_expect_success 'manual prefetch of missing objects' '
132
+ git -C pc1 fetch --filter=blob:none origin &&
133
+ git -C pc1 rev-list master..origin/master --quiet --objects --missing=print \
134
+ | awk -f print_1.awk \
135
+ | sed "s/?//" \
136
+ | sort >observed.oids &&
137
+ test_line_count = 6 observed.oids &&
138
+ git -C pc1 fetch-pack --stdin "file://$(pwd)/srv.bare" <observed.oids &&
139
+ git -C pc1 rev-list master..origin/master --quiet --objects --missing=print \
140
+ | awk -f print_1.awk \
141
+ | sed "s/?//" \
142
+ | sort >observed.oids &&
143
+ test_line_count = 0 observed.oids
144
+'
145
+
146
test_done