From patchwork Mon Jun 10 23:35:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Arver via GitGitGadget X-Patchwork-Id: 10985637 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 07C2714BB for ; Mon, 10 Jun 2019 23:35:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC1C72845C for ; Mon, 10 Jun 2019 23:35:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E09E728623; Mon, 10 Jun 2019 23:35:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8646E2845C for ; Mon, 10 Jun 2019 23:35:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390685AbfFJXfg (ORCPT ); Mon, 10 Jun 2019 19:35:36 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:34075 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390650AbfFJXf3 (ORCPT ); Mon, 10 Jun 2019 19:35:29 -0400 Received: by mail-ed1-f68.google.com with SMTP id c26so16994953edt.1 for ; Mon, 10 Jun 2019 16:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=KnA30+e3AAJbIXMVx/anXWrN4GRIvEfiqITdtg6IWO4=; b=GFbFdbWRLde+6+UUxxE4feUQRREiW+lTA5HZTLBHgZM0IDUFb3kVl9zhl85rkHeaI/ fgXDnTUY5IdHGr6LrDfvQ9yFeD8MYk2fOcZ2e/oXKL7FpfPnhQpPb1e/+t/Oc/O5btzv phZcC3aVVceatTCidZWbBMiO3asfS/k17b4bqkGcmOjtUruDzpUhewGIoiwUVStfINY/ ZuDMyEmCRh/9in0QDo/ZBUlKPr/VOf7SxeaJW7WjHM4eQT2bt2zMLX7jFS2+VCtYzYxL +ZZCZcf1gak1F7yLu1zkJAkjYQe9/Zr72dcYcD3NB69I0Eo6KkcfgAmWesxV9TbMLVEG SZVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=KnA30+e3AAJbIXMVx/anXWrN4GRIvEfiqITdtg6IWO4=; b=gDs3/P//ApCMpO5afbnhjAYqJDzmcHUIOd78ORHdrQJ4YogQ+KH0CHsPd/hqhDVXuj JKaK48hNWaXfuzVazErN+mnt5LPlhXhgnmdwCatRlrK7f/BsGWwMdP+qmibPzoJiHhp3 7RR8JuBotVRuzq+FLirsRmgp6ZxUVa4ElTPEJCcb3l3X6vc4NeQaRaJzIJes0shh4YdY lEm8HwPYePl/OVt79aS6ZDmgvc/6CZt+Y+nequZQU3lxX57CUDt0NR+8pGL+aDGJFa6W HbD+btAdMdo4gGpvz8hVVAA0GVdq/KZBaWZeKGUmv6cNBKGmApkzNLfhxa/gylOVH/Fn LZ+A== X-Gm-Message-State: APjAAAW0XAIAm350XilFqXJp7l+s1xE4tP3CY48Kidu5d7cerGC4HGGp cPPYcFyppk4fXthlTdC2UcnE1uhu X-Google-Smtp-Source: APXvYqy5X468jnX1nhe+BUqGKdPOarfUBOUBDvOgyTrVmQUDBF8LCcXPaOd30/CM7APKxQ0DuSuVZA== X-Received: by 2002:a17:906:79d6:: with SMTP id m22mr50522033ejo.187.1560209728222; Mon, 10 Jun 2019 16:35:28 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n5sm3152165edt.65.2019.06.10.16.35.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jun 2019 16:35:27 -0700 (PDT) Date: Mon, 10 Jun 2019 16:35:27 -0700 (PDT) X-Google-Original-Date: Mon, 10 Jun 2019 23:35:18 GMT Message-Id: <80c7d2e5810cf851af11154dbe1e5abaa852a224.1560209720.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 09/11] multi-pack-index: test expire while adding packs Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: sbeller@google.com, peff@peff.net, jrnieder@gmail.com, avarab@gmail.com, jonathantanmy@google.com, Junio C Hamano , Derrick Stolee Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Derrick Stolee During development of the multi-pack-index expire subcommand, a version went out that improperly computed the pack order if a new pack was introduced while other packs were being removed. Part of the subtlety of the bug involved the new pack being placed before other packs that already existed in the multi-pack-index. Add a test to t5319-multi-pack-index.sh that catches this issue. The test adds new packs that cause another pack to be expired, and creates new packs that are lexicographically sorted before and after the existing packs. Signed-off-by: Derrick Stolee --- t/t5319-multi-pack-index.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index 6e47e5d0b2..8e04ce2821 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -478,4 +478,36 @@ test_expect_success 'expire removes repacked packs' ' ) ' +test_expect_success 'expire works when adding new packs' ' + ( + cd dup && + git pack-objects --revs .git/objects/pack/pack-combined <<-EOF && + refs/heads/A + ^refs/heads/B + EOF + git pack-objects --revs .git/objects/pack/pack-combined <<-EOF && + refs/heads/B + ^refs/heads/C + EOF + git pack-objects --revs .git/objects/pack/pack-combined <<-EOF && + refs/heads/C + ^refs/heads/D + EOF + git multi-pack-index write && + git pack-objects --revs .git/objects/pack/a-pack <<-EOF && + refs/heads/D + ^refs/heads/E + EOF + git multi-pack-index write && + git pack-objects --revs .git/objects/pack/z-pack <<-EOF && + refs/heads/E + EOF + git multi-pack-index expire && + ls .git/objects/pack/ | grep idx >expect && + test-tool read-midx .git/objects | grep idx >actual && + test_cmp expect actual && + git multi-pack-index verify + ) +' + test_done