From patchwork Tue Jun 11 21:06:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Tan X-Patchwork-Id: 10988283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1BC5213AF for ; Tue, 11 Jun 2019 21:06:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EA831FF30 for ; Tue, 11 Jun 2019 21:06:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0307428831; Tue, 11 Jun 2019 21:06:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B51C1FF30 for ; Tue, 11 Jun 2019 21:06:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407336AbfFKVGx (ORCPT ); Tue, 11 Jun 2019 17:06:53 -0400 Received: from mail-oi1-f202.google.com ([209.85.167.202]:46253 "EHLO mail-oi1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406793AbfFKVGx (ORCPT ); Tue, 11 Jun 2019 17:06:53 -0400 Received: by mail-oi1-f202.google.com with SMTP id x72so1232066oif.13 for ; Tue, 11 Jun 2019 14:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=QMZjR6Lu5zwTeDAblnuqe/ZxeGzF7hP5N2im5o41CCg=; b=fWXEqb2QULYgZ9mpn2BrbqKic+4bkyZ0P0XhGFKQzCTxMrlKUgq0DQVfAvFGIseiJY +BNku5YB4xs5y/KSQcN5YsE/Q7WJcprj/aT9yrScn3AelLzwk0MF2MpLmPXTqXKPmFrR zaEE8b43HHxgx1/eEYVsZf7S/ilJ+eK95VT7Aw58FG6xbsD068/1YZ/m3sO0hX7LrttN 4XAJDKGlkA4LkRkn5yi57r5BrHZzCf2RIy6pX34bAnV/blwk/+7Z5OMF73TbHH+HHCym BixOZiIxN8dqAMppVGnBQVb7i43cmdmq4iDsaZiWWZilfJPyv+nodyI21pkwT7+jQ10F G1Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=QMZjR6Lu5zwTeDAblnuqe/ZxeGzF7hP5N2im5o41CCg=; b=F/UYUeX3eXwhk2INbwx6Sgofq1rZko/IEa/AfZ/NlMFdrIQ2sLeK90BB5Ha4GNoSpd O/Tl2QO9Jus8MAq0jjRcVXDuneg4vEL6m+3YhGXjA6X/1jzznuUsldYzlf8eTwJCUh1p Tbct5nALpTcjNIUYQCFnk9nY1aLL+fL4u25P75BoLLqa26+7yuX1bfPM94FRAZDMNte6 JfeyUAvSPCK4iduEAL8fKBB3Pdtraf6+T6k4FKMdFP0RT5nBppEjr260CSQu/+jHXWJ9 oQJWd50WgChlrFW1DbFtLNH3PpmM3gyL8tgsWwxcIH3fVkPch7Eh4r6b48x9IPc0mWj+ fiIA== X-Gm-Message-State: APjAAAUCbVcwA/G+hrb+Sw/eFVoK3vfCjsimEf904F7bRIz89WTIynPy KtLjIksYCbiOZrDKoochInW+AS54Z4XWUVJo+BsCjWwyA8uhn6mfsWsy81WyENQ0/t7ySeqIviv 9JnGLY3f0esgSmnvmSPnRkZ6kWNvZe53BHOUffrou/3uZ0OtiLKiHpDZrq/T1EweBWs+Vb1qphK to X-Google-Smtp-Source: APXvYqwczMbJGv+gYFdgUU6gcDdO/ukJS+Rcu0fx9T2VlXgEasmXIq6iXPUQpwHgzfcajCdzafHq1awbZlRgOs3enoBn X-Received: by 2002:aca:3b8a:: with SMTP id i132mr15687989oia.90.1560287212509; Tue, 11 Jun 2019 14:06:52 -0700 (PDT) Date: Tue, 11 Jun 2019 14:06:46 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog Subject: [PATCH 1/2] t5616: use correct flag to check object is missing From: Jonathan Tan To: git@vger.kernel.org Cc: Jonathan Tan , stolee@gmail.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 && From patchwork Tue Jun 11 21:06:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Tan X-Patchwork-Id: 10988285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39D7D76 for ; Tue, 11 Jun 2019 21:06:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B7AD2834A for ; Tue, 11 Jun 2019 21:06:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F7C0288BF; Tue, 11 Jun 2019 21:06:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 998CF2834A for ; Tue, 11 Jun 2019 21:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407395AbfFKVG4 (ORCPT ); Tue, 11 Jun 2019 17:06:56 -0400 Received: from mail-qk1-f201.google.com ([209.85.222.201]:48716 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406793AbfFKVG4 (ORCPT ); Tue, 11 Jun 2019 17:06:56 -0400 Received: by mail-qk1-f201.google.com with SMTP id w184so12032934qka.15 for ; Tue, 11 Jun 2019 14:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=wMIHqNgZw/+xgDWg3XokOuUUijnq1w8QvoC542GMS0c=; b=c7AtoYVqTvEbZ/V6vuhGyt/V+MLvI76ezCth58nsLN8hAgYMFhtCuZ7J1gffQs+buf Px0DwvmAln9mICOsy3Dc1QOBGrxNi9Fj8eFohMjPPK4+GiV4oyjSh7nOoXolU0sxHtIp g0ZjO04hau/9496Vr8Arm6TX54gRVVO03NTvFNSiQuCvm21XrDVPU0JN5rNZDfu85yZW w5tCWHHzyv8CvCwywyYHGqCP/EJdYqDM0D4Kn+8h5SdLx3fwhSFUms0IyYhgdBBQrS/B C20jjxP5sRIKhBbZkKzlxeKvEVGgNt+yewl6ASKiGBgg958nyoXIVlwZidDqXZfsO8tP Y1NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=wMIHqNgZw/+xgDWg3XokOuUUijnq1w8QvoC542GMS0c=; b=FoRIgTC2q9qWD4iDUWm4n3ZGhy9ip5pAyrWth/EII88XNLzZno8SOnTFSN/I1L//aX bsriFibo2N151WzAlIuqFoLnsAadXmTJXKDcWYHYMG1Rsnb3nSDxuQKmH2vUOdP6zDCp hUUleVatE+BrfYwEfzYFoocnrjjvNjmFIj6nIxAqdQ8iI3wsjUjgPuMW2gKAGGqCcQtn DJxfbn2V5i6Pwhp8vBMj2UD7Ngrx2RrLDKTnMZIfvhP9SvjEfCUh8X+h0M4v3O66Ybpq KWwzNMBbLT3ygEkGTiPh3+x2rw9JghilDxkhdcKnkgvQhEIN1FTkz/in/mj06Wp7mj3z jFPQ== X-Gm-Message-State: APjAAAVjCaSCtfI0pQRA8+9djVuKqRchYuOyE7n1eal/4lB5SkByzUpx kmGWdMn5RAlLhLWgd3gYAvJyldnOJJZMNAvKLNnR3A2P2CcsOLMzh+p2J9+zApUoj6iFrLfEmhu n4HM3Nw71M5Ofr+VxaOOrhAJ0ggV67V4QcahO/C3tviUvOmjBmjd6/xJimufOzUOir1o71+i62x Ln X-Google-Smtp-Source: APXvYqwPo434EjOymxQ0oxfCseZI7nf+1Z25pGjEfuYBhCjqkisVI6MZsgxyTQ8HCvcKsktHW9qT/KVQfwJ2jEsWBl0f X-Received: by 2002:a0c:afa4:: with SMTP id s33mr46251147qvc.194.1560287215016; Tue, 11 Jun 2019 14:06:55 -0700 (PDT) Date: Tue, 11 Jun 2019 14:06:47 -0700 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog Subject: [PATCH 2/2] t5616: cover case of client having delta base From: Jonathan Tan To: git@vger.kernel.org Cc: Jonathan Tan , stolee@gmail.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 "," want && + printf "f.,..%s" $(intersperse "," want && + hex_unpack have && + grep $(cat want) have && + + # Ensure that the pack contains one delta against HEAD^:have.txt, + # similar to the above. + printf "f.,..%s" $(intersperse "," want && hex_unpack 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"