From patchwork Tue Jun 30 17:17:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 11634425 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 1AD7E92A for ; Tue, 30 Jun 2020 17:17:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0213220775 for ; Tue, 30 Jun 2020 17:17:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20150623.gappssmtp.com header.i=@ttaylorr-com.20150623.gappssmtp.com header.b="uUas8twD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733069AbgF3RRp (ORCPT ); Tue, 30 Jun 2020 13:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730374AbgF3RRo (ORCPT ); Tue, 30 Jun 2020 13:17:44 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ADCEC061755 for ; Tue, 30 Jun 2020 10:17:44 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id e12so16140915qtr.9 for ; Tue, 30 Jun 2020 10:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=c8I5s7nJAiONyWymM8ic/J47duN1kstf68mirVTbQMo=; b=uUas8twD5n5s/ujsucuzXfOV/3PeYnNtAc8vIGTGZFJwgCCCt1bECgSyis7J1t+Y4q gQKlZ5XqfBvP95YZQDdGdYyKvhgm9sBp3lxkSpQ+0DIe6bL3/qBCbz+1OA/3xBimxLRO o64EJu7oH0NKVfwUhUDi8boR7ImX93UhBMXqIGEbx9K3JanJsk6GNRXys9025ZPS4Kt8 katXyY95pQQbwbV8W7m2I3/MiQj93zxaoqPUiH+MK/rzlqDpEvkj8+AvOazBA6TQ39eL 1rNLHTeLaxitG6vRbWrTg7cluF1QreK9Ul4a7pumgqZX0t9FK/a81in3+N4hPa1QBRik dmvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=c8I5s7nJAiONyWymM8ic/J47duN1kstf68mirVTbQMo=; b=VtZe+AvzG/bRp+TajEgsvkcMfnVv9NcLXD/KBgyqx15BDCpCd9/m2v6ydhKMNWo67V wl7VjgegB6xlfox87GJC+oRCblaNz/rQuIQl9yAfdJ5iuCaBVMfKBchVidKQXmML3Cnj Vzqx51A+aYMdtJvGapb6ABUewtwfx6kvW/iU/9PMfAflJEdxidnsFto+gt58UFvlqdiq uN5ckhqc8xxMaY0w2scjj0r7DZhboYM+fZ7aen+SWu5A8U3J0mzGnYe/UyMDAJKVS79o QYlc3ZPk16t0XJ72ptLOYWRM/03qc/COSzplIgWHcZxV2UtB6MTxQzl+4PWdrvUH8oaP VfeQ== X-Gm-Message-State: AOAM533d+yUGq2J9X3Wlew5AxddHH1mx2uqyQ1QN2hVW93WCD0jxDAUi auNvtXBBf0etbiE5GZn71SFvKk+RaNbHGw== X-Google-Smtp-Source: ABdhPJxUYCHL5mqgXtNWyQQUyzQCzXyaZ6QZw3yUF/6RvQGIR7GXtE/6z5blFAeBPab4Q4DCoABH/Q== X-Received: by 2002:ac8:3778:: with SMTP id p53mr22548872qtb.228.1593537462788; Tue, 30 Jun 2020 10:17:42 -0700 (PDT) Received: from localhost ([2605:9480:22e:ff10:f0ef:6367:5d8f:d7c]) by smtp.gmail.com with ESMTPSA id x13sm3224240qts.57.2020.06.30.10.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 10:17:42 -0700 (PDT) Date: Tue, 30 Jun 2020 13:17:41 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: peff@peff.net, dstolee@microsoft.com Subject: [PATCH 1/3] commit-graph: pass a 'struct repository *' in more places Message-ID: <4ea9933b50fe0bc2738ab0e0dc52a4f17c4a2cb4.1593536481.git.me@ttaylorr.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a future commit, some commit-graph internals will want access to 'r->settings', but we only have the 'struct object_directory *' corresponding to that repository. Add an additional parameter to pass the repository around in more places. In the next patch, we will remove the object directory (and instead reference it with 'r->odb'). Signed-off-by: Taylor Blau --- builtin/commit-graph.c | 2 +- commit-graph.c | 13 ++++++++----- commit-graph.h | 4 +++- fuzz-commit-graph.c | 5 +++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 75455da138..7c0f98531d 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -106,7 +106,7 @@ static int graph_verify(int argc, const char **argv) FREE_AND_NULL(graph_name); if (open_ok) - graph = load_commit_graph_one_fd_st(fd, &st, odb); + graph = load_commit_graph_one_fd_st(fd, &st, the_repository, odb); else graph = read_commit_graph_one(the_repository, odb); diff --git a/commit-graph.c b/commit-graph.c index 2ff042fbf4..fdfb0888f0 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -170,6 +170,7 @@ int open_commit_graph(const char *graph_file, int *fd, struct stat *st) } struct commit_graph *load_commit_graph_one_fd_st(int fd, struct stat *st, + struct repository *r, struct object_directory *odb) { void *graph_map; @@ -185,7 +186,7 @@ struct commit_graph *load_commit_graph_one_fd_st(int fd, struct stat *st, } graph_map = xmmap(NULL, graph_size, PROT_READ, MAP_PRIVATE, fd, 0); close(fd); - ret = parse_commit_graph(graph_map, graph_size); + ret = parse_commit_graph(r, graph_map, graph_size); if (ret) ret->odb = odb; @@ -225,7 +226,8 @@ static int verify_commit_graph_lite(struct commit_graph *g) return 0; } -struct commit_graph *parse_commit_graph(void *graph_map, size_t graph_size) +struct commit_graph *parse_commit_graph(struct repository *r, + void *graph_map, size_t graph_size) { const unsigned char *data, *chunk_lookup; uint32_t i; @@ -396,6 +398,7 @@ struct commit_graph *parse_commit_graph(void *graph_map, size_t graph_size) } static struct commit_graph *load_commit_graph_one(const char *graph_file, + struct repository *r, struct object_directory *odb) { @@ -407,7 +410,7 @@ static struct commit_graph *load_commit_graph_one(const char *graph_file, if (!open_ok) return NULL; - g = load_commit_graph_one_fd_st(fd, &st, odb); + g = load_commit_graph_one_fd_st(fd, &st, r, odb); if (g) g->filename = xstrdup(graph_file); @@ -419,7 +422,7 @@ static struct commit_graph *load_commit_graph_v1(struct repository *r, struct object_directory *odb) { char *graph_name = get_commit_graph_filename(odb); - struct commit_graph *g = load_commit_graph_one(graph_name, odb); + struct commit_graph *g = load_commit_graph_one(graph_name, r, odb); free(graph_name); return g; @@ -500,7 +503,7 @@ static struct commit_graph *load_commit_graph_chain(struct repository *r, valid = 0; for (odb = r->objects->odb; odb; odb = odb->next) { char *graph_name = get_split_graph_filename(odb, line.buf); - struct commit_graph *g = load_commit_graph_one(graph_name, odb); + struct commit_graph *g = load_commit_graph_one(graph_name, r, odb); free(graph_name); diff --git a/commit-graph.h b/commit-graph.h index 3ba0da1e5f..03d848e168 100644 --- a/commit-graph.h +++ b/commit-graph.h @@ -76,10 +76,12 @@ struct commit_graph { }; struct commit_graph *load_commit_graph_one_fd_st(int fd, struct stat *st, + struct repository *r, struct object_directory *odb); struct commit_graph *read_commit_graph_one(struct repository *r, struct object_directory *odb); -struct commit_graph *parse_commit_graph(void *graph_map, size_t graph_size); +struct commit_graph *parse_commit_graph(struct repository *r, + void *graph_map, size_t graph_size); /* * Return 1 if and only if the repository has a commit-graph diff --git a/fuzz-commit-graph.c b/fuzz-commit-graph.c index 430817214d..e7cf6d5b0f 100644 --- a/fuzz-commit-graph.c +++ b/fuzz-commit-graph.c @@ -1,7 +1,8 @@ #include "commit-graph.h" #include "repository.h" -struct commit_graph *parse_commit_graph(void *graph_map, size_t graph_size); +struct commit_graph *parse_commit_graph(struct repository *r, + void *graph_map, size_t graph_size); int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); @@ -10,7 +11,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) struct commit_graph *g; initialize_the_repository(); - g = parse_commit_graph((void *)data, size); + g = parse_commit_graph(the_repository, (void *)data, size); repo_clear(the_repository); free_commit_graph(g); From patchwork Tue Jun 30 17:17:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 11634427 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 766C3912 for ; Tue, 30 Jun 2020 17:17:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E15720774 for ; Tue, 30 Jun 2020 17:17:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20150623.gappssmtp.com header.i=@ttaylorr-com.20150623.gappssmtp.com header.b="DSOpFkkg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390203AbgF3RRs (ORCPT ); Tue, 30 Jun 2020 13:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730374AbgF3RRs (ORCPT ); Tue, 30 Jun 2020 13:17:48 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEAFDC061755 for ; Tue, 30 Jun 2020 10:17:47 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id h23so16225679qtr.0 for ; Tue, 30 Jun 2020 10:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cstlyRmFAZ4ElAum6E647R/XATai5HJrwLf5gyGDnrQ=; b=DSOpFkkgGMHBauHmgWieEHgBHoefKclRhOhQvTWcuSaG+vXibX95vyGw5ezVnuVmat rDQFPFr3uDIHDt764ICwDH8A31/EYr/A+H+/8n01MXwZFK1mVsevv4tcLGGrKxoQG0iq PskiX9Z3Hb+ZrzVA+0HgxNb4N7fdPgKqUhjY/e5DquYnLf+0YkcKsq1cclkgHXYGsX2I DHSy3GTwQpVAc1Kalwg/q5/1KADC16QLAUCQ5IQzDKu3XI0MZxl+4QrQuzCb7nB4PFnf aKzOmgruU8AtNbcR4jKLvSKGniuJ0K70qOAe0YjlN/5o7Dv+IGUg+l+G9Bwf/ln3o3Og hDzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cstlyRmFAZ4ElAum6E647R/XATai5HJrwLf5gyGDnrQ=; b=mFbtZt8qbkmce6hRCTWX/Zv6bExOal32Ybz6tRyjbO779ihNv0am1Vlff7JI2nEMX+ hZNRcj5YGnJ8OfMLr8Jch1feAKOn/yNZnwe8EH0R4knlIwPpDuscB6gTWZ+QESPDWS3E +Cy0xefQjVX1UDFu2wyaGL/NrZxVEAGSGaqmYhcKed6Nu4Bu5CoaoBbtwvhS56043Nnn unGWZDDChJtUweSOI3/8MbEKVBwXBiY0RJtlUoZUA5HD/ZDGEM3PcxZpjdJP2uw1sgkK jLv43i9C5srzzfyQvDJy0eJ0bE2Dchzwhe5PZ6xiWbc1lBZZQIzdzXUB4GP9FQgsOEF8 fmQA== X-Gm-Message-State: AOAM530rw0lTMW25R0DTJnKhu4Jj3T2V+VXSEsuHUhbyOCSea6QKrzUE 0yH4TKv66xYQugRDIneU8nlW7pojrtIXPA== X-Google-Smtp-Source: ABdhPJypSdqIaz0VRAR6XnkfpXLTa9BqH01hEoQDFpdC1Gdjj6gWENV1TmDv5fpbyuXMBQJasLA+vA== X-Received: by 2002:aed:3124:: with SMTP id 33mr12986444qtg.215.1593537466703; Tue, 30 Jun 2020 10:17:46 -0700 (PDT) Received: from localhost ([2605:9480:22e:ff10:f0ef:6367:5d8f:d7c]) by smtp.gmail.com with ESMTPSA id 79sm3591161qkd.134.2020.06.30.10.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 10:17:46 -0700 (PDT) Date: Tue, 30 Jun 2020 13:17:44 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: peff@peff.net, dstolee@microsoft.com Subject: [PATCH 2/3] t4216: fix broken '&&'-chain Message-ID: <5a20a97658fa8e6c874c9c9cafb2cf49e39f94d6.1593536481.git.me@ttaylorr.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a759bfa9ee (t4216: add end to end tests for git log with Bloom filters, 2020-04-06), a 'rm' invocation was added without a corresponding '&&' chain. This ends up working fine when the file already exists, in which case 'rm' exits cleanly and the rest of the function executes normally. When the file does _not_ exist, however, 'rm' returns an unclean exit code, causing the function to terminate. Fix this by making the test use an '&&'-chain, and passing '-f' to ignore missing files (as can be the case when specifying which tests are '--run'). Signed-off-by: Taylor Blau Signed-off-by: Taylor Blau --- t/t4216-log-bloom.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh index c855bcd3e7..0b4cc4f8d1 100755 --- a/t/t4216-log-bloom.sh +++ b/t/t4216-log-bloom.sh @@ -53,7 +53,7 @@ sane_unset GIT_TRACE2_PERF_BRIEF sane_unset GIT_TRACE2_CONFIG_PARAMS setup () { - rm "$TRASH_DIRECTORY/trace.perf" + rm -f "$TRASH_DIRECTORY/trace.perf" && git -c core.commitGraph=false log --pretty="format:%s" $1 >log_wo_bloom && GIT_TRACE2_PERF="$TRASH_DIRECTORY/trace.perf" git -c core.commitGraph=true log --pretty="format:%s" $1 >log_w_bloom } From patchwork Tue Jun 30 17:17:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Blau X-Patchwork-Id: 11634429 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 89F9C912 for ; Tue, 30 Jun 2020 17:17:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7110B2078D for ; Tue, 30 Jun 2020 17:17:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ttaylorr-com.20150623.gappssmtp.com header.i=@ttaylorr-com.20150623.gappssmtp.com header.b="HLj7DFUr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390208AbgF3RRw (ORCPT ); Tue, 30 Jun 2020 13:17:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390204AbgF3RRv (ORCPT ); Tue, 30 Jun 2020 13:17:51 -0400 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 861F1C061755 for ; Tue, 30 Jun 2020 10:17:51 -0700 (PDT) Received: by mail-qv1-xf41.google.com with SMTP id h18so9617424qvl.3 for ; Tue, 30 Jun 2020 10:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ttaylorr-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0t/EeVB4aky+95a1hU9GZkQiEy8sQ3XXgJGtfmGVyFA=; b=HLj7DFUrKlcnxmXg2ZmYz/tLmJh1v3LS/Iadr1QK+TMbqUE3RvB79WOaYXq8forwKC QWpfYllw/zqTS1/AMFg/e1BfD7LT3Wi9cmPdCuncn/d+WZtubQicGAzjC1aWxZKbYO05 iBtHWFZ1yCD7dp/Fdhz8TaqG5l+Kk2KMdnU2rACos2A32uKv5E1kq60KQNLf8NBmoViQ Z4V6BP+NhAlqVljlUUszIYZhkZbbgLSziaZCeZRr35Q5s65N3iwr6GWSaDih57cECL9C 0SoM7pe5MTaur3h09QIaBr2o9cBGOKXxCHipvTYflmtgmigKr5geJXsGdc8SybCyKo1Z nsQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0t/EeVB4aky+95a1hU9GZkQiEy8sQ3XXgJGtfmGVyFA=; b=CV8Ljhn1Iyk/CuOq0/+5aZSUMO7n2qtCUWnqGJoGJaLMuebWgVa01aCe2WrJFxuYuP KgrOoEJ+JOjD8D7+Zs3TLlo330Rh/0+i9TiM6PgjquTCpKPcBPmK9xRDr2LbCVNzyoIf bSxcPDZPfPagKsLs99Ypanm1smE0ZfeLkTvt50A79t4MiQ+xdRXmUnWATlLJqjvPYgdn EZN/RjW0C9Yz3EYPJpYC27XuViHOIL+j3YpFDuciiWwnKQo4Xog5NzxVHmbn9fksAVoA kC1eW8Fb76XkVnR8M3jsTSWmDs1sL+lwzi6t8Z8X0exQGCgmQ1l3QPtM9Eax97MOQnlG /+UQ== X-Gm-Message-State: AOAM533pyCyQlg2+zg1Jr4UN7eyHMpiaOVhf/nTL13eozxm8G98H0qAx nzBsB1jdPga5MQs/4db+AyW066seZyajjg== X-Google-Smtp-Source: ABdhPJy94GPf3WLaoExybFTdNMM6WmxDn41zXeHKAXJH2mKImVrukhJ8FFVobNN0yIYFLs6yXyEacQ== X-Received: by 2002:a0c:e008:: with SMTP id j8mr17706554qvk.87.1593537470188; Tue, 30 Jun 2020 10:17:50 -0700 (PDT) Received: from localhost ([2605:9480:22e:ff10:f0ef:6367:5d8f:d7c]) by smtp.gmail.com with ESMTPSA id e2sm3349175qkm.115.2020.06.30.10.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 10:17:49 -0700 (PDT) Date: Tue, 30 Jun 2020 13:17:48 -0400 From: Taylor Blau To: git@vger.kernel.org Cc: peff@peff.net, dstolee@microsoft.com Subject: [PATCH 3/3] commit-graph: respect 'core.useBloomFilters' Message-ID: <4cfa086e503e19763a9d581fcb6a2ef818776dfc.1593536481.git.me@ttaylorr.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Git uses the 'core.commitGraph' configuration value to control whether or not the commit graph is used when parsing commits or performing a traversal. Now that commit-graphs can also contain a section for changed-path Bloom filters, administrators that already have commit-graphs may find it convenient to use those graphs without relying on their changed-path Bloom filters. This can happen, for example, during a staged roll-out, or in the event of an incident. Introduce 'core.useBloomFilters' to control whether or not Bloom filters are read. Note that this configuration is independent from both: - 'core.commitGraph', to allow flexibility in using all parts of a commit-graph _except_ for its Bloom filters. - The '--changed-paths' option for 'git commit-graph write', to allow reading and writing Bloom filters to be controlled independently. When the variable is set, pretend as if no Bloom data was specified at all. This avoids adding additional special-casing outside of the commit-graph internals. Suggested-by: Derrick Stolee Signed-off-by: Taylor Blau --- Documentation/config/core.txt | 5 +++++ commit-graph.c | 4 ++-- repo-settings.c | 3 +++ repository.h | 1 + t/helper/test-read-graph.c | 3 ++- t/t4216-log-bloom.sh | 4 +++- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index 74619a9c03..b146bf8d34 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -599,6 +599,11 @@ core.commitGraph:: to parse the graph structure of commits. Defaults to true. See linkgit:git-commit-graph[1] for more information. +core.useBloomFilters:: + If true, then git will use the changed-path Bloom filters in the + commit-graph file (if it exists, and they are present). Defaults to + true. See linkgit:git-commit-graph[1] for more information. + core.useReplaceRefs:: If set to `false`, behave as if the `--no-replace-objects` option was given on the command line. See linkgit:git[1] and diff --git a/commit-graph.c b/commit-graph.c index fdfb0888f0..03c00415c4 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -337,14 +337,14 @@ struct commit_graph *parse_commit_graph(struct repository *r, case GRAPH_CHUNKID_BLOOMINDEXES: if (graph->chunk_bloom_indexes) chunk_repeated = 1; - else + else if (r->settings.core_use_bloom_filters) graph->chunk_bloom_indexes = data + chunk_offset; break; case GRAPH_CHUNKID_BLOOMDATA: if (graph->chunk_bloom_data) chunk_repeated = 1; - else { + else if (r->settings.core_use_bloom_filters) { uint32_t hash_version; graph->chunk_bloom_data = data + chunk_offset; hash_version = get_be32(data + chunk_offset); diff --git a/repo-settings.c b/repo-settings.c index dc6817daa9..d8e3b1c61e 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -17,9 +17,12 @@ void prepare_repo_settings(struct repository *r) if (!repo_config_get_bool(r, "core.commitgraph", &value)) r->settings.core_commit_graph = value; + if (!repo_config_get_bool(r, "core.usebloomfilters", &value)) + r->settings.core_use_bloom_filters = value; if (!repo_config_get_bool(r, "gc.writecommitgraph", &value)) r->settings.gc_write_commit_graph = value; UPDATE_DEFAULT_BOOL(r->settings.core_commit_graph, 1); + UPDATE_DEFAULT_BOOL(r->settings.core_use_bloom_filters, 1); UPDATE_DEFAULT_BOOL(r->settings.gc_write_commit_graph, 1); if (!repo_config_get_int(r, "index.version", &value)) diff --git a/repository.h b/repository.h index 3c1f7d54bd..cc61533122 100644 --- a/repository.h +++ b/repository.h @@ -29,6 +29,7 @@ struct repo_settings { int initialized; int core_commit_graph; + int core_use_bloom_filters; int gc_write_commit_graph; int fetch_write_commit_graph; diff --git a/t/helper/test-read-graph.c b/t/helper/test-read-graph.c index 6d0c962438..5f585a1725 100644 --- a/t/helper/test-read-graph.c +++ b/t/helper/test-read-graph.c @@ -12,11 +12,12 @@ int cmd__read_graph(int argc, const char **argv) setup_git_directory(); odb = the_repository->objects->odb; + prepare_repo_settings(the_repository); + graph = read_commit_graph_one(the_repository, odb); if (!graph) return 1; - printf("header: %08x %d %d %d %d\n", ntohl(*(uint32_t*)graph->data), *(unsigned char*)(graph->data + 4), diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh index 0b4cc4f8d1..b1a247477e 100755 --- a/t/t4216-log-bloom.sh +++ b/t/t4216-log-bloom.sh @@ -90,7 +90,9 @@ do "--ancestry-path side..master" do test_expect_success "git log option: $option for path: $path" ' - test_bloom_filters_used "$option -- $path" + test_bloom_filters_used "$option -- $path" && + test_config core.useBloomFilters false && + test_bloom_filters_not_used "$option -- $path" ' done done