Skip to content

Commit 3aa6694

Browse files
jeffhostetlergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aa57b87 commit 3aa6694

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

t/t5616-partial-clone.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,42 @@ test_expect_success 'push new commits to server for file.2.txt' '
105105
git -C src push -u srv master
106106
'
107107

108-
# Do FULL fetch by disabling filter-spec using --no-filter.
108+
# Do FULL fetch by disabling inherited filter-spec using --no-filter.
109109
# Verify we have all the new blobs.
110110
test_expect_success 'override inherited filter-spec using --no-filter' '
111111
git -C pc1 fetch --no-filter origin &&
112112
git -C pc1 rev-list master..origin/master --quiet --objects --missing=print >observed &&
113113
test_line_count = 0 observed
114114
'
115115

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+
116146
test_done

0 commit comments

Comments
 (0)