* [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base
@ 2019-06-11 21:06 Jonathan Tan
2019-06-11 21:06 ` [PATCH 1/2] t5616: use correct flag to check object is missing Jonathan Tan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jonathan Tan @ 2019-06-11 21:06 UTC (permalink / raw)
To: git; +Cc: Jonathan Tan, stolee
This series is on jt/partial-clone-missing-ref-delta-base.
Patch 1 is a cleanup, and patch 2 improves test code coverage. Thanks to
Stolee for the code coverage report.
I have checked this by running `make coverage` then `make cover_db_html`
on both "next" and this series, and comparing the output - the
relevant line indeed shows up as uncovered on "next", and covered on
this.
Jonathan Tan (2):
t5616: use correct flag to check object is missing
t5616: cover case of client having delta base
t/t5616-partial-clone.sh | 41 ++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
--
2.22.0.rc2.383.gf4fbbf30c2-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] t5616: use correct flag to check object is missing
2019-06-11 21:06 [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base Jonathan Tan
@ 2019-06-11 21:06 ` Jonathan Tan
2019-06-11 21:06 ` [PATCH 2/2] t5616: cover case of client having delta base Jonathan Tan
2019-06-12 2:39 ` [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base Derrick Stolee
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Tan @ 2019-06-11 21:06 UTC (permalink / raw)
To: git; +Cc: Jonathan Tan, stolee
If we want to check whether an object is missing, the correct flag to
pass to rev-list is --ignore-missing; --exclude-promisor-objects will
exclude any object that came from the promisor remote, whether it is
present or missing. Use the correct flag.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
t/t5616-partial-clone.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index f1baf83502..8b9b471a62 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -359,7 +359,7 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
--filter=blob:none $HTTPD_URL/one_time_sed/server repo &&
# Sanity check to ensure that the client does not have that blob.
- git -C repo rev-list --objects --exclude-promisor-objects \
+ git -C repo rev-list --objects --ignore-missing \
-- $(cat deltabase) >objlist &&
test_line_count = 0 objlist &&
--
2.22.0.rc2.383.gf4fbbf30c2-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] t5616: cover case of client having delta base
2019-06-11 21:06 [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base Jonathan Tan
2019-06-11 21:06 ` [PATCH 1/2] t5616: use correct flag to check object is missing Jonathan Tan
@ 2019-06-11 21:06 ` Jonathan Tan
2019-06-12 2:39 ` [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base Derrick Stolee
2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Tan @ 2019-06-11 21:06 UTC (permalink / raw)
To: git; +Cc: Jonathan Tan, stolee
When fetching into a partial clone, Git first prefetches missing
REF_DELTA bases from the promisor remote. (This feature was introduced
in [1].) But as can be seen in a recent test coverage report [2], the
case in which a REF_DELTA base is already present is not covered by
tests.
Extend the tests slightly to cover this case.
[1] 8a30a1efd1 ("index-pack: prefetch missing REF_DELTA bases",
2019-05-15).
[2] https://public-inbox.org/git/396091fc-5572-19a5-4f18-61c258590dd5@gmail.com/
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
t/t5616-partial-clone.sh | 39 ++++++++++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 11 deletions(-)
diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
index 8b9b471a62..b91ef548f8 100755
--- a/t/t5616-partial-clone.sh
+++ b/t/t5616-partial-clone.sh
@@ -346,30 +346,37 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
test_config -C "$SERVER" uploadpack.allowfilter 1 &&
test_config -C "$SERVER" uploadpack.allowanysha1inwant 1 &&
- # Create a commit with a blob to be used as a delta base.
+ # Create a commit with 2 blobs to be used as delta bases.
for i in $(test_seq 10)
do
- echo "this is a line" >>"$SERVER/foo.txt"
+ echo "this is a line" >>"$SERVER/foo.txt" &&
+ echo "this is another line" >>"$SERVER/have.txt"
done &&
- git -C "$SERVER" add foo.txt &&
+ git -C "$SERVER" add foo.txt have.txt &&
git -C "$SERVER" commit -m bar &&
- git -C "$SERVER" rev-parse HEAD:foo.txt >deltabase &&
+ git -C "$SERVER" rev-parse HEAD:foo.txt >deltabase_missing &&
+ git -C "$SERVER" rev-parse HEAD:have.txt >deltabase_have &&
+ # Clone. The client has deltabase_have but not deltabase_missing.
git -c protocol.version=2 clone --no-checkout \
--filter=blob:none $HTTPD_URL/one_time_sed/server repo &&
+ git -C repo hash-object -w -- "$SERVER/have.txt" &&
- # Sanity check to ensure that the client does not have that blob.
+ # Sanity check to ensure that the client does not have
+ # deltabase_missing.
git -C repo rev-list --objects --ignore-missing \
- -- $(cat deltabase) >objlist &&
+ -- $(cat deltabase_missing) >objlist &&
test_line_count = 0 objlist &&
# Another commit. This commit will be fetched by the client.
echo "abcdefghijklmnopqrstuvwxyz" >>"$SERVER/foo.txt" &&
- git -C "$SERVER" add foo.txt &&
+ echo "abcdefghijklmnopqrstuvwxyz" >>"$SERVER/have.txt" &&
+ git -C "$SERVER" add foo.txt have.txt &&
git -C "$SERVER" commit -m baz &&
# Pack a thin pack containing, among other things, HEAD:foo.txt
- # delta-ed against HEAD^:foo.txt.
+ # delta-ed against HEAD^:foo.txt and HEAD:have.txt delta-ed against
+ # HEAD^:have.txt.
printf "%s\n--not\n%s\n" \
$(git -C "$SERVER" rev-parse HEAD) \
$(git -C "$SERVER" rev-parse HEAD^) |
@@ -381,8 +388,13 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
# most significant nybble of the first byte is 0b1111 (0b1 to indicate
# that the header continues, and 0b111 to indicate REF_DELTA), followed
# by any 3 nybbles, then the OID of the delta base.
- git -C "$SERVER" rev-parse HEAD^:foo.txt >deltabase &&
- printf "f.,..%s" $(intersperse "," <deltabase) >want &&
+ printf "f.,..%s" $(intersperse "," <deltabase_missing) >want &&
+ hex_unpack <thin.pack | intersperse "," >have &&
+ grep $(cat want) have &&
+
+ # Ensure that the pack contains one delta against HEAD^:have.txt,
+ # similar to the above.
+ printf "f.,..%s" $(intersperse "," <deltabase_have) >want &&
hex_unpack <thin.pack | intersperse "," >have &&
grep $(cat want) have &&
@@ -394,7 +406,12 @@ test_expect_success 'tolerate server sending REF_DELTA against missing promisor
# Fetch the thin pack and ensure that index-pack is able to handle the
# REF_DELTA object with a missing promisor delta base.
- git -C repo -c protocol.version=2 fetch &&
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C repo -c protocol.version=2 fetch &&
+
+ # Ensure that the missing delta base was directly fetched, but not the
+ # one that the client has.
+ grep "want $(cat deltabase_missing)" trace &&
+ ! grep "want $(cat deltabase_have)" trace &&
# Ensure that the one-time-sed script was used.
! test -e "$HTTPD_ROOT_PATH/one-time-sed"
--
2.22.0.rc2.383.gf4fbbf30c2-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base
2019-06-11 21:06 [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base Jonathan Tan
2019-06-11 21:06 ` [PATCH 1/2] t5616: use correct flag to check object is missing Jonathan Tan
2019-06-11 21:06 ` [PATCH 2/2] t5616: cover case of client having delta base Jonathan Tan
@ 2019-06-12 2:39 ` Derrick Stolee
2 siblings, 0 replies; 4+ messages in thread
From: Derrick Stolee @ 2019-06-12 2:39 UTC (permalink / raw)
To: Jonathan Tan, git
On 6/11/2019 5:06 PM, Jonathan Tan wrote:
> This series is on jt/partial-clone-missing-ref-delta-base.
>
> Patch 1 is a cleanup, and patch 2 improves test code coverage. Thanks to
> Stolee for the code coverage report.
>
> I have checked this by running `make coverage` then `make cover_db_html`
> on both "next" and this series, and comparing the output - the
> relevant line indeed shows up as uncovered on "next", and covered on
> this.
Thanks for the additional tests, Jonathan! The update in PATCH 2 looks
like it took a bit of work, so thanks for your efforts there!
LGTM.
-Stolee
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-12 2:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-11 21:06 [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base Jonathan Tan
2019-06-11 21:06 ` [PATCH 1/2] t5616: use correct flag to check object is missing Jonathan Tan
2019-06-11 21:06 ` [PATCH 2/2] t5616: cover case of client having delta base Jonathan Tan
2019-06-12 2:39 ` [PATCH 0/2] Improve test code coverage on jt/partial-clone-missing-ref-delta-base Derrick Stolee
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).