From patchwork Thu Apr 21 13:26:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teng Long X-Patchwork-Id: 12821635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F46CC433EF for ; Thu, 21 Apr 2022 13:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352770AbiDUN3y (ORCPT ); Thu, 21 Apr 2022 09:29:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376881AbiDUN3l (ORCPT ); Thu, 21 Apr 2022 09:29:41 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F0DA37030 for ; Thu, 21 Apr 2022 06:26:52 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id bo5so5014695pfb.4 for ; Thu, 21 Apr 2022 06:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b7g9eW9RwCBNx2B1/hay/W26lr/E3QDlUS38CQTOIlE=; b=aM8F44RVVwts1AMiQJpFbGgKrvSO19e5kybIy9HqCgb9gafC0CcYAg2SIEY050gW8d Zjrnot/Tk+eE2Y2PYPEkfTpThUZSJEKeUR0CiV2732CbIXs4CWPk0zGG609/UKSpla6H ELydmse+/A6PV1gOxVXhZnsbyLzwY+ocgvs09G0jXjVVhRcyV8IIPdrDLjJr0XY1xhIu W2FfIIfe6KkEfoua83MQki9SdQ1DGhGC6yeuRedWZ48+XsMvL2S6cnU+llJq9AAHc55h K268xPTn7NODzd+lm7VgfUIGD0Y42G6IVNPBKIDrckgP9UGSSXYxzh6Fz+fMnGqYc7i7 7Y1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b7g9eW9RwCBNx2B1/hay/W26lr/E3QDlUS38CQTOIlE=; b=EBeGnLXKHq9clEYN5kPrpXaQUsjcRzFfgqh0L5e2vU24hSVuu36RDVEh+F6/iPcWRm pqeLhJZNhR/a/G0DkSC4faHAOILHS/rwhp7WPMJ1mIpbVPinUN7whvG1V+acv2ZslB58 2R/pKr1ZB4zEtOKoLlHrfRYx4eOMCfP3zf2hf8kqVS+1p3rQ16HIFGTjnoGBf0mFqjO1 vQdlbLsGaRuXYlD8wARpiWzpA0WDutt0JryWavnPbZ7MG89XVcbX0PotxaCXgVZQWw9h HiLqhZbN2wb2HcaV9QXO9+uwIR79WdEUqowpEsfkfGHd28hn0+M0rjyjx27upz9ajrIn re1w== X-Gm-Message-State: AOAM533h1trDYLG5GNDZ7yTQsjVSEvO5s6cyXVkm61umPF3vE03iNypw y7zfo93iBJNqkDdTjmrATdI= X-Google-Smtp-Source: ABdhPJzTHKaqWrx/ZW2Dpe9d54XYd6qf0gK5h3uub0XmfPQvY9XvWw/Kjd2nIKN0WmPLV8aZ/IvphQ== X-Received: by 2002:a63:2d47:0:b0:399:53e3:5b4c with SMTP id t68-20020a632d47000000b0039953e35b4cmr24138595pgt.165.1650547611467; Thu, 21 Apr 2022 06:26:51 -0700 (PDT) Received: from code-infra-dev-cbj.ea134 ([140.205.70.42]) by smtp.gmail.com with ESMTPSA id bd42-20020a056a0027aa00b0050a6e0ccc54sm15463647pfb.186.2022.04.21.06.26.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Apr 2022 06:26:51 -0700 (PDT) From: Teng Long To: dyroneteng@gmail.com Cc: avarab@gmail.com, derrickstolee@github.com, git@vger.kernel.org, me@ttaylorr.com, tenglong.tl@alibaba-inc.com, gitster@pobox.com Subject: [PATCH v2 1/5] pack-bitmap.c: continue looping when first MIDX bitmap is found Date: Thu, 21 Apr 2022 21:26:36 +0800 Message-Id: <1bfd2fb6ab01af689fc6495e2f32d3f64c19f4b7.1650547400.git.dyroneteng@gmail.com> X-Mailer: git-send-email 2.35.1.583.g30faa5f068 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In "open_midx_bitmap()", we do a loop with the MIDX(es) in repo, when the first one has been found, then will break out by a "return" directly. But actually, it's better to don't stop the loop until we have visited both the MIDX in our repository, as well as any alternates (along with _their_ alternates, recursively). The discussion link of community: https://public-inbox.org/git/YjzCTLLDCby+kJrZ@nand.local/ Helped-by: Taylor Blau Signed-off-by: Teng Long --- pack-bitmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index 9c666cdb8b..112c2b12c6 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -494,15 +494,16 @@ static int open_pack_bitmap(struct repository *r, static int open_midx_bitmap(struct repository *r, struct bitmap_index *bitmap_git) { + int ret = -1; struct multi_pack_index *midx; assert(!bitmap_git->map); for (midx = get_multi_pack_index(r); midx; midx = midx->next) { if (!open_midx_bitmap_1(bitmap_git, midx)) - return 0; + ret = 0; } - return -1; + return ret; } static int open_bitmap(struct repository *r, From patchwork Thu Apr 21 13:26:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teng Long X-Patchwork-Id: 12821636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 255D3C433EF for ; Thu, 21 Apr 2022 13:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386056AbiDUN35 (ORCPT ); Thu, 21 Apr 2022 09:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377865AbiDUN3v (ORCPT ); Thu, 21 Apr 2022 09:29:51 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E18837A0D for ; Thu, 21 Apr 2022 06:26:54 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id p3so3676501pfw.0 for ; Thu, 21 Apr 2022 06:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UdGyCn43+OHjY3CvW6jv/rL7yauPpi/BUM+a9VWdVkE=; b=lviRgpYjnTdM0w9vLq8RN7lGESQPKJVoXBPQ8YsitxeyzHytwMvpIVm2/WEXcx08Q0 CJHRCGPW7gHI3n2aKAjPdNP1Y2qKfSl3oXX9W7tcjLA8ogCQbEgvLPV4DS+TlPmOtaQ1 ZzDzM2EM0/4d8oQhpI6Zrvn+FpgK4KF7qoZrM0lkOABuILG+otFVIqg22bL3/BpgEA+C OYClJRDz+iE3F1gpy6guSgbvzjU7a4pKr+PF7gcXekCmk8DRg4BEYPi7lVD0jNZRC5SG 3WanlQX8eEoHKz+tU+I/9mNixurCjoq6IMK1SayPfWFjeyS48fEPQepuhfro5OxSKTmU qLlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UdGyCn43+OHjY3CvW6jv/rL7yauPpi/BUM+a9VWdVkE=; b=q+NGFVW+RlJxe1UiReE2DZDFrbhl0Acg3GtIDLr9KPlxp8KFlG6R+pd9X/fMXSCd9B CfcgqDt/AG0LPysWQH+PMW/4rKthIZlT4fhTbr1daEeZz6Ix+zrcCVGBOGpHS1BXfYPr EDyye2HhamlF+749OT3ysUgekir5jEn7ag5Jf3dbbX/BipcRApQNoHypMDZ4yoYo40JH 4mrgUEfBfCijtiSw6PDGuw703BIsZme7qboukwwFRwqAM3ZUrGExC2f6Kj1xPIRW4uU4 stYik/Q/JLACA9kxvwvqgCd/mvx/eSJt69S4MWgLOMpU8jirot1R0nq4qT6BLN8BVUQ1 2O/g== X-Gm-Message-State: AOAM533K4q5PxuZ5y5BOqSmU1Sr496iwJixGMQV4Vn6n3FEeZr8PDC+W ypvugqaS3xxmqERUFcHcDCk= X-Google-Smtp-Source: ABdhPJwzwiaW02aDB7+G+3cWdoIUr7fduoMMPluupnMukKvicyQqZDtJRb8ANt65Ln+HNxjCC47bAA== X-Received: by 2002:a05:6a00:890:b0:4f6:686e:a8a9 with SMTP id q16-20020a056a00089000b004f6686ea8a9mr28894992pfj.83.1650547614088; Thu, 21 Apr 2022 06:26:54 -0700 (PDT) Received: from code-infra-dev-cbj.ea134 ([140.205.70.42]) by smtp.gmail.com with ESMTPSA id bd42-20020a056a0027aa00b0050a6e0ccc54sm15463647pfb.186.2022.04.21.06.26.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Apr 2022 06:26:53 -0700 (PDT) From: Teng Long To: dyroneteng@gmail.com Cc: avarab@gmail.com, derrickstolee@github.com, git@vger.kernel.org, me@ttaylorr.com, tenglong.tl@alibaba-inc.com, gitster@pobox.com Subject: [PATCH v2 2/5] pack-bitmap.c: rename "idx_name" to "bitmap_name" Date: Thu, 21 Apr 2022 21:26:37 +0800 Message-Id: <1fff3b3ca76d0b5e026270fdf746c55b582405d5.1650547400.git.dyroneteng@gmail.com> X-Mailer: git-send-email 2.35.1.583.g30faa5f068 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In "open_pack_bitmap_1()" and "open_midx_bitmap_1()" we use a var named "idx_name" to represent the bitmap filename which is computed by "midx_bitmap_filename()" or "pack_bitmap_filename()" before we open it. There may bring some confusion in this "idx_name" naming, which might lead us to think of ".idx "or" multi-pack-index" files, although bitmap is essentially can be understood as a kind of index , let's define this name a little more accurate here. Signed-off-by: Teng Long --- pack-bitmap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index 112c2b12c6..f13a6bfe3a 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -313,10 +313,10 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, struct multi_pack_index *midx) { struct stat st; - char *idx_name = midx_bitmap_filename(midx); - int fd = git_open(idx_name); + char *bitmap_name = midx_bitmap_filename(midx); + int fd = git_open(bitmap_name); - free(idx_name); + free(bitmap_name); if (fd < 0) return -1; @@ -368,14 +368,14 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git { int fd; struct stat st; - char *idx_name; + char *bitmap_name; if (open_pack_index(packfile)) return -1; - idx_name = pack_bitmap_filename(packfile); - fd = git_open(idx_name); - free(idx_name); + bitmap_name = pack_bitmap_filename(packfile); + fd = git_open(bitmap_name); + free(bitmap_name); if (fd < 0) return -1; From patchwork Thu Apr 21 13:26:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Teng Long X-Patchwork-Id: 12821637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 628ABC433EF for ; Thu, 21 Apr 2022 13:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384665AbiDUN37 (ORCPT ); Thu, 21 Apr 2022 09:29:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384716AbiDUN3z (ORCPT ); Thu, 21 Apr 2022 09:29:55 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36C9E37A91 for ; Thu, 21 Apr 2022 06:26:57 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id bo5so5014878pfb.4 for ; Thu, 21 Apr 2022 06:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TZResOIvkem8YOSvCxatHOlmDV/IlI4Rjbas/BTW3z0=; b=BwVlDzRqVNH/4qMZ5UZkQOGPAwubkUueVs4oXU+BhEwYNpd0hsNvK3Y+crNtAKiZpC hKcCSPWAgmnjR6XODocs1GF8dDF3uG98A5kTFT/VlFKc5/v3PIngSVr4HcjE/UQ6BzOh TXo0tEH2KBsv0SefXqP6Y8VGcTUcqgF1nqFne2WJoSY28Mm4yhi7CyxqQ2Waj+iVB6Cq fBsmgJqB7IKysjvzH94A2rfyRq+bu25FB1q1jvzmW+lSkygjjRnmM2Ic+TkuOD4D2Im1 +LFiUBHm8ZbE9imPEm3G21JLzN//fJtWXkbKnww/lvIOeO/2p7m0wEY0n63CsN0kKlrD rzjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TZResOIvkem8YOSvCxatHOlmDV/IlI4Rjbas/BTW3z0=; b=3FQWOYbZXfFze5ywjiCyR1FdBjLBrb5w0mDhZhyhEId9UMh1fBqxT+8ROQlSfN993x kbxS9uxxvf5iJsy/LSmdA8VuD++WVLuIjy2vDRkityjTTOFaP/DjeUc1WvaVo0bqORae JcSMyVj6YCSbf2v/Gvab7yKjexjIfBV5o3CFX8MdxVMzdaA9wqaTHAWIzhNcrHwIGNGB JTS0xnan4m3202RsawF52NPK6te83cfOWN0CNJBYQGVqOjy9U33a+s26reQSkHksasrq Q+gSCMknRG6184JEo+pFNX/3lRHYD9hU4Mm9UxJxkutxcFb2jC8cU94GiRl0L4rQEnNC UoEg== X-Gm-Message-State: AOAM532NxBUwS66AuZxNJ2dzNTRRnopdW+43xELM3DWX9wZr/u1hrswy zQK+HU5l3o+1O8ojdh2xHNI= X-Google-Smtp-Source: ABdhPJwzWmqAG9VetGaAz9zlbpFfzMX2fe1mvT1sKWJPMMYmNz8jg0cH/qpzwDCUELYt3IY0dsF+/w== X-Received: by 2002:aa7:83c2:0:b0:505:723f:6ace with SMTP id j2-20020aa783c2000000b00505723f6acemr28954005pfn.86.1650547616716; Thu, 21 Apr 2022 06:26:56 -0700 (PDT) Received: from code-infra-dev-cbj.ea134 ([140.205.70.42]) by smtp.gmail.com with ESMTPSA id bd42-20020a056a0027aa00b0050a6e0ccc54sm15463647pfb.186.2022.04.21.06.26.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Apr 2022 06:26:56 -0700 (PDT) From: Teng Long To: dyroneteng@gmail.com Cc: avarab@gmail.com, derrickstolee@github.com, git@vger.kernel.org, me@ttaylorr.com, tenglong.tl@alibaba-inc.com, gitster@pobox.com Subject: [PATCH v2 3/5] pack-bitmap.c: make warnings more detailed when opening bitmap Date: Thu, 21 Apr 2022 21:26:38 +0800 Message-Id: <5a8f5afccf6e2b451c76306e04ca9ef300c92fdd.1650547400.git.dyroneteng@gmail.com> X-Mailer: git-send-email 2.35.1.583.g30faa5f068 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When calling the "open_midx_bitmap_1()" or "open_pack_bitmap_1()", there will be a warning if a normal bitmap or MIDX bitmap already has been opened, then let's make the warning information more detailed. For example, it makes the error clearer in case of an accidental regression where we start looking for single-pack bitmaps after successfully opening a multi-pack one. At the same time, we made the previous and new warning texts support translation. Discussion in community: 1. https://public-inbox.org/git/YkPGq0mDL4NG6D1o@nand.local/#t 2. https://public-inbox.org/git/220330.868rsrpohm.gmgdl@evledraar.gmail.com/ Helped-by: Ævar Arnfjörð Bjarmason Helped-by: Taylor Blau Signed-off-by: Teng Long --- pack-bitmap.c | 6 ++++-- t/t5310-pack-bitmaps.sh | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index f13a6bfe3a..1b268f655e 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -330,7 +330,8 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, struct strbuf buf = STRBUF_INIT; get_midx_filename(&buf, midx->object_dir); /* ignore extra bitmap file; we can only handle one */ - warning("ignoring extra bitmap file: %s", buf.buf); + warning(_("a normal or midx bitmap already has been opened")); + warning(_("ignoring extra bitmap file: %s"), buf.buf); close(fd); strbuf_release(&buf); return -1; @@ -387,7 +388,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git if (bitmap_git->pack || bitmap_git->midx) { /* ignore extra bitmap file; we can only handle one */ - warning("ignoring extra bitmap file: %s", packfile->pack_name); + warning(_("a normal or midx bitmap already has been opened ")); + warning(_("ignoring extra bitmap file: %s"), packfile->pack_name); close(fd); return -1; } diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh index f775fc1ce6..eb63b71852 100755 --- a/t/t5310-pack-bitmaps.sh +++ b/t/t5310-pack-bitmaps.sh @@ -421,6 +421,7 @@ test_expect_success 'complains about multiple pack bitmaps' ' test_line_count = 2 bitmaps && git rev-list --use-bitmap-index HEAD 2>err && + grep "a bitmap has been opened" err && grep "ignoring extra bitmap file" err ) ' From patchwork Thu Apr 21 13:26:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teng Long X-Patchwork-Id: 12821639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C80CAC433F5 for ; Thu, 21 Apr 2022 13:27:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385236AbiDUNaG (ORCPT ); Thu, 21 Apr 2022 09:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359856AbiDUN34 (ORCPT ); Thu, 21 Apr 2022 09:29:56 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAF3A37AB4 for ; Thu, 21 Apr 2022 06:26:59 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id c12so4852603plr.6 for ; Thu, 21 Apr 2022 06:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eYERQd+q7Kku86Z2xOHETiM2WP4shZojLHj3UNvXEbs=; b=OS3dXVcNkSb6UVlxp3Wo0M6HQY6JoKfkBROTgwklwv7O39SLsrK6aVsi207kmW/vmL ZoODtiT9By/yVqYx6OlFaRBNcZzQrEFScVhWoanCNzHlsRlC/7mJtpUW5+XY6P8XqUgs YcT0iCSgH343V5ziI/oXgAQGd9bk0woUjNQGuRkFzClqe8LLAkiNGi1arOJotMpeeICC IS31ZrqEdjfTP+qV4XQVwL4EXtPN2tAOkOrC77Q6R/ynQAGhtujn7khjhNUAKrmzptur 3kF4xh3VpHQEnmXLRfF4OGnkcJT6MX3MpvZVL99Yh61ge/KhIigc0lBaYKBE3WpWzzOn Z11A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eYERQd+q7Kku86Z2xOHETiM2WP4shZojLHj3UNvXEbs=; b=oy76Xzfg13tekvbzODdrsdEI9mpLyjT0NPO5yl0dl4J0xHGcWEyeUu+Yte/vQQr3rP ifQ683HmtvSFD0cC1qVYApG5ytgSQTMABF+IFnjec5U+B0Dja6h9nY4kaWN581i7FM8c NtMjp3vECwE6MSsAsAUDNis+hvdhHQG30PkWN+BwRp8d7V5G2L3SaufmJfmxIzw3UEvb fwa7qmYS8WLXTlm+af0IwOI8jCcmrB9N3A8YfRB3S8afHs4GBGv8Gb6Ihy/2W5KJSs9o bLKNTSIhsnrUczXrnwQplIJRTnP0CVLG+Nn8FDRu6R6XbE3OsSVqcOF3LeOfalAm6A4E 4sOA== X-Gm-Message-State: AOAM5327BO+is0aqAfOLcykD0IlpXeJS9oHGI5hct3Pd2Y1mjUDrpDwZ BMbSnGBlb8nsWAfz7OfWsv4= X-Google-Smtp-Source: ABdhPJz3R75+bnG71Ao+Va2M5JEBPP4Cm4Zr+wj3XAGKHjQWXAwczkeNJevQaszaxwAkbtpyyFGMSQ== X-Received: by 2002:a17:90a:4414:b0:1cd:4c16:e7eb with SMTP id s20-20020a17090a441400b001cd4c16e7ebmr10510614pjg.166.1650547619196; Thu, 21 Apr 2022 06:26:59 -0700 (PDT) Received: from code-infra-dev-cbj.ea134 ([140.205.70.42]) by smtp.gmail.com with ESMTPSA id bd42-20020a056a0027aa00b0050a6e0ccc54sm15463647pfb.186.2022.04.21.06.26.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Apr 2022 06:26:58 -0700 (PDT) From: Teng Long To: dyroneteng@gmail.com Cc: avarab@gmail.com, derrickstolee@github.com, git@vger.kernel.org, me@ttaylorr.com, tenglong.tl@alibaba-inc.com, gitster@pobox.com Subject: [PATCH v2 4/5] bitmap: add trace2 outputs during open "bitmap" file Date: Thu, 21 Apr 2022 21:26:39 +0800 Message-Id: <2016ef2e342c2ec6517afa8ec3e57035021fb965.1650547400.git.dyroneteng@gmail.com> X-Mailer: git-send-email 2.35.1.583.g30faa5f068 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org It's supported for a Git repo to use bitmap in both normal bitmap way or a multi-pack-index bitmap. Sometimes the debug path is not obvious, for example, when executing: $git rev-list --test-bitmap HEAD fatal: failed to load bitmap indexes If we see the output like this, we are not sure about what's happened, because the cause should be : 1. neither normal nor midx bitmap exists 2. only midx bitmap exists but core.multipackIndex="false" 3. core.multipackIndex="true" but midx bitmap file is currupt 4. core.multipackIndex="true" and no midx bitmap exists but normal bitmap file is currupt .... These are some of the scenarios I briefly tested, but maybe there are others (some scenarios is produced manually like "currupt bitmap file", but it's not represent it's an existed bug.). Therefore, we added some TRACE2 code so that when we read the bitmap we can be more clear about the decision path, such as whether it is working on midx bitmap or normal bitmap, or is it simply because the related configuration is disabled. This may help with logging, user troubleshooting, and development debugging. Here are some output examples when executing "$GIT_TRACE2_PERF=1 git rev-list --test-bitmap HEAD" under different situations: 1. _HAVE_ MIDX bitmap and NORMAL bitmap file, but the "core.multipackIndex" configures as "false": 19:38:43.007840 common-main.c:49 | d0 | main | version | | | | | 2.35.1.582.g8e9092487a 19:38:43.007874 common-main.c:50 | d0 | main | start | | 0.000305 | | | /opt/git/master/bin/git rev-list --test-bitmap HEAD 19:38:43.007950 compat/linux/procinfo.c:170 | d0 | main | cmd_ancestry | | | | | ancestry:[bash sshd sshd sshd systemd] 19:38:43.008091 git.c:460 | d0 | main | cmd_name | | | | | rev-list (rev-list) 19:38:43.008284 repo-settings.c:11 | d0 | main | data | r0 | 0.000720 | 0.000720 | config | feature.manyfiles:false 19:38:43.008297 repo-settings.c:11 | d0 | main | data | r0 | 0.000734 | 0.000734 | config | feature.experimental:false 19:38:43.008305 repo-settings.c:11 | d0 | main | data | r0 | 0.000742 | 0.000742 | config | core.commitgraph:true 19:38:43.008313 repo-settings.c:11 | d0 | main | data | r0 | 0.000749 | 0.000749 | config | commitgraph.readchangedpaths:true 19:38:43.008320 repo-settings.c:11 | d0 | main | data | r0 | 0.000756 | 0.000756 | config | gc.writecommitgraph:true 19:38:43.008327 repo-settings.c:11 | d0 | main | data | r0 | 0.000764 | 0.000764 | config | fetch.writecommitgraph:false 19:38:43.008334 repo-settings.c:11 | d0 | main | data | r0 | 0.000770 | 0.000770 | config | pack.usesparse:true 19:38:43.008341 repo-settings.c:11 | d0 | main | data | r0 | 0.000777 | 0.000777 | config | core.multipackindex:false 19:38:43.008348 repo-settings.c:11 | d0 | main | data | r0 | 0.000784 | 0.000784 | config | index.sparse:false 19:38:43.008724 pack-bitmap.c:536 | d0 | main | region_enter | r0 | 0.001160 | | pack-bitmap | label:open_bitmap 19:38:43.008738 pack-bitmap.c:390 | d0 | main | data | r0 | 0.001173 | 0.000013 | bitmap | ..try to open bitmap:/home/tenglong.tl/test/dyrone/.git/objects/pack/pack-2d1b3f749fb859b874710e33263d0847ef009e03.bitmap 19:38:43.008754 pack-bitmap.c:543 | d0 | main | region_leave | r0 | 0.001191 | 0.000031 | pack-bitmap | label:open_bitmap Bitmap v1 test (8 entries loaded) Found bitmap for 0a7df7ae92f8d8ed879c240f8ae9cdd33d18085e. 64 bits / 1801edc6 checksum 19:38:43.009099 progress.c:268 | d0 | main | region_enter | r0 | 0.001535 | | progress | label:Verifying bitmap entries Verifying bitmap entries: 100% (27/27), done. 19:38:43.009294 progress.c:339 | d0 | main | data | r0 | 0.001730 | 0.000195 | progress | ..total_objects:27 19:38:43.009302 progress.c:346 | d0 | main | region_leave | r0 | 0.001739 | 0.000204 | progress | label:Verifying bitmap entries OK! 19:38:43.009321 git.c:718 | d0 | main | exit | | 0.001757 | | | code:0 19:38:43.009329 trace2/tr2_tgt_perf.c:215 | d0 | main | atexit | | 0.001766 | | | code:0 2. _HAVE_ MIDX bitmap and NORMAL bitmap file, but the "core.multipackIndex" configures as "true": (omit duplicate outputs) ... 20:02:31.288797 repo-settings.c:11 | d0 | main | data | r0 | 0.000811 | 0.000811 | config | core.multipackindex:true 20:02:31.288806 repo-settings.c:11 | d0 | main | data | r0 | 0.000819 | 0.000819 | config | index.sparse:false 20:02:31.288836 midx.c:185 | d0 | main | data | r0 | 0.000849 | 0.000849 | midx | load/num_packs:1 20:02:31.288843 midx.c:186 | d0 | main | data | r0 | 0.000857 | 0.000857 | midx | load/num_objects:27 20:02:31.289217 pack-bitmap.c:536 | d0 | main | region_enter | r0 | 0.001229 | | pack-bitmap | label:open_bitmap 20:02:31.289230 pack-bitmap.c:318 | d0 | main | data | r0 | 0.001242 | 0.000013 | midx | ..try to open bitmap:/home/tenglong.tl/test/dyrone/.git/objects/pack/multi-pack-index-b6b04fbe053bd500d9ca13354466d3249dc275ac.bitmap 20:02:31.289252 pack-revindex.c:315 | d0 | main | data | r0 | 0.001265 | 0.000036 | load_midx_re | ..source:midx 20:02:31.289261 pack-bitmap.c:543 | d0 | main | region_leave | r0 | 0.001274 | 0.000045 | pack-bitmap | label:open_bitmap Bitmap v1 test (8 entries loaded) Found bitmap for 0a7df7ae92f8d8ed879c240f8ae9cdd33d18085e. 64 bits / 1801edc6 checksum 20:02:31.289594 progress.c:268 | d0 | main | region_enter | r0 | 0.001607 | | progress | label:Verifying bitmap entries Verifying bitmap entries: 100% (27/27), done. 20:02:31.289810 progress.c:339 | d0 | main | data | r0 | 0.001823 | 0.000216 | progress | ..total_objects:27 20:02:31.289824 progress.c:346 | d0 | main | region_leave | r0 | 0.001837 | 0.000230 | progress | label:Verifying bitmap entries OK! 20:02:31.289843 git.c:718 | d0 | main | exit | | 0.001856 | | | code:0 20:02:31.289860 trace2/tr2_tgt_perf.c:215 | d0 | main | atexit | | 0.001873 | | | code:0 3. _HAVE_ MIDX bitmap and a corrupt NORMAL bitmap file, but the "core.multipackIndex" configures as "false" : (omit duplicate outputs) ... 20:14:06.539305 repo-settings.c:11 | d0 | main | data | r0 | 0.000794 | 0.000794 | config | core.multipackindex:false 20:14:06.539310 repo-settings.c:11 | d0 | main | data | r0 | 0.000799 | 0.000799 | config | index.sparse:false 20:14:06.539658 pack-bitmap.c:536 | d0 | main | region_enter | r0 | 0.001146 | | pack-bitmap | label:open_bitmap 20:14:06.539671 pack-bitmap.c:390 | d0 | main | data | r0 | 0.001160 | 0.000014 | bitmap | ..try to open bitmap:/home/tenglong.tl/test/dyrone/.git/objects/pack/pack-2d1b3f749fb859b874710e33263d0847ef009e03.bitmap 20:14:06.539686 usage.c:79 | d0 | main | error | | | | | ..Corrupted bitmap index file (wrong header) error: Corrupted bitmap index file (wrong header) 20:14:06.539696 pack-bitmap.c:426 | d0 | main | data | r0 | 0.001185 | 0.000039 | bitmap | ..load bitmap header:failed 20:14:06.539709 usage.c:79 | d0 | main | error | | | | | ..bitmap header is invalid error: bitmap header is invalid 20:14:06.539719 pack-bitmap.c:543 | d0 | main | region_leave | r0 | 0.001208 | 0.000062 | pack-bitmap | label:open_bitmap 20:14:06.539726 usage.c:60 | d0 | main | error | | | | | failed to load bitmap indexes fatal: failed to load bitmap indexes 20:14:06.539735 usage.c:74 | d0 | main | exit | | 0.001224 | | | code:128 20:14:06.539744 trace2/tr2_tgt_perf.c:215 | d0 | main | atexit | | 0.001233 | | | code:128 Signed-off-by: Teng Long --- pack-bitmap.c | 40 +++++++++++++++++++++++++++++++++------- repo-settings.c | 1 + t/t5310-pack-bitmaps.sh | 4 ++-- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index 1b268f655e..a1d06c4252 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -312,9 +312,12 @@ char *pack_bitmap_filename(struct packed_git *p) static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, struct multi_pack_index *midx) { + int fd; struct stat st; char *bitmap_name = midx_bitmap_filename(midx); - int fd = git_open(bitmap_name); + trace2_data_string("midx", the_repository, "try to open bitmap", + bitmap_name); + fd = git_open(bitmap_name); free(bitmap_name); @@ -322,6 +325,8 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, return -1; if (fstat(fd, &st)) { + trace2_data_string("midx", the_repository, "stat bitmap file", + "failed"); close(fd); return -1; } @@ -344,12 +349,19 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, MAP_PRIVATE, fd, 0); close(fd); - if (load_bitmap_header(bitmap_git) < 0) + if (load_bitmap_header(bitmap_git) < 0) { + trace2_data_string("midx", the_repository, "load bitmap header", + "failed"); goto cleanup; + } - if (!hasheq(get_midx_checksum(bitmap_git->midx), bitmap_git->checksum)) + if (!hasheq(get_midx_checksum(bitmap_git->midx), bitmap_git->checksum)) { + trace2_data_string("midx", the_repository, "verify checksum", + "mismatch"); goto cleanup; + } + if (load_midx_revindex(bitmap_git->midx) < 0) { warning(_("multi-pack bitmap is missing required reverse index")); goto cleanup; @@ -375,6 +387,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git return -1; bitmap_name = pack_bitmap_filename(packfile); + trace2_data_string("bitmap", the_repository, "try to open bitmap", + bitmap_name); fd = git_open(bitmap_name); free(bitmap_name); @@ -382,6 +396,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git return -1; if (fstat(fd, &st)) { + trace2_data_string("bitmap", the_repository, "stat bitmap file", + "failed"); close(fd); return -1; } @@ -395,6 +411,7 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git } if (!is_pack_valid(packfile)) { + trace2_data_string("bitmap", the_repository, "packfile", "invalid"); close(fd); return -1; } @@ -406,6 +423,8 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git close(fd); if (load_bitmap_header(bitmap_git) < 0) { + trace2_data_string("bitmap", the_repository, + "load bitmap header", "failed"); munmap(bitmap_git->map, bitmap_git->map_size); bitmap_git->map = NULL; bitmap_git->map_size = 0; @@ -511,11 +530,18 @@ static int open_midx_bitmap(struct repository *r, static int open_bitmap(struct repository *r, struct bitmap_index *bitmap_git) { - assert(!bitmap_git->map); + int ret = -1; - if (!open_midx_bitmap(r, bitmap_git)) - return 0; - return open_pack_bitmap(r, bitmap_git); + assert(!bitmap_git->map); + trace2_region_enter("pack-bitmap", "open_bitmap", r); + if (!open_midx_bitmap(r, bitmap_git)) { + ret = 0; + goto done; + } + ret = open_pack_bitmap(r, bitmap_git); +done: + trace2_region_leave("pack-bitmap", "open_bitmap", r); + return ret; } struct bitmap_index *prepare_bitmap_git(struct repository *r) diff --git a/repo-settings.c b/repo-settings.c index b4fbd16cdc..5bc7a97a6d 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -8,6 +8,7 @@ static void repo_cfg_bool(struct repository *r, const char *key, int *dest, { if (repo_config_get_bool(r, key, dest)) *dest = def; + trace2_data_string("config", r, key, *dest ? "true" : "false"); } void prepare_repo_settings(struct repository *r) diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh index eb63b71852..664cb88b0b 100755 --- a/t/t5310-pack-bitmaps.sh +++ b/t/t5310-pack-bitmaps.sh @@ -421,8 +421,8 @@ test_expect_success 'complains about multiple pack bitmaps' ' test_line_count = 2 bitmaps && git rev-list --use-bitmap-index HEAD 2>err && - grep "a bitmap has been opened" err && - grep "ignoring extra bitmap file" err + grep "warning: a normal or midx bitmap already has been opened" err && + grep "warning: ignoring extra bitmap file" err ) ' From patchwork Thu Apr 21 13:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teng Long X-Patchwork-Id: 12821638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76329C433F5 for ; Thu, 21 Apr 2022 13:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376881AbiDUNaD (ORCPT ); Thu, 21 Apr 2022 09:30:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385095AbiDUN34 (ORCPT ); Thu, 21 Apr 2022 09:29:56 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2997C381A4 for ; Thu, 21 Apr 2022 06:27:02 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id k14so4681075pga.0 for ; Thu, 21 Apr 2022 06:27:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0gQ04he4FIs29CR1kBBdEOTLfTc84+wd3OhbAYRruPk=; b=cZS3hguNYZzi6wVsjUE42lNwGj2AZ9VKphQu1Q6/8DScJEhDZxrcbQxCn2AgLHZF28 kcJ14QHRIe7HRpCzPpFTQCoLmsqrF6kyMiPp+lug1TGtv/BSHlc1+Byfo5a89CzJFllI Me665nsQdct3CNmwwN8MTo2LGuw59JgKPHPB0v4ys3/I1Bifq8kKWKnrWUJvNdxm8uSs 4tVSQvDuKD8nMTHn9u6a9SzOUU8G2ihLOWcJbGBGp6DJwGfseaHuYCirOTZSn1Y1Znq7 AFhDwUwj900Jx5kNhbf/IpDFB9luIXXEnOJ+ieh63/dkwZyb44SSXT87YkDNvLUgbEFM 7QZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0gQ04he4FIs29CR1kBBdEOTLfTc84+wd3OhbAYRruPk=; b=5yENnpKqNqgtG+44KY+VYaYfAUkaLEa/g7LPzNOpmrAT5OUrukQ7Xs55BPzNGd2tAU 2dHdvro3ZKKFdZoS8xZjo6SV+G+wRyMTiqkLBL/IDIe76I7Ccyz0m6kyoFTQSQnJWrMZ rPSVG7aBUXi6V4OJytAlI7NI7nvxeM9Cf0h+btAfq2dNBt02aoxx7KyCo+jvg2Zs346M P+DygDFAGJhIBEcjRWOGBVsEW5GSh7L9PbJouEEp5RtzKIthOoDWmOt0JgNC/G0Nt6TG jSmLJ3C0bSuc9qwQQdDGPMjrf4fVPuu59QdMkZjSHYnf2VuObv3UR2XvkyZI47Dg5kuc MvjQ== X-Gm-Message-State: AOAM531HVV/TpBQgBEi5pmfP3uBrPHJgso9W3DwTcpgZMXYXNS8y8QBv W9rFMxhVgk9+9NvPS9OMZ5E= X-Google-Smtp-Source: ABdhPJxn2I1q+64DUvuf/Cdss6YPJv6z/3/RJCVJS2TsWc25/ln/c5MiRw//ibf4vyOE6DaxHJ7Ycg== X-Received: by 2002:a63:b20a:0:b0:398:9e3e:d581 with SMTP id x10-20020a63b20a000000b003989e3ed581mr24705298pge.236.1650547621646; Thu, 21 Apr 2022 06:27:01 -0700 (PDT) Received: from code-infra-dev-cbj.ea134 ([140.205.70.42]) by smtp.gmail.com with ESMTPSA id bd42-20020a056a0027aa00b0050a6e0ccc54sm15463647pfb.186.2022.04.21.06.26.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Apr 2022 06:27:01 -0700 (PDT) From: Teng Long To: dyroneteng@gmail.com Cc: avarab@gmail.com, derrickstolee@github.com, git@vger.kernel.org, me@ttaylorr.com, tenglong.tl@alibaba-inc.com, gitster@pobox.com Subject: [PATCH v2 5/5] pack-bitmap.c: using error() instead of silently returning -1 Date: Thu, 21 Apr 2022 21:26:40 +0800 Message-Id: <1a169d7b5ea4b6aec030a48f718dc2c4e922a9f4.1650547400.git.dyroneteng@gmail.com> X-Mailer: git-send-email 2.35.1.583.g30faa5f068 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In "open_pack_bitmap_1()" and "open_midx_bitmap_1()", it's better to return error() instead of "-1" when some unexpected error occurs like "stat bitmap file failed", "bitmap header is invalid" or "checksum mismatch", etc. There are places where we do not replace, such as when the bitmap does not exist (no bitmap in repository is allowed) or when another bitmap has already been opened (in which case it should be a warning rather than an error). Signed-off-by: Teng Long --- pack-bitmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index a1d06c4252..e0dcd06db3 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -328,7 +328,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, trace2_data_string("midx", the_repository, "stat bitmap file", "failed"); close(fd); - return -1; + return error("cannot stat bitmap file"); } if (bitmap_git->pack || bitmap_git->midx) { @@ -374,7 +374,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git, bitmap_git->map_pos = 0; bitmap_git->map = NULL; bitmap_git->midx = NULL; - return -1; + return error("cannot open midx bitmap file"); } static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git *packfile) @@ -399,7 +399,7 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git trace2_data_string("bitmap", the_repository, "stat bitmap file", "failed"); close(fd); - return -1; + return error("cannot stat bitmap file"); } if (bitmap_git->pack || bitmap_git->midx) { @@ -413,7 +413,7 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git if (!is_pack_valid(packfile)) { trace2_data_string("bitmap", the_repository, "packfile", "invalid"); close(fd); - return -1; + return error("packfile is invalid"); } bitmap_git->pack = packfile; @@ -430,7 +430,7 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git bitmap_git->map_size = 0; bitmap_git->map_pos = 0; bitmap_git->pack = NULL; - return -1; + return error("bitmap header is invalid"); } return 0;