From patchwork Mon Jul 22 17:54:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11053219 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 0EDF914F6 for ; Mon, 22 Jul 2019 17:54:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2C1F285C3 for ; Mon, 22 Jul 2019 17:54:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E68DD28686; Mon, 22 Jul 2019 17:54:30 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 243DC285C3 for ; Mon, 22 Jul 2019 17:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730638AbfGVRy0 (ORCPT ); Mon, 22 Jul 2019 13:54:26 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:38955 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730578AbfGVRyZ (ORCPT ); Mon, 22 Jul 2019 13:54:25 -0400 Received: by mail-wm1-f68.google.com with SMTP id u25so25820624wmc.4 for ; Mon, 22 Jul 2019 10:54:22 -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=KCLe0F80vzC+QHFWWQhBAqilghkzUT+PHsxap9niw5o=; b=W4gw+ulZ6axxmKyy1uWD8PydWUtpa6Xetr9xX7qDtWB9GVTOH2MZWaeYE/KwSjgDN8 OzoA/j3Bc7E2pX211xHNVDbFtCnpXUkb6B6m29mwywZXQtyyoFuXLOTE/KuCf6sJyZrL Yiec2VkPfuCjCJTz1NvkQf1jUoSmnaHsFxVN3+zz5zacF6bJmyZxcdmeyeqCPiLldRd3 qyCn3tQBcTcq9F5oGAGBCaMsqq82l0u/sDeL8L0XipO64vcQJn1wMIVrqmCoU+aKWYyP pOgwh1yKWemp6c8kbKVO7pdnu0mJ4ydOfT7t3oH/ggA+lhbM+8lPnSHwGYAVJcDdp28g tsKA== 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=KCLe0F80vzC+QHFWWQhBAqilghkzUT+PHsxap9niw5o=; b=tLqBFIatpYOOgoVQvfCuMWmUi04AMuIbJM0LKBoMHlVk8mz3BFbNFvxUEd07AR5Dw4 uE/H1OztEFUFNEQ7EymvdjDO+wrDob7WEK3le68vBp1RKsHrDZna1s964lzMIHQ3yF1G 5u1N2DsrPsFX3OyjMWjtgsLNMKcFv1Utj6Iu2bgSV+WgdSCToi5BM7szLCkC4fSPQ4cM vQv5g13wmVHMDY61ChFQJpH5rhIov7l1mv2eVo/AhPU3pTav/V61amldcaFbAgxnWH1m uTYIztuBxoaW7U5sdGUAKJl5sBx5kUvRbgM28UiqaE+am2eaP4+VaD8XkdLW8NUL5F1F nSZA== X-Gm-Message-State: APjAAAXG7bgIQ8cDN7QSyNpzfjAdX2ff0HvmyKTcXgykhnU+higq8cu2 W70LY6GcN3SAoXFjyqpCFRoPhP19 X-Google-Smtp-Source: APXvYqyfWsAL/kVFetGEbac8Eah+FzclXWUcTdy58W4v0YGJ3fUTUbjktQwb+GxIpfkNChqW0pOlcw== X-Received: by 2002:a1c:f018:: with SMTP id a24mr62929163wmb.66.1563818061976; Mon, 22 Jul 2019 10:54:21 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c9sm34563377wml.41.2019.07.22.10.54.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 10:54:21 -0700 (PDT) Date: Mon, 22 Jul 2019 10:54:21 -0700 (PDT) X-Google-Original-Date: Mon, 22 Jul 2019 17:54:15 GMT Message-Id: <72f652b89c71526cc423e7812de66f41a079f181.1563818059.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 1/5] repo-settings: consolidate some config settings Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes.Schindelin@gmx.de, peff@peff.net, jnareb@gmail.com, pclouds@gmail.com, carenas@gmail.com, avarab@gmail.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 There are a few important config settings that are not loaded during git_default_config. These are instead loaded on-demand. Centralize these config options to a single scan, and store all of the values in a repo_settings struct. The values for each setting are initialized as negative to indicate "unset". This centralization will be particularly important in a later change to introduce "meta" config settings that change the defaults for these config settings. Signed-off-by: Derrick Stolee --- Makefile | 1 + builtin/gc.c | 13 ++++++------- builtin/pack-objects.c | 9 +++++---- commit-graph.c | 7 ++++--- read-cache.c | 12 +++++++----- repo-settings.c | 44 ++++++++++++++++++++++++++++++++++++++++++ repo-settings.h | 15 ++++++++++++++ repository.h | 3 +++ 8 files changed, 85 insertions(+), 19 deletions(-) create mode 100644 repo-settings.c create mode 100644 repo-settings.h diff --git a/Makefile b/Makefile index 11ccea4071..032fe9b5f9 100644 --- a/Makefile +++ b/Makefile @@ -964,6 +964,7 @@ LIB_OBJS += refspec.o LIB_OBJS += ref-filter.o LIB_OBJS += remote.o LIB_OBJS += replace-object.o +LIB_OBJS += repo-settings.o LIB_OBJS += repository.o LIB_OBJS += rerere.o LIB_OBJS += resolve-undo.o diff --git a/builtin/gc.c b/builtin/gc.c index c18efadda5..243be2907b 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -27,6 +27,7 @@ #include "pack-objects.h" #include "blob.h" #include "tree.h" +#include "repo-settings.h" #define FAILED_RUN "failed to run %s" @@ -41,7 +42,6 @@ static int aggressive_depth = 50; static int aggressive_window = 250; static int gc_auto_threshold = 6700; static int gc_auto_pack_limit = 50; -static int gc_write_commit_graph; static int detach_auto = 1; static timestamp_t gc_log_expire_time; static const char *gc_log_expire = "1.day.ago"; @@ -148,7 +148,6 @@ static void gc_config(void) git_config_get_int("gc.aggressivedepth", &aggressive_depth); git_config_get_int("gc.auto", &gc_auto_threshold); git_config_get_int("gc.autopacklimit", &gc_auto_pack_limit); - git_config_get_bool("gc.writecommitgraph", &gc_write_commit_graph); git_config_get_bool("gc.autodetach", &detach_auto); git_config_get_expiry("gc.pruneexpire", &prune_expire); git_config_get_expiry("gc.worktreepruneexpire", &prune_worktrees_expire); @@ -685,11 +684,11 @@ int cmd_gc(int argc, const char **argv, const char *prefix) clean_pack_garbage(); } - if (gc_write_commit_graph && - write_commit_graph_reachable(get_object_directory(), - !quiet && !daemonized ? COMMIT_GRAPH_PROGRESS : 0, - NULL)) - return 1; + prepare_repo_settings(the_repository); + if (the_repository->settings->gc_write_commit_graph == 1) + write_commit_graph_reachable(get_object_directory(), + !quiet && !daemonized ? COMMIT_GRAPH_PROGRESS : 0, + NULL); if (auto_gc && too_many_loose_objects()) warning(_("There are too many unreachable loose objects; " diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 267c562b1f..223038b309 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -34,6 +34,7 @@ #include "dir.h" #include "midx.h" #include "trace2.h" +#include "repo-settings.h" #define IN_PACK(obj) oe_in_pack(&to_pack, obj) #define SIZE(obj) oe_size(&to_pack, obj) @@ -2709,10 +2710,6 @@ static int git_pack_config(const char *k, const char *v, void *cb) use_bitmap_index_default = git_config_bool(k, v); return 0; } - if (!strcmp(k, "pack.usesparse")) { - sparse = git_config_bool(k, v); - return 0; - } if (!strcmp(k, "pack.threads")) { delta_search_threads = git_config_int(k, v); if (delta_search_threads < 0) @@ -3332,6 +3329,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) read_replace_refs = 0; sparse = git_env_bool("GIT_TEST_PACK_SPARSE", 0); + prepare_repo_settings(the_repository); + if (!sparse && the_repository->settings->pack_use_sparse != -1) + sparse = the_repository->settings->pack_use_sparse; + reset_pack_idx_option(&pack_idx_opts); git_config(git_pack_config, NULL); diff --git a/commit-graph.c b/commit-graph.c index b3c4de79b6..48e03aa285 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -16,6 +16,7 @@ #include "hashmap.h" #include "replace-object.h" #include "progress.h" +#include "repo-settings.h" #define GRAPH_SIGNATURE 0x43475048 /* "CGPH" */ #define GRAPH_CHUNKID_OIDFANOUT 0x4f494446 /* "OIDF" */ @@ -466,7 +467,6 @@ static void prepare_commit_graph_one(struct repository *r, const char *obj_dir) static int prepare_commit_graph(struct repository *r) { struct object_directory *odb; - int config_value; if (git_env_bool(GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD, 0)) die("dying as requested by the '%s' variable on commit-graph load!", @@ -476,9 +476,10 @@ static int prepare_commit_graph(struct repository *r) return !!r->objects->commit_graph; r->objects->commit_graph_attempted = 1; + prepare_repo_settings(r); + if (!git_env_bool(GIT_TEST_COMMIT_GRAPH, 0) && - (repo_config_get_bool(r, "core.commitgraph", &config_value) || - !config_value)) + r->settings->core_commit_graph != 1) /* * This repository is not configured to use commit graphs, so * do not load one. (But report commit_graph_attempted anyway diff --git a/read-cache.c b/read-cache.c index c701f7f8b8..ee1aaa8917 100644 --- a/read-cache.c +++ b/read-cache.c @@ -25,6 +25,7 @@ #include "fsmonitor.h" #include "thread-utils.h" #include "progress.h" +#include "repo-settings.h" /* Mask for the name length in ce_flags in the on-disk index */ @@ -1599,16 +1600,17 @@ struct cache_entry *refresh_cache_entry(struct index_state *istate, #define INDEX_FORMAT_DEFAULT 3 -static unsigned int get_index_format_default(void) +static unsigned int get_index_format_default(struct repository *r) { char *envversion = getenv("GIT_INDEX_VERSION"); char *endp; - int value; unsigned int version = INDEX_FORMAT_DEFAULT; if (!envversion) { - if (!git_config_get_int("index.version", &value)) - version = value; + prepare_repo_settings(r); + + if (r->settings->index_version >= 0) + version = r->settings->index_version; if (version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < version) { warning(_("index.version set, but the value is invalid.\n" "Using version %i"), INDEX_FORMAT_DEFAULT); @@ -2765,7 +2767,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile, } if (!istate->version) { - istate->version = get_index_format_default(); + istate->version = get_index_format_default(the_repository); if (git_env_bool("GIT_TEST_SPLIT_INDEX", 0)) init_split_index(istate); } diff --git a/repo-settings.c b/repo-settings.c new file mode 100644 index 0000000000..13a9128f62 --- /dev/null +++ b/repo-settings.c @@ -0,0 +1,44 @@ +#include "cache.h" +#include "repository.h" +#include "config.h" +#include "repo-settings.h" + +static int git_repo_config(const char *key, const char *value, void *cb) +{ + struct repo_settings *rs = (struct repo_settings *)cb; + + if (!strcmp(key, "core.commitgraph")) { + rs->core_commit_graph = git_config_bool(key, value); + return 0; + } + if (!strcmp(key, "gc.writecommitgraph")) { + rs->gc_write_commit_graph = git_config_bool(key, value); + return 0; + } + if (!strcmp(key, "pack.usesparse")) { + rs->pack_use_sparse = git_config_bool(key, value); + return 0; + } + if (!strcmp(key, "index.version")) { + rs->index_version = git_config_int(key, value); + return 0; + } + + return 1; +} + +void prepare_repo_settings(struct repository *r) +{ + if (r->settings) + return; + + r->settings = xmalloc(sizeof(*r->settings)); + + /* Defaults */ + r->settings->core_commit_graph = -1; + r->settings->gc_write_commit_graph = -1; + r->settings->pack_use_sparse = -1; + r->settings->index_version = -1; + + repo_config(r, git_repo_config, r->settings); +} diff --git a/repo-settings.h b/repo-settings.h new file mode 100644 index 0000000000..1151c2193a --- /dev/null +++ b/repo-settings.h @@ -0,0 +1,15 @@ +#ifndef REPO_SETTINGS_H +#define REPO_SETTINGS_H + +struct repo_settings { + int core_commit_graph; + int gc_write_commit_graph; + int pack_use_sparse; + int index_version; +}; + +struct repository; + +void prepare_repo_settings(struct repository *r); + +#endif /* REPO_SETTINGS_H */ diff --git a/repository.h b/repository.h index 4fb6a5885f..352afc9cd8 100644 --- a/repository.h +++ b/repository.h @@ -4,6 +4,7 @@ #include "path.h" struct config_set; +struct repo_settings; struct git_hash_algo; struct index_state; struct lock_file; @@ -72,6 +73,8 @@ struct repository { */ char *submodule_prefix; + struct repo_settings *settings; + /* Subsystems */ /* * Repository's config which contains key-value pairs from the usual From patchwork Mon Jul 22 17:54:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11053217 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 7BF89746 for ; Mon, 22 Jul 2019 17:54:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BD7E2865F for ; Mon, 22 Jul 2019 17:54:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60355285D5; Mon, 22 Jul 2019 17:54:30 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 23497285FF for ; Mon, 22 Jul 2019 17:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730661AbfGVRy1 (ORCPT ); Mon, 22 Jul 2019 13:54:27 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42925 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730583AbfGVRyZ (ORCPT ); Mon, 22 Jul 2019 13:54:25 -0400 Received: by mail-wr1-f67.google.com with SMTP id x1so25349920wrr.9 for ; Mon, 22 Jul 2019 10:54:23 -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=cyAOMMH1whMqdnKFrzzpquQ2nXvUE88NdzKeW3RK24Q=; b=OX7FKUA9QNkRj6MqoFdPJq57rsLWFTvI1hl4hgK7UyvNpv36ZnTmF30Hz2wnTSATxc w/pMxgM9oYgFnWuLmEma+4X7FOKUxZtMZbbaotz4Au8kn1o2JzPJoCVCJYomDzACXD11 UH2vq+DE9jTAa1W0wjPnOOmKPNeL1RozEIarv6KuIVrCPk3zKlv8M6Vm6hZuzJw1XyIo DKZ6flfJzF/JyWiBrqslUGw7Uyxkr1bCXJLlvj6941J5O4T1L1jSORFhzyOTr8ixhMok Kh2M4ieLAhOlgTUjgSoefTPUBc29VFHpO9Yr6HyxXX5Zt0PAmatGbuELfI5RXT3EWdHS vziA== 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=cyAOMMH1whMqdnKFrzzpquQ2nXvUE88NdzKeW3RK24Q=; b=Y6Jzj/jcocYFqEtWl+oii6rgdrATtI4Eh5yxKcfrTzXOwTMfQhKtRdhx+4E/bbhElD JCkviHUzpwx9EYEpXbSL7o6NPBV++7MHP/BlOELpRb8JDSivd0hkvX9wMtLFRcKV6Opu 5D7OceeboR2AXm2JmIhb5t0GlXmgtgnYfSYf7COgGJ1GJVFfj8um6O8pojm42oJ2EZoc uitRY49kmfGT3QlAceS3C+IFguFtYe3UjJhIDGB7P8ByuuL4dxsUe4xQvrswddlR2cP+ Z68cJ3hTXN9ZN62OfZwnKzVa22Qo8tvDnAjhSHKciRuknj7+K6o7cmrm/YwtOmpK1ij6 887w== X-Gm-Message-State: APjAAAXUVRVImoWoU4etOzPFPebYGTvKRxVl1A6429Qdi5CNYP/Kv9+B IqXnTVuUdsg2fARi4a/sld5Uxz0E X-Google-Smtp-Source: APXvYqyFJNrIfhhm6GfXJ0YQmSovTUIqri7ChvuhURWkE1U7AHZ3ITjSROjE34UJHfLIZ8pl5Q2bxg== X-Received: by 2002:adf:ca0f:: with SMTP id o15mr75917364wrh.135.1563818062862; Mon, 22 Jul 2019 10:54:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i13sm36139825wrr.73.2019.07.22.10.54.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 10:54:22 -0700 (PDT) Date: Mon, 22 Jul 2019 10:54:22 -0700 (PDT) X-Google-Original-Date: Mon, 22 Jul 2019 17:54:16 GMT Message-Id: In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 2/5] repo-settings: add feature.manyCommits setting Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes.Schindelin@gmx.de, peff@peff.net, jnareb@gmail.com, pclouds@gmail.com, carenas@gmail.com, avarab@gmail.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 When a repo has many commits, it is helpful to write and read the commit-graph file. Future changes to Git may include new config settings that are benefitial in this scenario. Create the 'feature.manyCommits' config setting that changes the default values of 'core.commitGraph' and 'gc.writeCommitGraph' to true. Signed-off-by: Derrick Stolee --- Documentation/config.txt | 2 ++ Documentation/config/core.txt | 3 ++- Documentation/config/feature.txt | 15 +++++++++++++++ Documentation/config/gc.txt | 4 ++-- repo-settings.c | 7 +++++++ 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 Documentation/config/feature.txt diff --git a/Documentation/config.txt b/Documentation/config.txt index e3f5bc3396..77f3b1486b 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -345,6 +345,8 @@ include::config/difftool.txt[] include::config/fastimport.txt[] +include::config/feature.txt[] + include::config/fetch.txt[] include::config/format.txt[] diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index 75538d27e7..d80162681a 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -577,7 +577,8 @@ the `GIT_NOTES_REF` environment variable. See linkgit:git-notes[1]. core.commitGraph:: If true, then git will read the commit-graph file (if it exists) - to parse the graph structure of commits. Defaults to false. See + to parse the graph structure of commits. Defaults to false, unless + `feature.manyCommits` is enabled. See linkgit:git-commit-graph[1] for more information. core.useReplaceRefs:: diff --git a/Documentation/config/feature.txt b/Documentation/config/feature.txt new file mode 100644 index 0000000000..f74314ae90 --- /dev/null +++ b/Documentation/config/feature.txt @@ -0,0 +1,15 @@ +feature.*:: + The config settings that start with `feature.` modify the defaults of + a group of other config settings. These groups are created by the Git + developer community as recommended defaults and are subject to change. + In particular, new config options may be added with different defaults. + +feature.manyCommits:: + Enable config options that optimize for repos with many commits. This + setting is recommended for repos with at least 100,000 commits. The + new default values are: ++ +* `core.commitGraph=true` enables reading the commit-graph file. ++ +* `gc.writeCommitGraph=true` enables writing the commit-graph file during +garbage collection. \ No newline at end of file diff --git a/Documentation/config/gc.txt b/Documentation/config/gc.txt index 02b92b18b5..31a5fc4f75 100644 --- a/Documentation/config/gc.txt +++ b/Documentation/config/gc.txt @@ -63,8 +63,8 @@ gc.writeCommitGraph:: If true, then gc will rewrite the commit-graph file when linkgit:git-gc[1] is run. When using `git gc --auto` the commit-graph will be updated if housekeeping is - required. Default is false. See linkgit:git-commit-graph[1] - for details. + required. Default is false, unless `feature.manyCommits` + is enabled. See linkgit:git-commit-graph[1] for details. gc.logExpiry:: If the file gc.log exists, then `git gc --auto` will print diff --git a/repo-settings.c b/repo-settings.c index 13a9128f62..f328602fd7 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -3,10 +3,17 @@ #include "config.h" #include "repo-settings.h" +#define UPDATE_DEFAULT(s,v) do { if (s == -1) { s = v; } } while(0) + static int git_repo_config(const char *key, const char *value, void *cb) { struct repo_settings *rs = (struct repo_settings *)cb; + if (!strcmp(key, "feature.manycommits")) { + UPDATE_DEFAULT(rs->core_commit_graph, 1); + UPDATE_DEFAULT(rs->gc_write_commit_graph, 1); + return 0; + } if (!strcmp(key, "core.commitgraph")) { rs->core_commit_graph = git_config_bool(key, value); return 0; From patchwork Mon Jul 22 17:54:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11053213 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 BC61E746 for ; Mon, 22 Jul 2019 17:54:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD4E2285D5 for ; Mon, 22 Jul 2019 17:54:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A15CB28682; Mon, 22 Jul 2019 17:54:28 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 7E342285D5 for ; Mon, 22 Jul 2019 17:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730647AbfGVRy0 (ORCPT ); Mon, 22 Jul 2019 13:54:26 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36459 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730598AbfGVRyZ (ORCPT ); Mon, 22 Jul 2019 13:54:25 -0400 Received: by mail-wr1-f65.google.com with SMTP id n4so40412107wrs.3 for ; Mon, 22 Jul 2019 10:54:24 -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=cAGj2SILeukP1zWnHYfnE/NiEH9e5YIRIFumRegH+qE=; b=CxzD/FiiT2eSjfkJru6E9KF13DRD8raq7pv38PQMa6j/07+MB6wgRDhwvvMzsNby5q B5S+bqwNm+giz2IegAefwO2faFdFW+D9pymV6SpvrvVo1Toi7FjKeyLwV10dzOG/y5TH oRDlGQh6/N+viLUbhKmEXjlqxhfsTTCOcxnQS+G+82nzGU5uvyxsy+EgoTykLY8uw/GV zoWEy/zxiT13UGsYYSCUcvI4IYq26/nXZei4Ua8PTtlopnQpJkWJ+kElFL7T7tp5OdGg HQYmiW0NslxG1Kmg5nSfikUsotOifM0K7242JRU6UmtVe4qYum+3i4e2VB30MJDPcJXw Yp6A== 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=cAGj2SILeukP1zWnHYfnE/NiEH9e5YIRIFumRegH+qE=; b=dMhC/WPTKEdqwn43U+fcead6XNN/6msYVpovQqBSR37C9GM8ko5W0XZM+x1xjxoEWW UqnjkwSatBqOj2JMqmelUUqFbL+TmcNWsjsF4pwgOHNQqIdmF3+C7UvOMEVpuOXRnOfb TVX+dpzJUXJR/RY90BVRDRLKxDpK0UQX6jxyymJsGNNL5zUhdVl8DuQFBf5ekIsyPt3u dApStSROF/FTGDEeLfvC6qxiup2m0Ean2+xc+4R8x7sNnI5OAnYi5rlLAgZmq3c5m2rp XoIJrxZYpf89Cy7RkdInxkGZ2QgceB8qDskdGb0KgQLt73NXC2C/1ss5jps/nVI1K/Hj UOJw== X-Gm-Message-State: APjAAAUXE231RNnmQF7ZDpIOVnUwVC9+OExVQHI3BIOr35CgHUDsmE4E p5Q5PYZbeHAkI+PrrmCmWP4Oqrbv X-Google-Smtp-Source: APXvYqzMtZ+36UL10ijLkVPCp/kaQ15u25AfUcBWS5KsDiN+Q2nzvvRUG9ET3Xb5g21cZbz7jMj8EQ== X-Received: by 2002:adf:ce8d:: with SMTP id r13mr75575674wrn.37.1563818063733; Mon, 22 Jul 2019 10:54:23 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f204sm59164089wme.18.2019.07.22.10.54.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 10:54:23 -0700 (PDT) Date: Mon, 22 Jul 2019 10:54:23 -0700 (PDT) X-Google-Original-Date: Mon, 22 Jul 2019 17:54:17 GMT Message-Id: <47ae3e7d4d765a00d14e8892db88a8936d56591b.1563818059.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 3/5] repo-settings: parse core.untrackedCache Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes.Schindelin@gmx.de, peff@peff.net, jnareb@gmail.com, pclouds@gmail.com, carenas@gmail.com, avarab@gmail.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 The core.untrackedCache config setting is slightly complicated, so clarify its use and centralize its parsing into the repo settings. The default value is "keep" (returned as -1), which persists the untracked cache if it exists. If the value is set as "false" (returned as 0), then remove the untracked cache if it exists. If the value is set as "true" (returned as 1), then write the untracked cache and persist it. Instead of relying on magic values of -1, 0, and 1, split these options into bitflags CORE_UNTRACKED_CACHE_KEEP and CORE_UNTRACKED_CACHE_WRITE. This allows the use of "-1" as a default value. After parsing the config options, if the value is unset we can initialize it to CORE_UNTRACKED_CACHE_KEEP. Signed-off-by: Derrick Stolee --- builtin/update-index.c | 7 +++++-- config.c | 24 ------------------------ read-cache.c | 19 +++++++++---------- repo-settings.c | 21 +++++++++++++++++++++ repo-settings.h | 4 ++++ 5 files changed, 39 insertions(+), 36 deletions(-) diff --git a/builtin/update-index.c b/builtin/update-index.c index dff2f4b837..6c26bbae80 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -18,6 +18,7 @@ #include "dir.h" #include "split-index.h" #include "fsmonitor.h" +#include "repo-settings.h" /* * Default to not allowing changes to the list of files. The @@ -966,6 +967,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) struct parse_opt_ctx_t ctx; strbuf_getline_fn getline_fn; int parseopt_state = PARSE_OPT_UNKNOWN; + struct repository *r = the_repository; struct option options[] = { OPT_BIT('q', NULL, &refresh_args.flags, N_("continue refresh even when index needs update"), @@ -1180,11 +1182,12 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) remove_split_index(&the_index); } + prepare_repo_settings(r); switch (untracked_cache) { case UC_UNSPECIFIED: break; case UC_DISABLE: - if (git_config_get_untracked_cache() == 1) + if (r->settings->core_untracked_cache & CORE_UNTRACKED_CACHE_WRITE) warning(_("core.untrackedCache is set to true; " "remove or change it, if you really want to " "disable the untracked cache")); @@ -1196,7 +1199,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) return !test_if_untracked_cache_is_supported(); case UC_ENABLE: case UC_FORCE: - if (git_config_get_untracked_cache() == 0) + if (r->settings->core_untracked_cache == 0) warning(_("core.untrackedCache is set to false; " "remove or change it, if you really want to " "enable the untracked cache")); diff --git a/config.c b/config.c index faa57e436c..3241dbc54d 100644 --- a/config.c +++ b/config.c @@ -2277,30 +2277,6 @@ int git_config_get_expiry_in_days(const char *key, timestamp_t *expiry, timestam return -1; /* thing exists but cannot be parsed */ } -int git_config_get_untracked_cache(void) -{ - int val = -1; - const char *v; - - /* Hack for test programs like test-dump-untracked-cache */ - if (ignore_untracked_cache_config) - return -1; - - if (!git_config_get_maybe_bool("core.untrackedcache", &val)) - return val; - - if (!git_config_get_value("core.untrackedcache", &v)) { - if (!strcasecmp(v, "keep")) - return -1; - - error(_("unknown core.untrackedCache value '%s'; " - "using 'keep' default value"), v); - return -1; - } - - return -1; /* default value */ -} - int git_config_get_split_index(void) { int val; diff --git a/read-cache.c b/read-cache.c index ee1aaa8917..e67e6f6e3e 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1846,18 +1846,17 @@ static void check_ce_order(struct index_state *istate) static void tweak_untracked_cache(struct index_state *istate) { - switch (git_config_get_untracked_cache()) { - case -1: /* keep: do nothing */ - break; - case 0: /* false */ + struct repository *r = the_repository; + + prepare_repo_settings(r); + + if (!(r->settings->core_untracked_cache & CORE_UNTRACKED_CACHE_KEEP)) { remove_untracked_cache(istate); - break; - case 1: /* true */ - add_untracked_cache(istate); - break; - default: /* unknown value: do nothing */ - break; + return; } + + if (r->settings->core_untracked_cache & CORE_UNTRACKED_CACHE_WRITE) + add_untracked_cache(istate); } static void tweak_split_index(struct index_state *istate) diff --git a/repo-settings.c b/repo-settings.c index f328602fd7..807c5a29d6 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -30,6 +30,20 @@ static int git_repo_config(const char *key, const char *value, void *cb) rs->index_version = git_config_int(key, value); return 0; } + if (!strcmp(key, "core.untrackedcache")) { + int bool_value = git_parse_maybe_bool(value); + if (bool_value == 0) + rs->core_untracked_cache = 0; + else if (bool_value == 1) + rs->core_untracked_cache = CORE_UNTRACKED_CACHE_KEEP | + CORE_UNTRACKED_CACHE_WRITE; + else if (!strcasecmp(value, "keep")) + rs->core_untracked_cache = CORE_UNTRACKED_CACHE_KEEP; + else + error(_("unknown core.untrackedCache value '%s'; " + "using 'keep' default value"), value); + return 0; + } return 1; } @@ -46,6 +60,13 @@ void prepare_repo_settings(struct repository *r) r->settings->gc_write_commit_graph = -1; r->settings->pack_use_sparse = -1; r->settings->index_version = -1; + r->settings->core_untracked_cache = -1; repo_config(r, git_repo_config, r->settings); + + /* Hack for test programs like test-dump-untracked-cache */ + if (ignore_untracked_cache_config) + r->settings->core_untracked_cache = CORE_UNTRACKED_CACHE_KEEP; + else + UPDATE_DEFAULT(r->settings->core_untracked_cache, CORE_UNTRACKED_CACHE_KEEP); } diff --git a/repo-settings.h b/repo-settings.h index 1151c2193a..bac9b87d49 100644 --- a/repo-settings.h +++ b/repo-settings.h @@ -1,11 +1,15 @@ #ifndef REPO_SETTINGS_H #define REPO_SETTINGS_H +#define CORE_UNTRACKED_CACHE_WRITE (1 << 0) +#define CORE_UNTRACKED_CACHE_KEEP (1 << 1) + struct repo_settings { int core_commit_graph; int gc_write_commit_graph; int pack_use_sparse; int index_version; + int core_untracked_cache; }; struct repository; From patchwork Mon Jul 22 17:54:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11053215 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 76785746 for ; Mon, 22 Jul 2019 17:54:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 670AF284FC for ; Mon, 22 Jul 2019 17:54:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B74C28682; Mon, 22 Jul 2019 17:54:29 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 D628428562 for ; Mon, 22 Jul 2019 17:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730657AbfGVRy0 (ORCPT ); Mon, 22 Jul 2019 13:54:26 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44485 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730613AbfGVRyZ (ORCPT ); Mon, 22 Jul 2019 13:54:25 -0400 Received: by mail-wr1-f66.google.com with SMTP id p17so40307521wrf.11 for ; Mon, 22 Jul 2019 10:54:25 -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=lOX80uVC2U2fQKJu8kcG4KezDPftBgNdrsTDy0EN1A8=; b=L1q3KiXIG//PZZXq61lQuCm/7iBmUk2QV+Gj2I3fH8LpYRJUXyTj/z9BSAW+tWZqWO Dac7HKPeXauPEogzq4RKxaQcSy5oMf4DOTucnV2DkjtDZe0AbxWbWbFOA67znb7/m0kn 3x24QeWeZTlw9fzFown5rh+fJbSV5/t8OJKP2FaV4iiYGviFZEt8XFCniLj4y3aREgRB IIoPlD6KEU5TJbGZKfwbqy/Qy4daKQIZUQcWJVNtBAMIiksBJQh8vfAfILiAQfdlsFnp zD0MlKxzba6VxqiORbMyUYdbesjDCv+X/bitzgQOhWw1dZlImxnPYpNpXob20xVS05bd /XVA== 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=lOX80uVC2U2fQKJu8kcG4KezDPftBgNdrsTDy0EN1A8=; b=Y16ptJFXGeZ+y+ae6QT18o6ywUHBdxAhms5VqKCEBzGcg6Qxpa+erHmzyVQzdCqp/3 oZNr66c4qD36b3krEP3iG55wgrSByJarI5WRNSUMBX75Ur8lsZNAJAAe5vai3LRwS0TQ GeBg3s77X/vbzZXMPYdaaYWw428BYnUhW1SUlQwEht3bfPTF7UFgFdV8ToAFE9a3zI5l EXahNajLecXZLV1SIOXJaTtbco4JwJ3xm38ZeWvZwznYY8DNF7wZiTJHAp68rBupjJqc xxzNIlnGzA+Fj5tzx2lK+LNx/Q7hySDA4B9CM2fqnjC3j+KC7p/xsVPhuvnGAgeQi5ER hk3w== X-Gm-Message-State: APjAAAUHnBeyjoeGENqmg5I5yMpnIas8j7RxGebZShzlXwFcMWVi/bPo izMkc92EI0Z2iXT+MiEwJN61BQTg X-Google-Smtp-Source: APXvYqz+VO9kT8BlD/JE/sYd1RuspxNBLY3tD7JfpS6g9d7bTccEgGAs1SkrRtS1vT1uLY+o0s4CqA== X-Received: by 2002:adf:de10:: with SMTP id b16mr43122769wrm.296.1563818064371; Mon, 22 Jul 2019 10:54:24 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id j9sm43916639wrn.81.2019.07.22.10.54.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 10:54:23 -0700 (PDT) Date: Mon, 22 Jul 2019 10:54:23 -0700 (PDT) X-Google-Original-Date: Mon, 22 Jul 2019 17:54:18 GMT Message-Id: <63b522a858bdd2fad78da53eae207e64f2f7a6e0.1563818059.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 4/5] repo-settings: create feature.manyFiles setting Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes.Schindelin@gmx.de, peff@peff.net, jnareb@gmail.com, pclouds@gmail.com, carenas@gmail.com, avarab@gmail.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 The feature.manyFiles setting is suitable for repos with many files in the working directory. By setting index.version=4 and core.untrackedCache=true, commands such as 'git status' should improve. While adding this setting, modify the index version precedence tests to check how this setting overrides the default for index.version is unset. Signed-off-by: Derrick Stolee --- Documentation/config/core.txt | 4 +++- Documentation/config/feature.txt | 12 +++++++++++- Documentation/config/index.txt | 1 + repo-settings.c | 6 ++++++ t/t1600-index.sh | 31 ++++++++++++++++++++++++++----- 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index d80162681a..7a2a33bc8c 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -86,7 +86,9 @@ core.untrackedCache:: it will automatically be removed, if set to `false`. Before setting it to `true`, you should check that mtime is working properly on your system. - See linkgit:git-update-index[1]. `keep` by default. + See linkgit:git-update-index[1]. `keep` by default, unless + `feature.manyFiles` is enabled which sets this setting to + `true` by default. core.checkStat:: When missing or is set to `default`, many fields in the stat diff --git a/Documentation/config/feature.txt b/Documentation/config/feature.txt index f74314ae90..c2d9ef7473 100644 --- a/Documentation/config/feature.txt +++ b/Documentation/config/feature.txt @@ -12,4 +12,14 @@ feature.manyCommits:: * `core.commitGraph=true` enables reading the commit-graph file. + * `gc.writeCommitGraph=true` enables writing the commit-graph file during -garbage collection. \ No newline at end of file +garbage collection. + +feature.manyFiles:: + Enable config options that optimize for repos with many files in the + working directory. With many files, commands such as `git status` and + `git checkout` may be slow and these new defaults improve performance: ++ +* `index.version=4` enables path-prefix compression in the index. ++ +* `core.untrackedCache=true` enables the untracked cache. This setting assumes +that mtime is working on your machine. \ No newline at end of file diff --git a/Documentation/config/index.txt b/Documentation/config/index.txt index f181503041..7cb50b37e9 100644 --- a/Documentation/config/index.txt +++ b/Documentation/config/index.txt @@ -24,3 +24,4 @@ index.threads:: index.version:: Specify the version with which new index files should be initialized. This does not affect existing repositories. + If `feature.manyFiles` is enabled, then the default is 4. diff --git a/repo-settings.c b/repo-settings.c index 807c5a29d6..9e4b8e6268 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -14,6 +14,12 @@ static int git_repo_config(const char *key, const char *value, void *cb) UPDATE_DEFAULT(rs->gc_write_commit_graph, 1); return 0; } + if (!strcmp(key, "feature.manyfiles")) { + UPDATE_DEFAULT(rs->index_version, 4); + UPDATE_DEFAULT(rs->core_untracked_cache, + CORE_UNTRACKED_CACHE_KEEP | CORE_UNTRACKED_CACHE_WRITE); + return 0; + } if (!strcmp(key, "core.commitgraph")) { rs->core_commit_graph = git_config_bool(key, value); return 0; diff --git a/t/t1600-index.sh b/t/t1600-index.sh index 42962ed7d4..c77721b580 100755 --- a/t/t1600-index.sh +++ b/t/t1600-index.sh @@ -59,17 +59,38 @@ test_expect_success 'out of bounds index.version issues warning' ' ) ' -test_expect_success 'GIT_INDEX_VERSION takes precedence over config' ' +test_index_version () { + INDEX_VERSION_CONFIG=$1 && + FEATURE_MANY_FILES=$2 && + ENV_VAR_VERSION=$3 + EXPECTED_OUTPUT_VERSION=$4 && ( rm -f .git/index && - GIT_INDEX_VERSION=4 && - export GIT_INDEX_VERSION && - git config --add index.version 2 && + rm -f .git/config && + if test "$INDEX_VERSION_CONFIG" -ne 0 + then + git config --add index.version $INDEX_VERSION_CONFIG + fi && + git config --add feature.manyFiles $FEATURE_MANY_FILES + if test "$ENV_VAR_VERSION" -ne 0 + then + GIT_INDEX_VERSION=$ENV_VAR_VERSION && + export GIT_INDEX_VERSION + else + unset GIT_INDEX_VERSION + fi && git add a 2>&1 && - echo 4 >expect && + echo $EXPECTED_OUTPUT_VERSION >expect && test-tool index-version <.git/index >actual && test_cmp expect actual ) +} + +test_expect_success 'index version config precedence' ' + test_index_version 2 false 4 4 && + test_index_version 2 true 0 2 && + test_index_version 0 true 0 4 && + test_index_version 0 true 2 2 ' test_done From patchwork Mon Jul 22 17:54:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Passaro via GitGitGadget X-Patchwork-Id: 11053221 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 94A97746 for ; Mon, 22 Jul 2019 17:54:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83225284FC for ; Mon, 22 Jul 2019 17:54:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7684428686; Mon, 22 Jul 2019 17:54:34 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 3C022284FC for ; Mon, 22 Jul 2019 17:54:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730583AbfGVRyc (ORCPT ); Mon, 22 Jul 2019 13:54:32 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:53975 "EHLO mail-wm1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730640AbfGVRy2 (ORCPT ); Mon, 22 Jul 2019 13:54:28 -0400 Received: by mail-wm1-f47.google.com with SMTP id x15so36067946wmj.3 for ; Mon, 22 Jul 2019 10:54:26 -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=2qqIIXMHwUPOwywuNFKfJca6KkHvvTOqROYxhxzO+jI=; b=Pk5Sy7kYF7Rla5unAoE5dis3dr1jAbuUimttTs8YdJKEWbRY/KUy64f02Wp5/8sDea CjGS55JgcgUWjy8w+UipJz6FUzrVOpDI332YnyZZTS87ZlLeSZK3DW6SCW2wuQnJeECP uMxlyJYnpID6gwK2iZVd0f2y3vXBfsEZ7iDBZROLCpyuWcU6qVGxL8BfYDE8MbUJ23AJ kBREzongBAOMj0cGULMybNu8vu02PhkgG6A1P2EISsB+w8o3d4rIugUhtlsY/5TF7p3H M7i4y2Hn6DCo0oRB2hoyGbuXM+aU5mNV05KRRFZsyeQDuXg/s9UY6hRRjFNv2mkY1fo5 mTQQ== 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=2qqIIXMHwUPOwywuNFKfJca6KkHvvTOqROYxhxzO+jI=; b=jiMBMbQuS1oVuBTJCUD3rqDz44wVn+8KiWSPSDLRsWfM9dC+yZ0x1EtnquUORedQt8 fAmgfPlY7xIOrFTsLiKcwzUFzKQtDe4xY1OSuwWmR9p78Zp3GknYhiA5xEGkuebMLO4l ChV+j9gIj1lgsx/hJBB2Pe3qjyvFCrxAYH7fOJCI0cmW9+Lo0THY4g8ldJlutOBcabuL D/VRvBdYLlwH5qNmf9qgfaMmKFchumCNOJcq6mPC4BXC0PoofK9EMyMoiOxZw2PNXPOw NBvdv7l8BC+azQbtsrJR3ExO8aNagScy2n5YOfLfSLaI66AsLY1WjSnINr6V1HIc9y/f 2Sxw== X-Gm-Message-State: APjAAAX+Troex/Rla0JatjivJ/usn3JJP/K1CVfaXB08UnP1cZHHssgO +exo6tKpvK/kMbfygDEZMkqL/ISb X-Google-Smtp-Source: APXvYqyJPRjOjEMkJKPg7+xHfDFYD9cS8APbXyxMnms8pebZz2/U1e7NInJdJPo6Advz/ckXOZAlFA== X-Received: by 2002:a7b:c195:: with SMTP id y21mr62999078wmi.16.1563818065299; Mon, 22 Jul 2019 10:54:25 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e3sm36492356wrt.93.2019.07.22.10.54.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 10:54:24 -0700 (PDT) Date: Mon, 22 Jul 2019 10:54:24 -0700 (PDT) X-Google-Original-Date: Mon, 22 Jul 2019 17:54:19 GMT Message-Id: In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 5/5] repo-settings: create feature.experimental setting Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes.Schindelin@gmx.de, peff@peff.net, jnareb@gmail.com, pclouds@gmail.com, carenas@gmail.com, avarab@gmail.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 The 'feature.experimental' setting includes config options that are not committed to become defaults, but could use additional testing. Update the following config settings to take new defaults, and to use the repo_settings struct if not already using them: * 'pack.useSparse=true' * 'merge.directoryRenames=true' * 'fetch.negotiationAlgorithm=skipping' In the case of fetch.negotiationAlgorithm, the existing logic would load the config option only when about to use the setting, so had a die() statement on an unknown string value. This is removed as now the config is parsed under prepare_repo_settings(). In general, this die() is probably misplaced and not valuable. A test was removed that checked this die() statement executed. Signed-off-by: Derrick Stolee --- Documentation/config/feature.txt | 17 +++++++++++++++ Documentation/config/fetch.txt | 3 ++- Documentation/config/merge.txt | 3 ++- Documentation/config/pack.txt | 3 ++- builtin/am.c | 4 +++- fetch-negotiator.c | 26 +++++++++++----------- fetch-negotiator.h | 5 +++-- fetch-pack.c | 11 +++++----- merge-recursive.c | 32 +++++++++++++++------------- merge-recursive.h | 1 - repo-settings.c | 32 +++++++++++++++++++++++++++- repo-settings.h | 12 ++++++++++- t/t5552-skipping-fetch-negotiator.sh | 23 -------------------- 13 files changed, 107 insertions(+), 65 deletions(-) diff --git a/Documentation/config/feature.txt b/Documentation/config/feature.txt index c2d9ef7473..287621b1e8 100644 --- a/Documentation/config/feature.txt +++ b/Documentation/config/feature.txt @@ -4,6 +4,23 @@ feature.*:: developer community as recommended defaults and are subject to change. In particular, new config options may be added with different defaults. +feature.experimental:: + Enable config options that are new to Git, and are being considered for + future defaults. Config settings included here may be added or removed + with each release, including minor version updates. These settings may + have unintended interactions since they are so new. Please enable this + setting if you are interested in providing feedback on experimental + features. The new default values are: ++ +* `pack.useSparse=true` uses a new algorithm when constructing a pack-file +which can improve `git push` performance in repos with many files. ++ +* `merge.directoryRenames=true` uses a new algorithm for detecting renames by +using entire directories at a time instead of single files at a time. ++ +* `fetch.negotiationAlgorithm=skipping` may improve fetch negotiation times by +skipping more commits at a time, reducing the number of round trips. + feature.manyCommits:: Enable config options that optimize for repos with many commits. This setting is recommended for repos with at least 100,000 commits. The diff --git a/Documentation/config/fetch.txt b/Documentation/config/fetch.txt index ba890b5884..d402110638 100644 --- a/Documentation/config/fetch.txt +++ b/Documentation/config/fetch.txt @@ -59,7 +59,8 @@ fetch.negotiationAlgorithm:: effort to converge faster, but may result in a larger-than-necessary packfile; The default is "default" which instructs Git to use the default algorithm that never skips commits (unless the server has acknowledged it or one - of its descendants). + of its descendants). If `feature.experimental` is enabled, then this + setting defaults to "skipping". Unknown values will cause 'git fetch' to error out. + See also the `--negotiation-tip` option for linkgit:git-fetch[1]. diff --git a/Documentation/config/merge.txt b/Documentation/config/merge.txt index 6a313937f8..e8def2d63c 100644 --- a/Documentation/config/merge.txt +++ b/Documentation/config/merge.txt @@ -54,7 +54,8 @@ merge.directoryRenames:: moved into the new directory. If set to "conflict", a conflict will be reported for such paths. If merge.renames is false, merge.directoryRenames is ignored and treated as false. Defaults - to "conflict". + to "conflict" unless `feature.experimental` is enabled and the + default is "true". merge.renormalize:: Tell Git that canonical representation of files in the diff --git a/Documentation/config/pack.txt b/Documentation/config/pack.txt index 9cdcfa7324..1d66f0c992 100644 --- a/Documentation/config/pack.txt +++ b/Documentation/config/pack.txt @@ -112,7 +112,8 @@ pack.useSparse:: objects. This can have significant performance benefits when computing a pack to send a small change. However, it is possible that extra objects are added to the pack-file if the included - commits contain certain types of direct renames. + commits contain certain types of direct renames. Default is `false` + unless `feature.experimental` is enabled. pack.writeBitmaps (deprecated):: This is a deprecated synonym for `repack.writeBitmaps`. diff --git a/builtin/am.c b/builtin/am.c index 1aea657a7f..5f3ee3e6cd 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -34,6 +34,7 @@ #include "string-list.h" #include "packfile.h" #include "repository.h" +#include "repo-settings.h" /** * Returns the length of the first line of msg. @@ -1538,7 +1539,8 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa o.branch1 = "HEAD"; their_tree_name = xstrfmt("%.*s", linelen(state->msg), state->msg); o.branch2 = their_tree_name; - o.detect_directory_renames = 0; + prepare_repo_settings(the_repository); + the_repository->settings->merge_directory_renames = 0; if (state->quiet) o.verbosity = 0; diff --git a/fetch-negotiator.c b/fetch-negotiator.c index d6d685cba0..e2990cf46e 100644 --- a/fetch-negotiator.c +++ b/fetch-negotiator.c @@ -2,19 +2,21 @@ #include "fetch-negotiator.h" #include "negotiator/default.h" #include "negotiator/skipping.h" +#include "repository.h" +#include "repo-settings.h" -void fetch_negotiator_init(struct fetch_negotiator *negotiator, - const char *algorithm) +void fetch_negotiator_init(struct repository *r, + struct fetch_negotiator *negotiator) { - if (algorithm) { - if (!strcmp(algorithm, "skipping")) { - skipping_negotiator_init(negotiator); - return; - } else if (!strcmp(algorithm, "default")) { - /* Fall through to default initialization */ - } else { - die("unknown fetch negotiation algorithm '%s'", algorithm); - } + prepare_repo_settings(r); + switch(r->settings->fetch_negotiation_algorithm) { + case FETCH_NEGOTIATION_SKIPPING: + skipping_negotiator_init(negotiator); + return; + + case FETCH_NEGOTIATION_DEFAULT: + default: + default_negotiator_init(negotiator); + return; } - default_negotiator_init(negotiator); } diff --git a/fetch-negotiator.h b/fetch-negotiator.h index 9e3967ce66..ea78868504 100644 --- a/fetch-negotiator.h +++ b/fetch-negotiator.h @@ -2,6 +2,7 @@ #define FETCH_NEGOTIATOR_H struct commit; +struct repository; /* * An object that supplies the information needed to negotiate the contents of @@ -52,7 +53,7 @@ struct fetch_negotiator { void *data; }; -void fetch_negotiator_init(struct fetch_negotiator *negotiator, - const char *algorithm); +void fetch_negotiator_init(struct repository *r, + struct fetch_negotiator *negotiator); #endif diff --git a/fetch-pack.c b/fetch-pack.c index 65be043f2a..d81f47c07b 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -36,7 +36,6 @@ static int agent_supported; static int server_supports_filtering; static struct lock_file shallow_lock; static const char *alternate_shallow_file; -static char *negotiation_algorithm; static struct strbuf fsck_msg_types = STRBUF_INIT; /* Remember to update object flag allocation in object.h */ @@ -892,12 +891,13 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, struct shallow_info *si, char **pack_lockfile) { + struct repository *r = the_repository; struct ref *ref = copy_ref_list(orig_ref); struct object_id oid; const char *agent_feature; int agent_len; struct fetch_negotiator negotiator; - fetch_negotiator_init(&negotiator, negotiation_algorithm); + fetch_negotiator_init(r, &negotiator); sort_ref_list(&ref, ref_compare_name); QSORT(sought, nr_sought, cmp_ref_by_name); @@ -911,7 +911,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, if (server_supports("shallow")) print_verbose(args, _("Server supports %s"), "shallow"); - else if (args->depth > 0 || is_repository_shallow(the_repository)) + else if (args->depth > 0 || is_repository_shallow(r)) die(_("Server does not support shallow clients")); if (args->depth > 0 || args->deepen_since || args->deepen_not) args->deepen = 1; @@ -1379,6 +1379,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args, struct shallow_info *si, char **pack_lockfile) { + struct repository *r = the_repository; struct ref *ref = copy_ref_list(orig_ref); enum fetch_state state = FETCH_CHECK_LOCAL; struct oidset common = OIDSET_INIT; @@ -1386,7 +1387,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args, int in_vain = 0; int haves_to_send = INITIAL_FLUSH; struct fetch_negotiator negotiator; - fetch_negotiator_init(&negotiator, negotiation_algorithm); + fetch_negotiator_init(r, &negotiator); packet_reader_init(&reader, fd[0], NULL, 0, PACKET_READ_CHOMP_NEWLINE | PACKET_READ_DIE_ON_ERR_PACKET); @@ -1505,8 +1506,6 @@ static void fetch_pack_config(void) git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta); git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects); git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects); - git_config_get_string("fetch.negotiationalgorithm", - &negotiation_algorithm); git_config(fetch_pack_config_cb, NULL); } diff --git a/merge-recursive.c b/merge-recursive.c index 12300131fc..162d5a4753 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -28,6 +28,7 @@ #include "submodule.h" #include "revision.h" #include "commit-reach.h" +#include "repo-settings.h" struct path_hashmap_entry { struct hashmap_entry e; @@ -1375,10 +1376,14 @@ static int handle_rename_via_dir(struct merge_options *opt, * there is no content merge to do; just move the file into the * desired final location. */ + struct repository *r = the_repository; const struct rename *ren = ci->ren1; const struct diff_filespec *dest = ren->pair->two; char *file_path = dest->path; - int mark_conflicted = (opt->detect_directory_renames == 1); + int mark_conflicted; + + prepare_repo_settings(r); + mark_conflicted = (r->settings->merge_directory_renames == MERGE_DIRECTORY_RENAMES_CONFLICT); assert(ren->dir_rename_original_dest); if (!opt->call_depth && would_lose_untracked(opt, dest->path)) { @@ -2850,6 +2855,7 @@ static int detect_and_process_renames(struct merge_options *opt, struct string_list *entries, struct rename_info *ri) { + struct repository *r = the_repository; struct diff_queue_struct *head_pairs, *merge_pairs; struct hashmap *dir_re_head, *dir_re_merge; int clean = 1; @@ -2863,7 +2869,8 @@ static int detect_and_process_renames(struct merge_options *opt, head_pairs = get_diffpairs(opt, common, head); merge_pairs = get_diffpairs(opt, common, merge); - if (opt->detect_directory_renames) { + prepare_repo_settings(r); + if (r->settings->merge_directory_renames) { dir_re_head = get_directory_renames(head_pairs); dir_re_merge = get_directory_renames(merge_pairs); @@ -3112,6 +3119,7 @@ static int handle_rename_normal(struct merge_options *opt, const struct diff_filespec *b, struct rename_conflict_info *ci) { + struct repository *r = the_repository; struct rename *ren = ci->ren1; struct merge_file_info mfi; int clean; @@ -3121,7 +3129,9 @@ static int handle_rename_normal(struct merge_options *opt, clean = handle_content_merge(&mfi, opt, path, was_dirty(opt, path), o, a, b, ci); - if (clean && opt->detect_directory_renames == 1 && + prepare_repo_settings(r); + if (clean && + r->settings->merge_directory_renames == MERGE_DIRECTORY_RENAMES_CONFLICT && ren->dir_rename_original_dest) { if (update_stages(opt, path, NULL, @@ -3155,6 +3165,7 @@ static void dir_rename_warning(const char *msg, static int warn_about_dir_renamed_entries(struct merge_options *opt, struct rename *ren) { + struct repository *r = the_repository; const char *msg; int clean = 1, is_add; @@ -3166,12 +3177,13 @@ static int warn_about_dir_renamed_entries(struct merge_options *opt, return clean; /* Sanity checks */ - assert(opt->detect_directory_renames > 0); + prepare_repo_settings(r); + assert(r->settings->merge_directory_renames > 0); assert(ren->dir_rename_original_type == 'A' || ren->dir_rename_original_type == 'R'); /* Check whether to treat directory renames as a conflict */ - clean = (opt->detect_directory_renames == 2); + clean = (r->settings->merge_directory_renames == MERGE_DIRECTORY_RENAMES_TRUE); is_add = (ren->dir_rename_original_type == 'A'); if (ren->dir_rename_original_type == 'A' && clean) { @@ -3662,15 +3674,6 @@ static void merge_recursive_config(struct merge_options *opt) opt->merge_detect_rename = git_config_rename("merge.renames", value); free(value); } - if (!git_config_get_string("merge.directoryrenames", &value)) { - int boolval = git_parse_maybe_bool(value); - if (0 <= boolval) { - opt->detect_directory_renames = boolval ? 2 : 0; - } else if (!strcasecmp(value, "conflict")) { - opt->detect_directory_renames = 1; - } /* avoid erroring on values from future versions of git */ - free(value); - } git_config(git_xmerge_config, NULL); } @@ -3687,7 +3690,6 @@ void init_merge_options(struct merge_options *opt, opt->renormalize = 0; opt->diff_detect_rename = -1; opt->merge_detect_rename = -1; - opt->detect_directory_renames = 1; merge_recursive_config(opt); merge_verbosity = getenv("GIT_MERGE_VERBOSITY"); if (merge_verbosity) diff --git a/merge-recursive.h b/merge-recursive.h index c2b7bb65c6..b8eba244ee 100644 --- a/merge-recursive.h +++ b/merge-recursive.h @@ -22,7 +22,6 @@ struct merge_options { unsigned renormalize : 1; long xdl_opts; int verbosity; - int detect_directory_renames; int diff_detect_rename; int merge_detect_rename; int diff_rename_limit; diff --git a/repo-settings.c b/repo-settings.c index 9e4b8e6268..5e9249c437 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -9,6 +9,12 @@ static int git_repo_config(const char *key, const char *value, void *cb) { struct repo_settings *rs = (struct repo_settings *)cb; + if (!strcmp(key, "feature.experimental")) { + UPDATE_DEFAULT(rs->pack_use_sparse, 1); + UPDATE_DEFAULT(rs->merge_directory_renames, MERGE_DIRECTORY_RENAMES_TRUE); + UPDATE_DEFAULT(rs->fetch_negotiation_algorithm, FETCH_NEGOTIATION_SKIPPING); + return 0; + } if (!strcmp(key, "feature.manycommits")) { UPDATE_DEFAULT(rs->core_commit_graph, 1); UPDATE_DEFAULT(rs->gc_write_commit_graph, 1); @@ -50,6 +56,23 @@ static int git_repo_config(const char *key, const char *value, void *cb) "using 'keep' default value"), value); return 0; } + if (!strcmp(key, "merge.directoryrenames")) { + int bool_value = git_parse_maybe_bool(value); + if (0 <= bool_value) { + rs->merge_directory_renames = bool_value ? MERGE_DIRECTORY_RENAMES_TRUE : 0; + } else if (!strcasecmp(value, "conflict")) { + rs->merge_directory_renames = MERGE_DIRECTORY_RENAMES_CONFLICT; + } + return 0; + } + if (!strcmp(key, "fetch.negotiationalgorithm")) { + if (!strcasecmp(value, "skipping")) { + rs->fetch_negotiation_algorithm = FETCH_NEGOTIATION_SKIPPING; + } else { + rs->fetch_negotiation_algorithm = FETCH_NEGOTIATION_DEFAULT; + } + return 0; + } return 1; } @@ -64,10 +87,14 @@ void prepare_repo_settings(struct repository *r) /* Defaults */ r->settings->core_commit_graph = -1; r->settings->gc_write_commit_graph = -1; - r->settings->pack_use_sparse = -1; + r->settings->index_version = -1; r->settings->core_untracked_cache = -1; + r->settings->pack_use_sparse = -1; + r->settings->merge_directory_renames = -1; + r->settings->fetch_negotiation_algorithm = -1; + repo_config(r, git_repo_config, r->settings); /* Hack for test programs like test-dump-untracked-cache */ @@ -75,4 +102,7 @@ void prepare_repo_settings(struct repository *r) r->settings->core_untracked_cache = CORE_UNTRACKED_CACHE_KEEP; else UPDATE_DEFAULT(r->settings->core_untracked_cache, CORE_UNTRACKED_CACHE_KEEP); + + UPDATE_DEFAULT(r->settings->merge_directory_renames, MERGE_DIRECTORY_RENAMES_CONFLICT); + UPDATE_DEFAULT(r->settings->fetch_negotiation_algorithm, FETCH_NEGOTIATION_DEFAULT); } diff --git a/repo-settings.h b/repo-settings.h index bac9b87d49..cecf7d0028 100644 --- a/repo-settings.h +++ b/repo-settings.h @@ -4,12 +4,22 @@ #define CORE_UNTRACKED_CACHE_WRITE (1 << 0) #define CORE_UNTRACKED_CACHE_KEEP (1 << 1) +#define MERGE_DIRECTORY_RENAMES_CONFLICT 1 +#define MERGE_DIRECTORY_RENAMES_TRUE 2 + +#define FETCH_NEGOTIATION_DEFAULT 1 +#define FETCH_NEGOTIATION_SKIPPING 2 + struct repo_settings { int core_commit_graph; int gc_write_commit_graph; - int pack_use_sparse; + int index_version; int core_untracked_cache; + + int pack_use_sparse; + int merge_directory_renames; + int fetch_negotiation_algorithm; }; struct repository; diff --git a/t/t5552-skipping-fetch-negotiator.sh b/t/t5552-skipping-fetch-negotiator.sh index 8a14be51a1..f70cbcc9ca 100755 --- a/t/t5552-skipping-fetch-negotiator.sh +++ b/t/t5552-skipping-fetch-negotiator.sh @@ -60,29 +60,6 @@ test_expect_success 'commits with no parents are sent regardless of skip distanc have_not_sent c6 c4 c3 ' -test_expect_success 'unknown fetch.negotiationAlgorithm values error out' ' - rm -rf server client trace && - git init server && - test_commit -C server to_fetch && - - git init client && - test_commit -C client on_client && - git -C client checkout on_client && - - test_config -C client fetch.negotiationAlgorithm invalid && - test_must_fail git -C client fetch "$(pwd)/server" 2>err && - test_i18ngrep "unknown fetch negotiation algorithm" err && - - # Explicit "default" value - test_config -C client fetch.negotiationAlgorithm default && - git -C client -c fetch.negotiationAlgorithm=default fetch "$(pwd)/server" && - - # Implementation detail: If there is nothing to fetch, we will not error out - test_config -C client fetch.negotiationAlgorithm invalid && - git -C client fetch "$(pwd)/server" 2>err && - test_i18ngrep ! "unknown fetch negotiation algorithm" err -' - test_expect_success 'when two skips collide, favor the larger one' ' rm -rf server client trace && git init server &&