From patchwork Sat May 9 14:24:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain via GitGitGadget X-Patchwork-Id: 11538347 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85D8E14C0 for ; Sat, 9 May 2020 14:24:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DE8221655 for ; Sat, 9 May 2020 14:24:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sP9WKgqF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727940AbgEIOYe (ORCPT ); Sat, 9 May 2020 10:24:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727105AbgEIOYe (ORCPT ); Sat, 9 May 2020 10:24:34 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0253C061A0C for ; Sat, 9 May 2020 07:24:33 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id h9so5301883wrt.0 for ; Sat, 09 May 2020 07:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=8jqajaVbYmMc5dDrPV/EI7TP138TInsTgrbGF0yCCFc=; b=sP9WKgqFeL0ex5NYX2xTBnn8p6y+ZcoGgx7Gq8jN+M5vPesHQruLN5a3C8FkIzOnE5 vdeLtV0sp39p8xU7N00pgxC69gvGGI+f4Ue7dtlRFUso/PtlPJ3bDEwttB9nS6r/j/zq fAiO1GlgZl1tdG4bNwPGpD5ZQBjVoXuDizDdYJHhcQtUYl/WyHTd8q2UPzx/edm3XAn8 hkNjFrXZGKiEwX1oN3RhStNK2lJ51hbpODYfMf6XFDngpAtJte4pCeAMnb+INQcMwNQr vRwe2jY1wdgZOLqttqMIykTtBZIJrLnh4c7xPjaqtLqlCqZ5bFmS8AUAc2hJ0zU3wa+C Kw4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=8jqajaVbYmMc5dDrPV/EI7TP138TInsTgrbGF0yCCFc=; b=oNiP5IUSAsYq28FCj7lN/SvMnB4yKCU/lir4xYV6oLbGf1amTDML0nmivloVyzv94N Rrxz/Q8YWfhgCDwv2goR2GT+yFfof0zIZDtTPEE3g9B7LSSdWNDgIondJsIm1B+qRSfd 2RZ4h5q/iSdUclLq56OYTSIL++yloxA4GN6u0ejg55D6cCw1yRJ1WNZA7j+jw1FhjQHE kFDVEMv2VijWIGX5kMwGy5dUHha6kgKcGcTF+fETvzu0JN359l22gs7+2D/XV05lQzl8 dn3EQ5GiE3R7L54DghknuFCgtCi80q+soHh89Sil47W0P5h9Vay/4/jCoXxhCPyOPQXz +vJg== X-Gm-Message-State: AGi0PuY9488NVlkQuMWRj4WCxKCTGiL/7CwQKux8zPTdaiv5EcBj72iD XarI4Zw4jfn3YZG1c7MLI1k5Vk29 X-Google-Smtp-Source: APiQypJL/BnmjbmpNyOxnhS72ejIKbUctdd40PuSGy1qGMWYk2Vm/8gfwe9CuD+rdZK7wop+1y8Eog== X-Received: by 2002:adf:f344:: with SMTP id e4mr8714225wrp.395.1589034272189; Sat, 09 May 2020 07:24:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 77sm8639963wrc.6.2020.05.09.07.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 May 2020 07:24:31 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Son Luong Ngoc via GitGitGadget" Date: Sat, 09 May 2020 14:24:28 +0000 Subject: [PATCH v3 1/3] midx: teach "git multi-pack-index repack" honor "git repack" configurations Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Son Luong Ngoc , Son Luong Ngoc Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Son Luong Ngoc Previously, when the "repack" subcommand of "git multi-pack-index" command creates new packfile(s), it does not call the "git repack" command but instead directly calls the "git pack-objects" command, and the configuration variables meant for the "git repack" command, like "repack.usedaeltabaseoffset", are ignored. This patch ensured "git multi-pack-index" checks the configuration variables used by "git repack" and passes the corresponding options to the underlying "git pack-objects" command. Note that `repack.writeBitmaps` configuration is ignored, as the pack bitmap facility is useful only with a single packfile. Signed-off-by: Son Luong Ngoc --- midx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/midx.c b/midx.c index 9a61d3b37d9..1e76be56826 100644 --- a/midx.c +++ b/midx.c @@ -1369,6 +1369,8 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size, struct child_process cmd = CHILD_PROCESS_INIT; struct strbuf base_name = STRBUF_INIT; struct multi_pack_index *m = load_multi_pack_index(object_dir, 1); + int delta_base_offset = 1; + int use_delta_islands = 0; if (!m) return 0; @@ -1381,12 +1383,20 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size, } else if (fill_included_packs_all(m, include_pack)) goto cleanup; + repo_config_get_bool(r, "repack.usedeltabaseoffset", &delta_base_offset); + repo_config_get_bool(r, "repack.usedeltaislands", &use_delta_islands); + argv_array_push(&cmd.args, "pack-objects"); strbuf_addstr(&base_name, object_dir); strbuf_addstr(&base_name, "/pack/pack"); argv_array_push(&cmd.args, base_name.buf); + if (delta_base_offset) + argv_array_push(&cmd.args, "--delta-base-offset"); + if (use_delta_islands) + argv_array_push(&cmd.args, "--delta-islands"); + if (flags & MIDX_PROGRESS) argv_array_push(&cmd.args, "--progress"); else From patchwork Sat May 9 14:24:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain via GitGitGadget X-Patchwork-Id: 11538351 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A114914C0 for ; Sat, 9 May 2020 14:24:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 850552184D for ; Sat, 9 May 2020 14:24:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rj8X+wAx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727995AbgEIOYg (ORCPT ); Sat, 9 May 2020 10:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727105AbgEIOYf (ORCPT ); Sat, 9 May 2020 10:24:35 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A2AEC061A0C for ; Sat, 9 May 2020 07:24:34 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id i15so5262783wrx.10 for ; Sat, 09 May 2020 07:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=vLwvwwzpb9qwVxE1q2cc0nMLfRc6MQAm7yWUIDNBSuw=; b=rj8X+wAxgsImHb5+lRliA4IVlW4I0YHA9Ou4uvR0k4R8dZSVwKGdz39cfGcTfwUoCK /FmzZ4O+ZT4n5c/QB9BB19Wro9/OHElL4W1L8ieVDlIc5m02NxljiH4Q4dGNJShpZJxk NiiKGNe9wWyaYdNTP7Nb3TXl6DYKC68Jtai8+cUd9bb884zy54cPXeoUz+wJ4+/pQI7F Y+tnu4117UXK4nG80V4qztI6oph6UdbYhCCWu45vzpERLc47PWQS8ZxbxUqrXaAEuFpU 8ZmkkulzdViNbgsVyJJcN3pn+o0R8LmKC8tQvjqU/kmQsno634+WxdgbDh6ez2E/HhBE 89SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=vLwvwwzpb9qwVxE1q2cc0nMLfRc6MQAm7yWUIDNBSuw=; b=aqlAdUYCYkAsD9G4rGoIQj4PIJ7wji4h1TwgOLfbCJ5gF/LmAYIwLQ615iGWJcUpod bBr5KugKJm10Uy+H/Wo6j3+fUDCJo4cflg1aN8k8FS291E0R7RNRLh7Y/Rp+PUH7eNDv qGwuUTjkA6IaicCBXJ+rSfXKDZa6CH4BaeOgVr2ECPkWUUrhfJMWEiADDdk23BUgcAk1 6Ad4EzfOMM6j07/maAMHSv/xNnAkyG7Ty/mciP+bk+OGgEvqzzU3zc+zVwbLe/PqJ5Sz rwpEw95MdkUaZpqZ9+QhwNeIem8g+TWu9nYm6Xsl8yUvY29U3HoDch8K/NrnNaoPBNLs ki5g== X-Gm-Message-State: AGi0PuZu7tmdNrAs/e02e3to4bQOAUZvAn3gD3GPzo7vE6lS5GsRBky0 f/CjCsfnJxhqaA09jADS4J8AGmsX X-Google-Smtp-Source: APiQypIKA0kJbpaNlZz5HZy3jblBZbR6Ve6tOCioazSBUOJhOfOAjj0WcG1dXuhjKpHIE1qNdJr0wg== X-Received: by 2002:adf:9d91:: with SMTP id p17mr2441137wre.119.1589034273043; Sat, 09 May 2020 07:24:33 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s12sm17509137wmc.7.2020.05.09.07.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 May 2020 07:24:32 -0700 (PDT) Message-Id: <988697dd5121430cd3ddfa60b1ebcf26027566ef.1589034270.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Date: Sat, 09 May 2020 14:24:29 +0000 Subject: [PATCH v3 2/3] multi-pack-index: respect repack.packKeptObjects=false Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Son Luong Ngoc , Derrick Stolee Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee When selecting a batch of pack-files to repack in the "git multi-pack-index repack" command, Git should respect the repack.packKeptObjects config option. When false, this option says that the pack-files with an associated ".keep" file should not be repacked. This config value is "false" by default. There are two cases for selecting a batch of objects. The first is the case where the input batch-size is zero, which specifies "repack everything". The second is with a non-zero batch size, which selects pack-files using a greedy selection criteria. Both of these cases are updated and tested. Reported-by: Son Luong Ngoc Signed-off-by: Derrick Stolee --- Documentation/git-multi-pack-index.txt | 3 +++ midx.c | 26 +++++++++++++++++++++----- t/t5319-multi-pack-index.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/Documentation/git-multi-pack-index.txt b/Documentation/git-multi-pack-index.txt index 642d9ac5b72..0c6619493c1 100644 --- a/Documentation/git-multi-pack-index.txt +++ b/Documentation/git-multi-pack-index.txt @@ -56,6 +56,9 @@ repack:: file is created, rewrite the multi-pack-index to reference the new pack-file. A later run of 'git multi-pack-index expire' will delete the pack-files that were part of this batch. ++ +If `repack.packKeptObjects` is `false`, then any pack-files with an +associated `.keep` file will not be selected for the batch to repack. EXAMPLES diff --git a/midx.c b/midx.c index 1e76be56826..9b14d915db1 100644 --- a/midx.c +++ b/midx.c @@ -1293,15 +1293,26 @@ static int compare_by_mtime(const void *a_, const void *b_) return 0; } -static int fill_included_packs_all(struct multi_pack_index *m, +static int fill_included_packs_all(struct repository *r, + struct multi_pack_index *m, unsigned char *include_pack) { - uint32_t i; + uint32_t i, count = 0; + int pack_kept_objects = 0; + + repo_config_get_bool(r, "repack.packkeptobjects", &pack_kept_objects); + + for (i = 0; i < m->num_packs; i++) { + if (prepare_midx_pack(r, m, i)) + continue; + if (!pack_kept_objects && m->packs[i]->pack_keep) + continue; - for (i = 0; i < m->num_packs; i++) include_pack[i] = 1; + count++; + } - return m->num_packs < 2; + return count < 2; } static int fill_included_packs_batch(struct repository *r, @@ -1312,6 +1323,9 @@ static int fill_included_packs_batch(struct repository *r, uint32_t i, packs_to_repack; size_t total_size; struct repack_info *pack_info = xcalloc(m->num_packs, sizeof(struct repack_info)); + int pack_kept_objects = 0; + + repo_config_get_bool(r, "repack.packkeptobjects", &pack_kept_objects); for (i = 0; i < m->num_packs; i++) { pack_info[i].pack_int_id = i; @@ -1338,6 +1352,8 @@ static int fill_included_packs_batch(struct repository *r, if (!p) continue; + if (!pack_kept_objects && p->pack_keep) + continue; if (open_pack_index(p) || !p->num_objects) continue; @@ -1380,7 +1396,7 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size, if (batch_size) { if (fill_included_packs_batch(r, m, include_pack, batch_size)) goto cleanup; - } else if (fill_included_packs_all(m, include_pack)) + } else if (fill_included_packs_all(r, m, include_pack)) goto cleanup; repo_config_get_bool(r, "repack.usedeltabaseoffset", &delta_base_offset); diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index 030a7222b2a..67afe1bb8d9 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -538,6 +538,32 @@ test_expect_success 'repack with minimum size does not alter existing packs' ' ) ' +test_expect_success 'repack respects repack.packKeptObjects=false' ' + test_when_finished rm -f dup/.git/objects/pack/*keep && + ( + cd dup && + ls .git/objects/pack/*idx >idx-list && + test_line_count = 5 idx-list && + ls .git/objects/pack/*.pack | sed "s/\.pack/.keep/" >keep-list && + for keep in $(cat keep-list) + do + touch $keep || return 1 + done && + git multi-pack-index repack --batch-size=0 && + ls .git/objects/pack/*idx >idx-list && + test_line_count = 5 idx-list && + test-tool read-midx .git/objects | grep idx >midx-list && + test_line_count = 5 midx-list && + THIRD_SMALLEST_SIZE=$(test-tool path-utils file-size .git/objects/pack/*pack | sort -n | head -n 3 | tail -n 1) && + BATCH_SIZE=$(($THIRD_SMALLEST_SIZE + 1)) && + git multi-pack-index repack --batch-size=$BATCH_SIZE && + ls .git/objects/pack/*idx >idx-list && + test_line_count = 5 idx-list && + test-tool read-midx .git/objects | grep idx >midx-list && + test_line_count = 5 midx-list + ) +' + test_expect_success 'repack creates a new pack' ' ( cd dup && From patchwork Sat May 9 14:24:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain via GitGitGadget X-Patchwork-Id: 11538349 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E526014C0 for ; Sat, 9 May 2020 14:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB3B521655 for ; Sat, 9 May 2020 14:24:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Rp2fWgFS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728000AbgEIOYh (ORCPT ); Sat, 9 May 2020 10:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727952AbgEIOYf (ORCPT ); Sat, 9 May 2020 10:24:35 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CA3EC05BD09 for ; Sat, 9 May 2020 07:24:35 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id m24so3480255wml.2 for ; Sat, 09 May 2020 07:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=6oMiC5HfMt17+yhDMimQ4CYPwwr8sDw5Rq+k+C87Z9I=; b=Rp2fWgFS/XoZ021gemsg/H1AjnMTL2o24Uq5FqUQr8rZ5V81wBvTUtvzsVTirPnMl2 jaMf4J0nwIGD7S4afouw/RA4a9w798LgPd9TfzYcn3HiIW6v6aB+1RKv6Nx2MuZlgVja 6EBabneKrqXebES3tcOIvF6kxBn4Ok6KLhPUEdJKMT7fwTWsKGaA2+DWwBtvtmw9poPP PU8+i9odYQnitiWM14ayyOdNJvnI3UQIbm5H1XEUm8eNPVhXH86790bVGGGE89eHKVjD zqfEspX3L8b/CLRxPV2D4HO7JzY2V1lJbm1YZJx57Ik7QRVRYnT6TrEbOD+UjYg7nUab ROVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=6oMiC5HfMt17+yhDMimQ4CYPwwr8sDw5Rq+k+C87Z9I=; b=E9O+1cc8nZJZOsZDghGAWdKXx58tVbgP1ZeXDxfCHXij+Vsc5cXLJO9qzo46m2U60y ADsVNT0DzT6/zxD+Dgy30QU9b6nFkMxg/4ad0et+BkteNEzKIcGxFWcyTMWC9rMfVgC8 wPyJAS8E7uqRwivW87HUtWbYNhiMKljQpPC1aeZUisLIIjZknleLR6fzHdfEVSdvLzjq 9XcnQJf1aDmOaZsNakXmdJKOxtZvr1hCzQ62XsNc9zJDUB2Ddj8nPpcd5xvHqIHqh3o8 FI1tV2Sf3e6v91YN0IOR7SqrVsxffhq6Z7IMXvkXovrvxBYxjxtXTgj2EXNekahi+hoi ue0A== X-Gm-Message-State: AGi0PuZYZAeF/QvRC26H5WgUStJlATNwXYRzws1C45ADgks7wKkZQYAG dRCbbn7OX0O1Woc5IaqmKvDimgc9 X-Google-Smtp-Source: APiQypIXpZS7uxy1KhfS/KVHoGMisvXiHAzVz744XedeE6vPRBi5OKoa+3m4u251fISk1G+chuPEFQ== X-Received: by 2002:a1c:990d:: with SMTP id b13mr21116632wme.179.1589034273795; Sat, 09 May 2020 07:24:33 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f8sm8128724wrm.8.2020.05.09.07.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 May 2020 07:24:33 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Son Luong Ngoc via GitGitGadget" Date: Sat, 09 May 2020 14:24:30 +0000 Subject: [PATCH v3 3/3] Ensured t5319 follows arith expansion guideline Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Son Luong Ngoc , Son Luong Ngoc Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Son Luong Ngoc As the old versions of dash is deprecated, dollar-sign inside artihmetic expansion is no longer needed. This ensures t5319 follows the coding guideline updated in 'jk/arith-expansion-coding-guidelines' 6d4bf5813cd2c1a3b93fd4f0b231733f82133cce. Reported-by: Eric Sunshine Signed-off-by: Son Luong Ngoc --- t/t5319-multi-pack-index.sh | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh index 67afe1bb8d9..065f48747f3 100755 --- a/t/t5319-multi-pack-index.sh +++ b/t/t5319-multi-pack-index.sh @@ -62,8 +62,8 @@ generate_objects () { } >wide_delta_$iii && { test-tool genrandom "foo"$i 100 && - test-tool genrandom "foo"$(( $i + 1 )) 100 && - test-tool genrandom "foo"$(( $i + 2 )) 100 + test-tool genrandom "foo"$(( i + 1 )) 100 && + test-tool genrandom "foo"$(( i + 2 )) 100 } >deep_delta_$iii && { echo $iii && @@ -251,21 +251,21 @@ MIDX_BYTE_OID_VERSION=5 MIDX_BYTE_CHUNK_COUNT=6 MIDX_HEADER_SIZE=12 MIDX_BYTE_CHUNK_ID=$MIDX_HEADER_SIZE -MIDX_BYTE_CHUNK_OFFSET=$(($MIDX_HEADER_SIZE + 4)) +MIDX_BYTE_CHUNK_OFFSET=$((MIDX_HEADER_SIZE + 4)) MIDX_NUM_CHUNKS=5 MIDX_CHUNK_LOOKUP_WIDTH=12 -MIDX_OFFSET_PACKNAMES=$(($MIDX_HEADER_SIZE + \ - $MIDX_NUM_CHUNKS * $MIDX_CHUNK_LOOKUP_WIDTH)) -MIDX_BYTE_PACKNAME_ORDER=$(($MIDX_OFFSET_PACKNAMES + 2)) -MIDX_OFFSET_OID_FANOUT=$(($MIDX_OFFSET_PACKNAMES + $(test_oid packnameoff))) +MIDX_OFFSET_PACKNAMES=$((MIDX_HEADER_SIZE + \ + MIDX_NUM_CHUNKS * MIDX_CHUNK_LOOKUP_WIDTH)) +MIDX_BYTE_PACKNAME_ORDER=$((MIDX_OFFSET_PACKNAMES + 2)) +MIDX_OFFSET_OID_FANOUT=$((MIDX_OFFSET_PACKNAMES + $(test_oid packnameoff))) MIDX_OID_FANOUT_WIDTH=4 -MIDX_BYTE_OID_FANOUT_ORDER=$((MIDX_OFFSET_OID_FANOUT + 250 * $MIDX_OID_FANOUT_WIDTH + $(test_oid fanoutoff))) -MIDX_OFFSET_OID_LOOKUP=$(($MIDX_OFFSET_OID_FANOUT + 256 * $MIDX_OID_FANOUT_WIDTH)) -MIDX_BYTE_OID_LOOKUP=$(($MIDX_OFFSET_OID_LOOKUP + 16 * $HASH_LEN)) -MIDX_OFFSET_OBJECT_OFFSETS=$(($MIDX_OFFSET_OID_LOOKUP + $NUM_OBJECTS * $HASH_LEN)) +MIDX_BYTE_OID_FANOUT_ORDER=$((MIDX_OFFSET_OID_FANOUT + 250 * MIDX_OID_FANOUT_WIDTH + $(test_oid fanoutoff))) +MIDX_OFFSET_OID_LOOKUP=$((MIDX_OFFSET_OID_FANOUT + 256 * MIDX_OID_FANOUT_WIDTH)) +MIDX_BYTE_OID_LOOKUP=$((MIDX_OFFSET_OID_LOOKUP + 16 * HASH_LEN)) +MIDX_OFFSET_OBJECT_OFFSETS=$((MIDX_OFFSET_OID_LOOKUP + NUM_OBJECTS * HASH_LEN)) MIDX_OFFSET_WIDTH=8 -MIDX_BYTE_PACK_INT_ID=$(($MIDX_OFFSET_OBJECT_OFFSETS + 16 * $MIDX_OFFSET_WIDTH + 2)) -MIDX_BYTE_OFFSET=$(($MIDX_OFFSET_OBJECT_OFFSETS + 16 * $MIDX_OFFSET_WIDTH + 6)) +MIDX_BYTE_PACK_INT_ID=$((MIDX_OFFSET_OBJECT_OFFSETS + 16 * MIDX_OFFSET_WIDTH + 2)) +MIDX_BYTE_OFFSET=$((MIDX_OFFSET_OBJECT_OFFSETS + 16 * MIDX_OFFSET_WIDTH + 6)) test_expect_success 'verify bad version' ' corrupt_midx_and_verify $MIDX_BYTE_VERSION "\00" $objdir \ @@ -417,10 +417,10 @@ test_expect_success 'verify multi-pack-index with 64-bit offsets' ' NUM_OBJECTS=63 MIDX_OFFSET_OID_FANOUT=$((MIDX_OFFSET_PACKNAMES + 54)) -MIDX_OFFSET_OID_LOOKUP=$((MIDX_OFFSET_OID_FANOUT + 256 * $MIDX_OID_FANOUT_WIDTH)) -MIDX_OFFSET_OBJECT_OFFSETS=$(($MIDX_OFFSET_OID_LOOKUP + $NUM_OBJECTS * $HASH_LEN)) -MIDX_OFFSET_LARGE_OFFSETS=$(($MIDX_OFFSET_OBJECT_OFFSETS + $NUM_OBJECTS * $MIDX_OFFSET_WIDTH)) -MIDX_BYTE_LARGE_OFFSET=$(($MIDX_OFFSET_LARGE_OFFSETS + 3)) +MIDX_OFFSET_OID_LOOKUP=$((MIDX_OFFSET_OID_FANOUT + 256 * MIDX_OID_FANOUT_WIDTH)) +MIDX_OFFSET_OBJECT_OFFSETS=$((MIDX_OFFSET_OID_LOOKUP + NUM_OBJECTS * HASH_LEN)) +MIDX_OFFSET_LARGE_OFFSETS=$((MIDX_OFFSET_OBJECT_OFFSETS + NUM_OBJECTS * MIDX_OFFSET_WIDTH)) +MIDX_BYTE_LARGE_OFFSET=$((MIDX_OFFSET_LARGE_OFFSETS + 3)) test_expect_success 'verify incorrect 64-bit offset' ' corrupt_midx_and_verify $MIDX_BYTE_LARGE_OFFSET "\07" objects64 \ @@ -555,7 +555,7 @@ test_expect_success 'repack respects repack.packKeptObjects=false' ' test-tool read-midx .git/objects | grep idx >midx-list && test_line_count = 5 midx-list && THIRD_SMALLEST_SIZE=$(test-tool path-utils file-size .git/objects/pack/*pack | sort -n | head -n 3 | tail -n 1) && - BATCH_SIZE=$(($THIRD_SMALLEST_SIZE + 1)) && + BATCH_SIZE=$((THIRD_SMALLEST_SIZE + 1)) && git multi-pack-index repack --batch-size=$BATCH_SIZE && ls .git/objects/pack/*idx >idx-list && test_line_count = 5 idx-list && @@ -570,7 +570,7 @@ test_expect_success 'repack creates a new pack' ' ls .git/objects/pack/*idx >idx-list && test_line_count = 5 idx-list && THIRD_SMALLEST_SIZE=$(test-tool path-utils file-size .git/objects/pack/*pack | sort -n | head -n 3 | tail -n 1) && - BATCH_SIZE=$(($THIRD_SMALLEST_SIZE + 1)) && + BATCH_SIZE=$((THIRD_SMALLEST_SIZE + 1)) && git multi-pack-index repack --batch-size=$BATCH_SIZE && ls .git/objects/pack/*idx >idx-list && test_line_count = 6 idx-list &&