From patchwork Mon Jun 3 20:18:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 10973945 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 2ED0B15E6 for ; Mon, 3 Jun 2019 20:18:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC0D28068 for ; Mon, 3 Jun 2019 20:18:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D60628733; Mon, 3 Jun 2019 20:18:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30F3328068 for ; Mon, 3 Jun 2019 20:18:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbfFCUSW (ORCPT ); Mon, 3 Jun 2019 16:18:22 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:35174 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbfFCUSW (ORCPT ); Mon, 3 Jun 2019 16:18:22 -0400 Received: by mail-ed1-f68.google.com with SMTP id p26so28651830edr.2 for ; Mon, 03 Jun 2019 13:18:20 -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=bT+5IuBlg24t0fyBm0iYNv12ZUeB1OPbB0P2YzP8iBE=; b=h0F4T3zsDciU1wDSjwt7DUdYaPR/i0RnZ8/j+qy9Qmhdwo13agnWcNFlDXbSXoQsEt S98pvHle3unbJvRZ4JKQVPIjNmlE3IFcJrwGy0GLddHdIZZOTv0o/MrYaarVHJfEVdiG JgxfSDLuDSR7Gpeg7rQGanq9JTV5hBq7wwbNxrHtRq2OppX/5w+3dEQVxrmw8maAPy+J Dgbgl9KpfdLLtxeTQdELap5ODc7zDg3/22M/AZpiHAHiFdv6WMG7EauI3XJQavcw5wfO ujxdbXYY2kGL02gL+Mln9jVi7r1nTFk0CsPrM93nOJkVlodOOw8Hav/d9euOGTir28LL wcZg== 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=bT+5IuBlg24t0fyBm0iYNv12ZUeB1OPbB0P2YzP8iBE=; b=TUt3WDc+xd+nvJNUbmUehS4M0au3H7764nvk6ChBaRaoFSZxLDRQIkeoo6cKzggp08 lXVGHepULI+O8usvto7jgTJYjttkrevTgZjNSDoEb5HbHzW0UucNiLAaWFVufGPnqz/c dxb4x9Wt34/VqDWYUf0Xg0fPmVsHVkECv/yHK+GXmvoEUTbs+ACAJXTsmSRkPCFnBQUD Jf9q12V7yTIDD9HKlbYp3yuOEr8QQb81Gr82VrDoUNI49F9pxXBosX0nW9aPPtUiAxdv lW5R9jEjdhHZNl0OzlXGWiZ3kRMZKcU14RkZLyhTnEeuXAzGyKyjIA8CB0/C+jwZPGqV KsYw== X-Gm-Message-State: APjAAAXpD/3SRwF882wl7+Ray+dtouAjceQHzNy5GBu9T8t9IRjUFwCq 7OLXJWAMJ3i/SU/cB472GD+N4n/Q X-Google-Smtp-Source: APXvYqwWYfd5IrKXaLEw4QJJ3X9ev8TwS4+6v215I9X9vSNoOUjqV4dk4VI4z+mDuqBiHDmBxPHlSg== X-Received: by 2002:a50:fc97:: with SMTP id f23mr31314378edq.104.1559593099664; Mon, 03 Jun 2019 13:18:19 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b6sm4092974edi.72.2019.06.03.13.18.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 13:18:19 -0700 (PDT) Date: Mon, 03 Jun 2019 13:18:19 -0700 (PDT) X-Google-Original-Date: Mon, 03 Jun 2019 20:18:07 GMT Message-Id: <704613f4480e3b9aacab91d2241247791f34ce22.1559593097.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 01/11] repo-settings: create repo.size=large setting Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: 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 Several advanced config settings are highly recommended for clients using large repositories. Power users learn these one-by-one and enable them as they see fit. This could be made simpler, to allow more users to have access to these almost-always beneficial features (and more beneficial in larger repos). Create a 'repo.size' config setting whose only accepted value is 'large'. When a repo.size=large is given, change the default values of some config settings. If the setting is given explicitly, then take the explicit value. This change adds these two defaults to the repo.size=large setting: * core.commitGraph=true * gc.writeCommitGraph=true To centralize these config options and properly set the defaults, create a repo_settings that contains chars for each config variable. Use -1 as "unset", with 0 for false and 1 for true. The prepare_repo_settings() method ensures that this settings struct has been initialized, and avoids double-scanning the config settings. Signed-off-by: Derrick Stolee --- Documentation/config/core.txt | 16 +++++++++++-- Documentation/config/gc.txt | 4 ++-- Makefile | 1 + builtin/gc.c | 6 ++--- commit-graph.c | 7 +++--- repo-settings.c | 44 +++++++++++++++++++++++++++++++++++ repo-settings.h | 13 +++++++++++ repository.h | 3 +++ 8 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 repo-settings.c create mode 100644 repo-settings.h diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index 75538d27e7..1a188db620 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -577,8 +577,9 @@ 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 - linkgit:git-commit-graph[1] for more information. + to parse the graph structure of commits. Defaults to false, unless + `core.size=large`. See linkgit:git-commit-graph[1] for more + information. core.useReplaceRefs:: If set to `false`, behave as if the `--no-replace-objects` @@ -601,3 +602,14 @@ core.abbrev:: in your repository, which hopefully is enough for abbreviated object names to stay unique for some time. The minimum length is 4. + +core.size:: + When specified as "large", change the default values of some config + variables to improve performance in a large repository. If a variable + is specified explicitly, the explicit value will override these + defaults: ++ +* `core.commitGraph=true` enables reading commit-graph files. ++ +* `gc.writeCommitGraph=true` eneables writing commit-graph files during +`git gc`. diff --git a/Documentation/config/gc.txt b/Documentation/config/gc.txt index 02b92b18b5..680721ebbb 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 `core.size=large`. + 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/Makefile b/Makefile index 8a7e235352..2d3499d7ac 100644 --- a/Makefile +++ b/Makefile @@ -967,6 +967,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 8943bcc300..6281aad961 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,7 +684,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix) clean_pack_garbage(); } - if (gc_write_commit_graph) + prepare_repo_settings(the_repository); + if (the_repository->settings->gc_write_commit_graph == 1) write_commit_graph_reachable(get_object_directory(), 0, !quiet && !daemonized); diff --git a/commit-graph.c b/commit-graph.c index 7c5e54875f..b09c465a7a 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" */ @@ -311,7 +312,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!", @@ -321,9 +321,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/repo-settings.c b/repo-settings.c new file mode 100644 index 0000000000..6f5e18d92e --- /dev/null +++ b/repo-settings.c @@ -0,0 +1,44 @@ +#include "cache.h" +#include "repository.h" +#include "config.h" +#include "repo-settings.h" + + +#define UPDATE_DEFAULT(s,v) if (s != -1) { s = v; } + +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.size")) { + if (!strcmp(value, "large")) { + 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; + } + if (!strcmp(key, "gc.writecommitgraph")) { + rs->gc_write_commit_graph = git_config_bool(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; + + repo_config(r, git_repo_config, r->settings); +} diff --git a/repo-settings.h b/repo-settings.h new file mode 100644 index 0000000000..11d08648e1 --- /dev/null +++ b/repo-settings.h @@ -0,0 +1,13 @@ +#ifndef REPO_SETTINGS_H +#define REPO_SETTINGS_H + +struct repo_settings { + char core_commit_graph; + char gc_write_commit_graph; +}; + +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 Jun 3 20:18:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 10973947 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 9BE121515 for ; Mon, 3 Jun 2019 20:18:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C4CD287B7 for ; Mon, 3 Jun 2019 20:18:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80C1C2874B; Mon, 3 Jun 2019 20:18:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10BDA281C3 for ; Mon, 3 Jun 2019 20:18:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726828AbfFCUS0 (ORCPT ); Mon, 3 Jun 2019 16:18:26 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45076 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726685AbfFCUSX (ORCPT ); Mon, 3 Jun 2019 16:18:23 -0400 Received: by mail-ed1-f66.google.com with SMTP id f20so28558697edt.12 for ; Mon, 03 Jun 2019 13:18:21 -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=jsy8sX9BKSrzPQtmLrNXXGnWG38hAkMUnkOubuKiEVs=; b=NF22jSFmBxTuNeHgyBqq5auX6HrW9cBQ3Fqnw8GcxKHCz+ToBpGxoMjG8PlsIG6svZ R2CZDphKDHZVpqeAc83KOkSUrnMMUAjriqHdMiXCOVd44rLzW5Z8SgkLABpGVWfPhJ6x ytZUixHZOmSkXlEvPMERDzGj6GJSLVYLlwO7g5yJ35K3CFEULsG10RDK16maukv9M1V3 ShR7ouXhr3vN5bsS407R4BNEFFIu763ZlvrEOLJVILP65IXlEM/Zi2Cxj5a3hw/A7ARN uKxKBP6jVBIwuWJiThul1wQS3CmyRjKT3Y5J5ap8ppj6tHgF0hS+T4LohhsxTC1qn97e bMIw== 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=jsy8sX9BKSrzPQtmLrNXXGnWG38hAkMUnkOubuKiEVs=; b=IWmeVSAs0V+hmqiGuJ2tHoaaQygl9p3bVYqF3Bj4Vw4dAxkX6fuzYtO5eqPprXUxM8 m4lKFOefmyB9gL2WLB0D2EPfbvM/QeKRhiwak6SGVPqpdVAuSq5aAwR3dnzShVvh+ddl gwAsV1ABoMxCqeHCQHqPG+fYZrqDe+3Wg3h6c4T46JNppEUm9haxUGfqFofyHmv1X/bt lnu9PlwRDxjK2JFP8fniSrthphYfD7V3XxyZ/YeGceS8hsB4Pm27FaDDqSvZFSgGXULl HpLyE/4wki4tIMYxd5DHA2n1QeEVNb5a+Kca6dmpsn6Hx5ULJu+7C/cqpVVeuIOLqAYF VFRQ== X-Gm-Message-State: APjAAAUHyOXTNT3Uov/CQFAz4ztXlI86F/uiYQ+X8urAA8gTC6uWkFAp pimwKumeACfWOHRHOYeg0wwAkHXn X-Google-Smtp-Source: APXvYqxsNBt3gwbMZjIIKXemJO+mGRA9SIBaoZCFIyiWDInAQjEcRPmyMRWB0XnXC8QiLWTHKAzxrQ== X-Received: by 2002:a50:926d:: with SMTP id j42mr12385745eda.237.1559593100511; Mon, 03 Jun 2019 13:18:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r14sm2797198ejb.54.2019.06.03.13.18.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 13:18:20 -0700 (PDT) Date: Mon, 03 Jun 2019 13:18:20 -0700 (PDT) X-Google-Original-Date: Mon, 03 Jun 2019 20:18:08 GMT Message-Id: In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 02/11] repo-settings: use index.version=4 by default Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: 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 If a repo is large, it likely has many paths in its working directory. This means the index could be compressed using version 4. Set this as a default when core.size=large. Signed-off-by: Derrick Stolee --- Documentation/config/core.txt | 3 +++ Documentation/config/index.txt | 1 + read-cache.c | 12 +++++++----- repo-settings.c | 6 ++++++ repo-settings.h | 1 + 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index 1a188db620..ea64f675fa 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -613,3 +613,6 @@ core.size:: + * `gc.writeCommitGraph=true` eneables writing commit-graph files during `git gc`. ++ +* `index.version=4` uses prefix-compression to reduce the size of the +.git/index file. diff --git a/Documentation/config/index.txt b/Documentation/config/index.txt index f181503041..d4b56925c4 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 `core.size=large`, then the default value is 4. diff --git a/read-cache.c b/read-cache.c index 22e7b9944e..7fab8ff748 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 index 6f5e18d92e..7e6e65d60c 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -14,6 +14,7 @@ static int git_repo_config(const char *key, const char *value, void *cb) if (!strcmp(value, "large")) { UPDATE_DEFAULT(rs->core_commit_graph, 1); UPDATE_DEFAULT(rs->gc_write_commit_graph, 1); + UPDATE_DEFAULT(rs->index_version, 4); } return 0; } @@ -25,6 +26,10 @@ static int git_repo_config(const char *key, const char *value, void *cb) rs->gc_write_commit_graph = git_config_bool(key, value); return 0; } + if (!strcmp(key, "index.version")) { + rs->index_version = git_config_int(key, value); + return 0; + } return 1; } @@ -39,6 +44,7 @@ void prepare_repo_settings(struct repository *r) /* Defaults */ r->settings->core_commit_graph = -1; r->settings->gc_write_commit_graph = -1; + r->settings->index_version = -1; repo_config(r, git_repo_config, r->settings); } diff --git a/repo-settings.h b/repo-settings.h index 11d08648e1..9b8104042e 100644 --- a/repo-settings.h +++ b/repo-settings.h @@ -4,6 +4,7 @@ struct repo_settings { char core_commit_graph; char gc_write_commit_graph; + int index_version; }; struct repository; From patchwork Mon Jun 3 20:18:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 10973961 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 AF6D715E6 for ; Mon, 3 Jun 2019 20:18:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DF4F204C3 for ; Mon, 3 Jun 2019 20:18:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9215D2811E; Mon, 3 Jun 2019 20:18:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FB86204C3 for ; Mon, 3 Jun 2019 20:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbfFCUS0 (ORCPT ); Mon, 3 Jun 2019 16:18:26 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:42564 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726076AbfFCUSX (ORCPT ); Mon, 3 Jun 2019 16:18:23 -0400 Received: by mail-ed1-f67.google.com with SMTP id z25so2551688edq.9 for ; Mon, 03 Jun 2019 13:18:21 -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=ZqE9Y0MToTDxE4zj4OT/70tMs7Z9xCLDMQuJTXCJOKY=; b=gV6W+QTPHRmakclAZ9tobZFJcikNj9g/xgUueHa8a2Z4m37hOW+hB4yQ28ZWvkQr23 x/0Xf2u440obeNxwbiDjih4IFY4Aq8kSWfA255mNqomFe2tuEOuNvE26nxcITYnVw/zd ZiI0w0TPs3m2vlCcUYoPYpjQ/dOguWDafq4jeapakySQSA3ncbaKba0QY/LiNi8d2SjJ 60/06KHmYY6Ma8gB4d51EbgYrY0TdgMDQZMp+qcFWay89/AR6JeUkgvZDkn1rVj+ryWt iy3aZSabE3VenbE5ACEowkiSPTxDHF7JJIxx/vkQS3U/6abUJ3H+LAE/2+mIQurFNf9n 1Gfw== 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=ZqE9Y0MToTDxE4zj4OT/70tMs7Z9xCLDMQuJTXCJOKY=; b=TDgHEWPk5snfhKEW5X/vQ3bQxUBq78NxQuKdlCtaWUwv+Lvp0BJVlhleM3pU4dVLA2 yHmMCtB+SHxqMNxy7DIZzVCh3sLYinYb0gIJB5JUd1za1/zE4YjaKV6OpdHEsUSF+YBe od4ra5BPRt5molRTnTAvcHYlta9U5kEJM6X0QPw5nQ0nbvZbJIP7tjUrmtQ8IV6/S2h4 6pcxEotIzibnl3w3SX44CpfJ8z13xsvRJ9qLoyqPjd5JgQdL85/DW442otwkHfTn6dh+ L0RvqD5YwRhCMMWlBtlZ5Dwyn3Yxq0bhYcUrXpI7aC8k2s8IDRmtg+3vUFXvzXdczAkW sDeg== X-Gm-Message-State: APjAAAXAyEi0c8A41oXaOEMAnth0BDrycQ3w7KlxwYgbNyvC8VuFCHEV IFFwCsxUcZuqv2b4vNiai2cNu6WV X-Google-Smtp-Source: APXvYqzsgGcXTBnsEdB12BtobFsZVbrAPPeiaLLmLYtVWKzQf7BU+3AdbgIaw+QF4XGRPti7fBNndQ== X-Received: by 2002:a50:ade3:: with SMTP id b32mr31253226edd.297.1559593101246; Mon, 03 Jun 2019 13:18:21 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id d11sm4232871eda.45.2019.06.03.13.18.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 13:18:20 -0700 (PDT) Date: Mon, 03 Jun 2019 13:18:20 -0700 (PDT) X-Google-Original-Date: Mon, 03 Jun 2019 20:18:09 GMT Message-Id: In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 03/11] repo-settings: pack.useSparse=true Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: 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 If a repo is large, then it probably has a very large working directory. In this case, a typical developer's edits usually impact many fewer paths than the full path set. The sparse treewalk algorithm is optimized for this case, speeding up 'git push' calls. Use pack.useSparse=true when core.size=large. Signed-off-by: Derrick Stolee --- Documentation/config/core.txt | 4 ++++ Documentation/config/pack.txt | 3 ++- builtin/pack-objects.c | 9 +++++---- repo-settings.c | 6 ++++++ repo-settings.h | 1 + 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index ea64f675fa..df357f5af5 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -616,3 +616,7 @@ core.size:: + * `index.version=4` uses prefix-compression to reduce the size of the .git/index file. ++ +* `pack.useSparse=true` uses the sparse tree-walk algorithm, which is +optimized for enumerating objects during linkgit:git-push[1] from a +client machine. diff --git a/Documentation/config/pack.txt b/Documentation/config/pack.txt index 9cdcfa7324..e6f44de104 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. Defaults to + false, unless `core.size=large`. pack.writeBitmaps (deprecated):: This is a deprecated synonym for `repack.writeBitmaps`. diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 41d7fc5983..f26b3f2892 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) @@ -2707,10 +2708,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) @@ -3330,6 +3327,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/repo-settings.c b/repo-settings.c index 7e6e65d60c..026ab9c1a0 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -14,6 +14,7 @@ static int git_repo_config(const char *key, const char *value, void *cb) if (!strcmp(value, "large")) { UPDATE_DEFAULT(rs->core_commit_graph, 1); UPDATE_DEFAULT(rs->gc_write_commit_graph, 1); + UPDATE_DEFAULT(rs->pack_use_sparse, 1); UPDATE_DEFAULT(rs->index_version, 4); } return 0; @@ -26,6 +27,10 @@ static int git_repo_config(const char *key, const char *value, void *cb) 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; @@ -44,6 +49,7 @@ 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; repo_config(r, git_repo_config, r->settings); diff --git a/repo-settings.h b/repo-settings.h index 9b8104042e..b50228f992 100644 --- a/repo-settings.h +++ b/repo-settings.h @@ -4,6 +4,7 @@ struct repo_settings { char core_commit_graph; char gc_write_commit_graph; + char pack_use_sparse; int index_version; }; From patchwork Mon Jun 3 20:18:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 10973965 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 F19BB1515 for ; Mon, 3 Jun 2019 20:18:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E28E627F90 for ; Mon, 3 Jun 2019 20:18:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E13552811E; Mon, 3 Jun 2019 20:18:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D48228068 for ; Mon, 3 Jun 2019 20:18:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726800AbfFCUS0 (ORCPT ); Mon, 3 Jun 2019 16:18:26 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:37352 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726574AbfFCUSY (ORCPT ); Mon, 3 Jun 2019 16:18:24 -0400 Received: by mail-ed1-f65.google.com with SMTP id w13so1953210eds.4 for ; Mon, 03 Jun 2019 13:18: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=27s+rbHdkAdNzKgKgbTjlL1emWCnj+0/JsTVWXnAlWk=; b=ruMi1Dt7x1/nbuvnSEWEdhwMIeMCP7h8a+NAdKrC3u+beqaYPkKm0Vr58fsRwDcgVm dUL8KK425BCWgPSpC2IfwQ6NQ+UW/GTl6+Hw95Sw5gUZK10oPV/4HjnUg8Wv2YupWkwe uoQPsIQ8VrgfW6PnYeTUZRMb31dBJGETtokcCyGgcJ11w6tbhIy/F/bUBit0TiUbxXTp V0HRm3n1XkRwIkdPfFK6CRegotMGMuzULaD9t2a+8BIv0OGwcOyKJ5YhmgeR7Hqd6Q1I cz9rmmqZQyzi3JhR0C+QMZnvFQMbKa6SES/g6RuQe/9wrzrwc2DQW7ZgsAaPPp0cG4/i 2vMQ== 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=27s+rbHdkAdNzKgKgbTjlL1emWCnj+0/JsTVWXnAlWk=; b=SnA/pq693kDZloGLvvmGN7AcV4RJKJZUCu+oGDs5D5fnMUW4XUARNkyi8IJyShCjFu 7tOCTAvwEYQcCX934sAqWrNsubRWvbh+KnTaYLtmJ9yNHQZ09brbpF3mTMVEDESPKa+b uDjfxSsjkDuLgXxck/ygCbjFAMXVFNfkskUExfYRFYQYWyucQxOWsWShshldcGITeoVt iXPUJ9m+2WXrP5O0q1pDLBVRLPMCTR8nv99kTdx/3UxDISlD/4FJ36n4HxQIfsFs9Dcb rujHqUhLknPbwU+zcDsIazZ6XiKAlE8wJrCByXjXzeyHrs/ePmu+ZTE4b0raxxZHfokm Dwlw== X-Gm-Message-State: APjAAAWRlYIL5uhvO+gJDK+4d8zFybItUV53d9tRORIQkcNp4oFqcCC+ T+8xL78QiRGDTjRK8WdkUtKHGSBt X-Google-Smtp-Source: APXvYqwaWVgR5mh7Jf49qG4c2ZZ4T3Z/fZmUxf/xYv3YR7223DHKe1TfKaPhXVdJUOt7FFSw01h7vA== X-Received: by 2002:a50:9e6c:: with SMTP id z99mr30976338ede.298.1559593102011; Mon, 03 Jun 2019 13:18:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f9sm2766216ejt.18.2019.06.03.13.18.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 13:18:21 -0700 (PDT) Date: Mon, 03 Jun 2019 13:18:21 -0700 (PDT) X-Google-Original-Date: Mon, 03 Jun 2019 20:18:10 GMT Message-Id: <671cf092fd549486f668b9f0f353dd595c0e3afc.1559593097.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Jeff Hostetler via GitGitGadget" Subject: [PATCH 04/11] status: add status.aheadbehind setting Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Jeff Hostetler Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff Hostetler Add "status.aheadbehind" config setting to change the default behavior of ALL git status formats. Signed-off-by: Jeff Hostetler Signed-off-by: Derrick Stolee --- Documentation/config/status.txt | 5 +++++ builtin/commit.c | 17 ++++++++++++++++- t/t6040-tracking-info.sh | 31 +++++++++++++++++++++++++++++++ t/t7064-wtstatus-pv2.sh | 4 ++++ 4 files changed, 56 insertions(+), 1 deletion(-) diff --git a/Documentation/config/status.txt b/Documentation/config/status.txt index ed72fa7dae..0fc704ab80 100644 --- a/Documentation/config/status.txt +++ b/Documentation/config/status.txt @@ -12,6 +12,11 @@ status.branch:: Set to true to enable --branch by default in linkgit:git-status[1]. The option --no-branch takes precedence over this variable. +status.aheadBehind:: + Set to true to enable `--ahead-behind` and false to enable + `--no-ahead-behind` by default in linkgit:git-status[1] for + non-porcelain status formats. Defaults to true. + status.displayCommentPrefix:: If set to true, linkgit:git-status[1] will insert a comment prefix before each output line (starting with diff --git a/builtin/commit.c b/builtin/commit.c index 1c9e8e2228..71305073ad 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1078,9 +1078,11 @@ static const char *read_commit_message(const char *name) static struct status_deferred_config { enum wt_status_format status_format; int show_branch; + enum ahead_behind_flags ahead_behind; } status_deferred_config = { STATUS_FORMAT_UNSPECIFIED, - -1 /* unspecified */ + -1, /* unspecified */ + AHEAD_BEHIND_UNSPECIFIED, }; static void finalize_deferred_config(struct wt_status *s) @@ -1107,6 +1109,15 @@ static void finalize_deferred_config(struct wt_status *s) if (s->show_branch < 0) s->show_branch = 0; + /* + * If the user did not give a "--[no]-ahead-behind" command + * line argument, then we inherit the a/b config setting. + * If is not set, then we inherit _FULL for backwards + * compatibility. + */ + if (s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) + s->ahead_behind_flags = status_deferred_config.ahead_behind; + if (s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) s->ahead_behind_flags = AHEAD_BEHIND_FULL; } @@ -1246,6 +1257,10 @@ static int git_status_config(const char *k, const char *v, void *cb) status_deferred_config.show_branch = git_config_bool(k, v); return 0; } + if (!strcmp(k, "status.aheadbehind")) { + status_deferred_config.ahead_behind = git_config_bool(k, v); + return 0; + } if (!strcmp(k, "status.showstash")) { s->show_stash = git_config_bool(k, v); return 0; diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh index 716283b274..febf63f28a 100755 --- a/t/t6040-tracking-info.sh +++ b/t/t6040-tracking-info.sh @@ -159,6 +159,19 @@ test_expect_success 'status -s -b --no-ahead-behind (diverged from upstream)' ' test_i18ncmp expect actual ' +cat >expect <<\EOF +## b1...origin/master [different] +EOF + +test_expect_success 'status.aheadbehind=false status -s -b (diverged from upstream)' ' + ( + cd test && + git checkout b1 >/dev/null && + git -c status.aheadbehind=false status -s -b | head -1 + ) >actual && + test_i18ncmp expect actual +' + cat >expect <<\EOF On branch b1 Your branch and 'origin/master' have diverged, @@ -174,6 +187,15 @@ test_expect_success 'status --long --branch' ' test_i18ncmp expect actual ' +test_expect_success 'status --long --branch' ' + ( + cd test && + git checkout b1 >/dev/null && + git -c status.aheadbehind=true status --long -b | head -3 + ) >actual && + test_i18ncmp expect actual +' + cat >expect <<\EOF On branch b1 Your branch and 'origin/master' refer to different commits. @@ -188,6 +210,15 @@ test_expect_success 'status --long --branch --no-ahead-behind' ' test_i18ncmp expect actual ' +test_expect_success 'status.aheadbehind=false status --long --branch' ' + ( + cd test && + git checkout b1 >/dev/null && + git -c status.aheadbehind=false status --long -b | head -2 + ) >actual && + test_i18ncmp expect actual +' + cat >expect <<\EOF ## b5...brokenbase [gone] EOF diff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh index 11eccc231a..a0baf6e8b0 100755 --- a/t/t7064-wtstatus-pv2.sh +++ b/t/t7064-wtstatus-pv2.sh @@ -436,6 +436,10 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' ' git status --no-ahead-behind --porcelain=v2 --branch --untracked-files=all >actual && test_cmp expect actual && + # Confirmat that "status.aheadbehind" works on V2 format. + git -c status.aheadbehind=false status --porcelain=v2 --branch --untracked-files=all >actual && + test_cmp expect actual && + # Confirm --ahead-behind reports traditional branch.ab with 1/0. cat >expect <<-EOF && # branch.oid $HUF From patchwork Mon Jun 3 20:18:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 10973949 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 7E40014E5 for ; Mon, 3 Jun 2019 20:18:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E0BD2871F for ; Mon, 3 Jun 2019 20:18:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6271128733; Mon, 3 Jun 2019 20:18: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02FD7287BF for ; Mon, 3 Jun 2019 20:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726836AbfFCUS1 (ORCPT ); Mon, 3 Jun 2019 16:18:27 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40745 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbfFCUSY (ORCPT ); Mon, 3 Jun 2019 16:18:24 -0400 Received: by mail-ed1-f67.google.com with SMTP id r18so27588057edo.7 for ; Mon, 03 Jun 2019 13:18: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=HFC9/i6a4bKxfAGC539ovO2CdF/OPBkFYJfuCD6yPxc=; b=rQTdlX72Y6hdVEvY2a/OfnLI8RpugNT8nEePSCU6ObuKq/zuSlH3xGb8P2umbbt+qC Ciq5TFpQvUmnulm9M7GFFZCq1zPXsqgVP2icoJ2u6UQ84efHKXbInuNb6uiP3eCSXSU5 FbfMm5lMm+GCJWycN9wSm+qklVSzoQU4kOjvtdD1NfeoDbjLaVT+hKqoFhUrxBayCSCO XJiw97Q6C8rq5KusnMnK8rXIX+9uUFbEKjv6n1Kw9wCf3w9YQ70UXH/zwxWp3fTMKr1r aZrpYhvsG56LqijYYrD4HUUY32oIf2/wB/Z5zQNdAG29rb/kaC3n4Rkh4gzhLOamvLJa ICDg== 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=HFC9/i6a4bKxfAGC539ovO2CdF/OPBkFYJfuCD6yPxc=; b=Xo/mVR5fr2hK+dvOM/OUEIt4AOgYog/5Qpp3n6wkbXw2DY7Pxo8FB4b5UUji1Kp4en 5/IxYnsHrms53NYJraPkffFJBUKxU4Z4FSxGv1/hq/jpKd7aBAE7/qjXKH/X0fJ0rxES QhEPhU7wCb7AO/W+n+9Axc6EOQKACrgL7mcMFaxM/OSQEvlnGKTtZKEtQAoQpnSAm7T2 7+vUxmwO4DyqUNuky98cvhYi/GXqFvOdl3NSHnM3EqBKCAZFiwSvqvim1qak91/oim8q zlYTrgoxj2hBN++cHCQKajZRWtk15wUJeuuQaxznVBeXmO2sG++3N4elql9RdXZEzZUH pQmw== X-Gm-Message-State: APjAAAWit/b9BtjCpgBOJN7TyVe86Ai93pWBPF3YNHIA+tSTgNFT7TAC s5vrEEvu80Be0PEt72xq4y8plJAa X-Google-Smtp-Source: APXvYqz0cP3xOkbQ2xlR4kqllDn0LGl2XTn0ifCpA2dT1sUnL9GI3pKdhgVox0Ew+wXOzzNvp/RFAA== X-Received: by 2002:a50:b665:: with SMTP id c34mr32341112ede.148.1559593102723; Mon, 03 Jun 2019 13:18:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s16sm2750640eju.25.2019.06.03.13.18.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 13:18:22 -0700 (PDT) Date: Mon, 03 Jun 2019 13:18:22 -0700 (PDT) X-Google-Original-Date: Mon, 03 Jun 2019 20:18:11 GMT Message-Id: In-Reply-To: References: From: "Jeff Hostetler via GitGitGadget" Subject: [PATCH 05/11] status: add warning when a/b calculation takes too long for long/normal format Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Jeff Hostetler Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff Hostetler Signed-off-by: Jeff Hostetler Signed-off-by: Derrick Stolee --- advice.c | 2 ++ advice.h | 1 + wt-status.c | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/advice.c b/advice.c index ce5f374ecd..54f8dea30c 100644 --- a/advice.c +++ b/advice.c @@ -12,6 +12,7 @@ int advice_push_needs_force = 1; int advice_push_unqualified_ref_name = 1; int advice_status_hints = 1; int advice_status_u_option = 1; +int advice_status_ahead_behind_warning = 1; int advice_commit_before_merge = 1; int advice_reset_quiet_warning = 1; int advice_resolve_conflict = 1; @@ -68,6 +69,7 @@ static struct { { "pushUnqualifiedRefName", &advice_push_unqualified_ref_name }, { "statusHints", &advice_status_hints }, { "statusUoption", &advice_status_u_option }, + { "statusAheadBehindWarning", &advice_status_ahead_behind_warning }, { "commitBeforeMerge", &advice_commit_before_merge }, { "resetQuiet", &advice_reset_quiet_warning }, { "resolveConflict", &advice_resolve_conflict }, diff --git a/advice.h b/advice.h index e50f02cdfe..c86de9b9b8 100644 --- a/advice.h +++ b/advice.h @@ -12,6 +12,7 @@ extern int advice_push_needs_force; extern int advice_push_unqualified_ref_name; extern int advice_status_hints; extern int advice_status_u_option; +extern int advice_status_ahead_behind_warning; extern int advice_commit_before_merge; extern int advice_reset_quiet_warning; extern int advice_resolve_conflict; diff --git a/wt-status.c b/wt-status.c index d2a1bec226..c94d43879a 100644 --- a/wt-status.c +++ b/wt-status.c @@ -19,6 +19,8 @@ #include "lockfile.h" #include "sequencer.h" +#define AB_DELAY_WARNING_IN_MS (2 * 1000) + static const char cut_line[] = "------------------------ >8 ------------------------\n"; @@ -1085,14 +1087,29 @@ static void wt_longstatus_print_tracking(struct wt_status *s) struct branch *branch; char comment_line_string[3]; int i; + uint64_t t_begin = 0; assert(s->branch && !s->is_initial); if (!skip_prefix(s->branch, "refs/heads/", &branch_name)) return; branch = branch_get(branch_name); + + t_begin = getnanotime(); + if (!format_tracking_info(branch, &sb, s->ahead_behind_flags)) return; + if (advice_status_ahead_behind_warning && + s->ahead_behind_flags == AHEAD_BEHIND_FULL) { + uint64_t t_delta_in_ms = (getnanotime() - t_begin) / 1000000; + if (t_delta_in_ms > AB_DELAY_WARNING_IN_MS) { + strbuf_addf(&sb, _("\n" + "It took %.2f seconds to compute the branch ahead/behind values.\n" + "You can use '--no-ahead-behind' to avoid this.\n"), + t_delta_in_ms / 1000.0); + } + } + i = 0; if (s->display_comment_prefix) { comment_line_string[i++] = comment_line_char; From patchwork Mon Jun 3 20:18:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 10973963 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 C39A01515 for ; Mon, 3 Jun 2019 20:18:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B53DF27DA4 for ; Mon, 3 Jun 2019 20:18:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3CA9283A5; Mon, 3 Jun 2019 20:18:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51B252811E for ; Mon, 3 Jun 2019 20:18:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726816AbfFCUS0 (ORCPT ); Mon, 3 Jun 2019 16:18:26 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:35181 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726752AbfFCUSY (ORCPT ); Mon, 3 Jun 2019 16:18:24 -0400 Received: by mail-ed1-f66.google.com with SMTP id p26so28652064edr.2 for ; Mon, 03 Jun 2019 13:18: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=RJ1Ti10njS9BL/HuXiX+d0N7jKi7cBIA9Od8GnBBr8I=; b=nxVm8ViRwyy+nniBqWUIwR0HIHFAqTxgY9I5r7w6RpIfCcPgKKVBwzTKB/64oRfnJR XYqljqG7ggD1O7IeiqBKCAKtxt0eMT7TpcSDigN2PmvHYT60XBJIbjpBBIBjRi18v48z 9GWInI2btnJrQ9EDW+ne1WaAtMoAWhxxUBkCmQT4uIxrS+VwTWdFWU5oNXHvMuDFlxgx gTPDwip6kPziL7EPq3PgF9YabLFHkC665v31vTNw+HO2nD8DJy0iueyQ+WWHX2ceGDln 1mY8BK83Q4OZ38P+Q//1Eydf1Vh7kC9zGtj15AJ5ZtnReDMdbibctAEUaoxXw0FPaiuI Z0Cw== 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=RJ1Ti10njS9BL/HuXiX+d0N7jKi7cBIA9Od8GnBBr8I=; b=uYSUeqestGY97GbonpvoRy0/dQB8uBvh+ni0YpSDEdOzmBvwMHlB6QtR52pTFFB0br wT4CQnIGm5fVCI8ZX6HrarHCu+QmtC6rfioIBaIBkYrmk+ju8T2SY6APU5SZCc9rUZnO M/Ph0HQ7fjnYAOlGYrc29/uslREwLAuetAGJzx2C2qWNC31VOkxA4ZnZgqY5lCsg5dVu cRGCbmV1fs9N4ShHspMaKoFaZBFe75LRrFnvoXrFEyLVNdDdVY4M3vivHqDOnKWnOSGS y+VUQZjtHfeEaoCrFjPAIBfLvxaihy8eo/CBDEcoVhB/tYRNGNFlZfgXdg5Q6NhlZEHc hysQ== X-Gm-Message-State: APjAAAXrC9mEMmPS9frT4YvHt/Q3kjbFqe85bwx/F9Y71iJ3FNJjBtfD vUN/Ifhw3i1Q+eGZa3Mhj86Gl5GJ X-Google-Smtp-Source: APXvYqxaV65h965yIB/7i59fxT6tXqpCY75bn7D+f9q0+rq4bi4ZKKcYghWS9GjOG3UfXEdCHEW6Cw== X-Received: by 2002:a17:906:d7ab:: with SMTP id pk11mr6284367ejb.216.1559593103434; Mon, 03 Jun 2019 13:18:23 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id q22sm4163576eds.66.2019.06.03.13.18.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 13:18:23 -0700 (PDT) Date: Mon, 03 Jun 2019 13:18:23 -0700 (PDT) X-Google-Original-Date: Mon, 03 Jun 2019 20:18:12 GMT Message-Id: <82ae00e49571f2621769c3cea07f806b89142efb.1559593097.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Jeff Hostetler via GitGitGadget" Subject: [PATCH 06/11] status: ignore status.aheadbehind in porcelain formats Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Jeff Hostetler Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff Hostetler Teach porcelain V[12] formats to ignore the status.aheadbehind config setting. They only respect the --[no-]ahead-behind command line argument. This is for backwards compatibility with existing scripts. Signed-off-by: Jeff Hostetler Signed-off-by: Derrick Stolee --- builtin/commit.c | 10 ++++++---- t/t7064-wtstatus-pv2.sh | 12 ++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/builtin/commit.c b/builtin/commit.c index 71305073ad..79cb238d87 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1111,11 +1111,13 @@ static void finalize_deferred_config(struct wt_status *s) /* * If the user did not give a "--[no]-ahead-behind" command - * line argument, then we inherit the a/b config setting. - * If is not set, then we inherit _FULL for backwards - * compatibility. + * line argument *AND* we will print in a human-readable format + * (short, long etc.) then we inherit from the status.aheadbehind + * config setting. In all other cases (and porcelain V[12] formats + * in particular), we inherit _FULL for backwards compatibility. */ - if (s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) + if (use_deferred_config && + s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) s->ahead_behind_flags = status_deferred_config.ahead_behind; if (s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) diff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh index a0baf6e8b0..537787e598 100755 --- a/t/t7064-wtstatus-pv2.sh +++ b/t/t7064-wtstatus-pv2.sh @@ -436,10 +436,6 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' ' git status --no-ahead-behind --porcelain=v2 --branch --untracked-files=all >actual && test_cmp expect actual && - # Confirmat that "status.aheadbehind" works on V2 format. - git -c status.aheadbehind=false status --porcelain=v2 --branch --untracked-files=all >actual && - test_cmp expect actual && - # Confirm --ahead-behind reports traditional branch.ab with 1/0. cat >expect <<-EOF && # branch.oid $HUF @@ -449,6 +445,14 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' ' EOF git status --ahead-behind --porcelain=v2 --branch --untracked-files=all >actual && + test_cmp expect actual && + + # Confirm that "status.aheadbehind" DOES NOT work on V2 format. + git -c status.aheadbehind=false status --porcelain=v2 --branch --untracked-files=all >actual && + test_cmp expect actual && + + # Confirm that "status.aheadbehind" DOES NOT work on V2 format. + git -c status.aheadbehind=true status --porcelain=v2 --branch --untracked-files=all >actual && test_cmp expect actual ) ' From patchwork Mon Jun 3 20:18:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 10973953 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 9C6521515 for ; Mon, 3 Jun 2019 20:18:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CD7628068 for ; Mon, 3 Jun 2019 20:18:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80B182874B; Mon, 3 Jun 2019 20:18: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06FB128068 for ; Mon, 3 Jun 2019 20:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726840AbfFCUS1 (ORCPT ); Mon, 3 Jun 2019 16:18:27 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:44201 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbfFCUS0 (ORCPT ); Mon, 3 Jun 2019 16:18:26 -0400 Received: by mail-ed1-f68.google.com with SMTP id b8so28575655edm.11 for ; Mon, 03 Jun 2019 13:18: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=ERzgBFMryQ9pX1KTeFZQbZ6xFwBz7r66RQsT/2tpUOY=; b=Qr6ZRKVThmcdY+39LlhaLcVIPrGur1tpL45KsI/qTZSbE+UCh7i5tPUm+1siNnIAeZ 6ScGivXpzb2VcQBUxix1kJrN8Cu2/T9+k7mhHTxoNEzCTtFlP48WsIguljW/EzAcew8I CqkjzPYbNqQzfiSfYjhh71fwTz1Ezz1hi8hZu+OSAn1m5Y0pGWTbYA4YueCFtiNDH15F vZNCo2vmWgQQKWNeqzhOHWNBzntwkvxWyACBR4BhOQqCe1iRVPKKUZr0QqSxNMct3zgV adtJ08Qk8e26GaVGVPkXalBZCqvKF6eVWlHI+iaye2wOWLkVdYf74P1H+fjZG1cKAdNY +jNw== 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=ERzgBFMryQ9pX1KTeFZQbZ6xFwBz7r66RQsT/2tpUOY=; b=iqO4nNaxT8DqiRtbUcfMiVXxuiCyjsYCO2olZiGxmQHe2ewcJ9IVKH8Rc0Eym/5igq jdCszcnTemKULwHnbuG2OiMXN0OyKN7cy3D2VPSx6tCCPLd/dAYr1PFD3PEgpU1PkpEP dxSXkuP1HNNVbFR+ndTs1Ddi0u3k3D3Wyb5ZQXmG9wClZFcYUj3NpI4X5leUm2jxqhde J6tUoqnc/vBNLhUOoICu+vfTbn8xwhqr+bbfqV5TakzD127PzlVV1I8qGa6W54ujXr45 4rguv5ZVw4ncX2f1qQVDWpGVS2uXHMuNzh310tsUdTAPSH56KFRUtxpn3t9+NbX7PXUW aDrA== X-Gm-Message-State: APjAAAXAl2XDtkOL1b/x6SuNaCPK8+OUL0S/P1gu2vFm+Lt2P3L2Jbgx fHZgltSmbeEJvyNXbVsPhIk9ru32 X-Google-Smtp-Source: APXvYqwN/JxNuxboLSOFIZUSClSvdrM1hKzqwp8RnOw2nmeD7EwudhsRPZ5c7b0k+SvHhi+1/5xAjA== X-Received: by 2002:a17:906:d8bb:: with SMTP id qc27mr25495150ejb.206.1559593104138; Mon, 03 Jun 2019 13:18:24 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id r14sm2758132eja.77.2019.06.03.13.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 13:18:23 -0700 (PDT) Date: Mon, 03 Jun 2019 13:18:23 -0700 (PDT) X-Google-Original-Date: Mon, 03 Jun 2019 20:18:13 GMT Message-Id: <936fae31b712f5cce52258619b07d35356903bc6.1559593097.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 07/11] repo-settings: status.aheadBehind=false Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: 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 active developers, the commit history can grow very quickly. This can lead remote branches from being very far from their local copies. Set stats.aheadBehind=false by default when core.size=large, so all 'git status' calls have an implied '--no-ahead-behind' argument. Signed-off-by: Derrick Stolee --- Documentation/config/core.txt | 3 +++ Documentation/config/status.txt | 3 ++- builtin/commit.c | 12 ++++++------ repo-settings.c | 6 ++++++ repo-settings.h | 1 + 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index df357f5af5..6bed956a08 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -620,3 +620,6 @@ core.size:: * `pack.useSparse=true` uses the sparse tree-walk algorithm, which is optimized for enumerating objects during linkgit:git-push[1] from a client machine. ++ +* `status.aheadBehind=false` enables `--no-ahead-behind` by default during +linkgit:git-status[1] calls, saving time in a fast-moving commit history. diff --git a/Documentation/config/status.txt b/Documentation/config/status.txt index 0fc704ab80..3e39019810 100644 --- a/Documentation/config/status.txt +++ b/Documentation/config/status.txt @@ -15,7 +15,8 @@ status.branch:: status.aheadBehind:: Set to true to enable `--ahead-behind` and false to enable `--no-ahead-behind` by default in linkgit:git-status[1] for - non-porcelain status formats. Defaults to true. + non-porcelain status formats. Defaults to true, unless + `core.size=large`. status.displayCommentPrefix:: If set to true, linkgit:git-status[1] will insert a comment diff --git a/builtin/commit.c b/builtin/commit.c index 79cb238d87..246a802167 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -36,6 +36,7 @@ #include "help.h" #include "commit-reach.h" #include "commit-graph.h" +#include "repo-settings.h" static const char * const builtin_commit_usage[] = { N_("git commit [] [--] ..."), @@ -1117,8 +1118,11 @@ static void finalize_deferred_config(struct wt_status *s) * in particular), we inherit _FULL for backwards compatibility. */ if (use_deferred_config && - s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) - s->ahead_behind_flags = status_deferred_config.ahead_behind; + s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) { + prepare_repo_settings(the_repository); + if (the_repository->settings->status_ahead_behind != -1) + s->ahead_behind_flags = the_repository->settings->status_ahead_behind; + } if (s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) s->ahead_behind_flags = AHEAD_BEHIND_FULL; @@ -1259,10 +1263,6 @@ static int git_status_config(const char *k, const char *v, void *cb) status_deferred_config.show_branch = git_config_bool(k, v); return 0; } - if (!strcmp(k, "status.aheadbehind")) { - status_deferred_config.ahead_behind = git_config_bool(k, v); - return 0; - } if (!strcmp(k, "status.showstash")) { s->show_stash = git_config_bool(k, v); return 0; diff --git a/repo-settings.c b/repo-settings.c index 026ab9c1a0..b3d4b50b72 100644 --- a/repo-settings.c +++ b/repo-settings.c @@ -15,6 +15,7 @@ static int git_repo_config(const char *key, const char *value, void *cb) UPDATE_DEFAULT(rs->core_commit_graph, 1); UPDATE_DEFAULT(rs->gc_write_commit_graph, 1); UPDATE_DEFAULT(rs->pack_use_sparse, 1); + UPDATE_DEFAULT(rs->status_ahead_behind, 1); UPDATE_DEFAULT(rs->index_version, 4); } return 0; @@ -31,6 +32,10 @@ static int git_repo_config(const char *key, const char *value, void *cb) rs->pack_use_sparse = git_config_bool(key, value); return 0; } + if (!strcmp(key, "status.aheadbehind")) { + rs->status_ahead_behind = git_config_bool(key, value); + return 0; + } if (!strcmp(key, "index.version")) { rs->index_version = git_config_int(key, value); return 0; @@ -50,6 +55,7 @@ void prepare_repo_settings(struct repository *r) r->settings->core_commit_graph = -1; r->settings->gc_write_commit_graph = -1; r->settings->pack_use_sparse = -1; + r->settings->status_ahead_behind = -1; r->settings->index_version = -1; repo_config(r, git_repo_config, r->settings); diff --git a/repo-settings.h b/repo-settings.h index b50228f992..cc358a083a 100644 --- a/repo-settings.h +++ b/repo-settings.h @@ -5,6 +5,7 @@ struct repo_settings { char core_commit_graph; char gc_write_commit_graph; char pack_use_sparse; + char status_ahead_behind; int index_version; }; From patchwork Mon Jun 3 20:18:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 10973959 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 F2BAF14E5 for ; Mon, 3 Jun 2019 20:18:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3B6E204C3 for ; Mon, 3 Jun 2019 20:18:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5B6B283A5; Mon, 3 Jun 2019 20:18: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49E17204C3 for ; Mon, 3 Jun 2019 20:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726849AbfFCUSc (ORCPT ); Mon, 3 Jun 2019 16:18:32 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:41485 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbfFCUS1 (ORCPT ); Mon, 3 Jun 2019 16:18:27 -0400 Received: by mail-ed1-f68.google.com with SMTP id x25so16405118eds.8 for ; Mon, 03 Jun 2019 13:18: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=YcWbENHNK+UUS7XO+IiRNvSefnYhAhkhMgBW7SKeNvE=; b=i+OVPUgVA9Aq8Bd+5JbxnPlqQiTxAzHOiuuTj9s+z7Ct5/8gga5nG5hHSvLaXCVyxB T3Gan6U0JRys4iYy+iD2LZqpPbJM39gVB5RbLmwz0rX+TvKzdBzVhWX//EzTAEUs/pWI gVv/rMmjxc+eZaGEOQfqaKXWTD+cB+0xGjZ3vdK+1mcqtxy+sPeqw8JwgvJzj78ZXk6n p5tfSFV7jPvUy4D9k+lOQ8OkYhcNl8ZJcd+2SIA++IdVk+RcCR26RMP/CC5H6oKM8T59 usc+izJDgNvnzmG2rX3k074lUwkCwqk9p4uewiLmCX7fI47qUDA6F+Lm5W2a0VX3L1RA Hqtw== 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=YcWbENHNK+UUS7XO+IiRNvSefnYhAhkhMgBW7SKeNvE=; b=mOZD7uFUYcJcUM6tE5K8R//6abC7Om+vOkY0zob6sa6id3/hb2LH8ZDZBx0BjP6x60 5PUULUUlpKhaxrqV0LUwSPqbgvpOEBi3h1RBhafkGOWTjv+z1ShISPeQ/FalqsFHZZf3 apyaj8ukLka+zjzEu09p+CDsE2Jhtv2GSWGELmW/XOL6f2qKa+WLHvIemdvT/sjG5E18 Y5Dl/674v8iWHjfOd8vd+dkY01/JUQgTTY5ffnECUI0paKICfFkuAtoYQQWqroEfNbEL bxLj6cXM+iemqp/0hBII9bHTXIX/MBCjjz/NsD10KDJSfMAamZsRrQbmpxlpRFdZk2U6 UQsg== X-Gm-Message-State: APjAAAUIsWOfCCVCRtq2qUhREvV93ItyNeyGoTzCH00K3E8RGjix3aW/ EyXfOPui7DNl4k3oxcYz1kf6scEK X-Google-Smtp-Source: APXvYqxGN73QQ65fvS6eKfgLhqGWod1tCRbQx7FQMz6Q+ivZTykXA5fLNq5vpqu24KCfjIB4Fi+BGw== X-Received: by 2002:a50:86dc:: with SMTP id 28mr3542278edu.132.1559593104896; Mon, 03 Jun 2019 13:18:24 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g23sm2485266edp.29.2019.06.03.13.18.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2019 13:18:24 -0700 (PDT) Date: Mon, 03 Jun 2019 13:18:24 -0700 (PDT) X-Google-Original-Date: Mon, 03 Jun 2019 20:18:14 GMT Message-Id: <2d6bf8513d928765d7411a28c526d9c77237b3fe.1559593097.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Subject: [PATCH 08/11] fetch: add --[no-]show-forced-updates argument Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: 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 After updating a set of remove refs during a 'git fetch', we walk the commits in the new ref value and not in the old ref value to discover if the update was a forced update. This results in two things happening during the command: 1. The line including the ref update has an additional "(forced-update)" marker at the end. 2. The ref log for that remote branch includes a bit saying that update is a forced update. For many situations, this forced-update message happens infrequently, or is a small bit of information among many ref updates. Many users ignore these messages, but the calculation required here slows down their fetches significantly. Keep in mind that they do not have the opportunity to calculate a commit-graph file containing the newly-fetched commits, so these comparisons can be very slow. Add a '--[no-]show-forced-updates' option that allows a user to skip this calculation. The only permanent result is dropping the forced-update bit in the reflog. Include a new fetch.showForcedUpdates config setting that allows this behavior without including the argument in every command. The config setting is overridden by the command-line arguments. Signed-off-by: Derrick Stolee --- Documentation/config/fetch.txt | 5 +++++ Documentation/fetch-options.txt | 13 +++++++++++++ builtin/fetch.c | 11 ++++++++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Documentation/config/fetch.txt b/Documentation/config/fetch.txt index cbfad6cdbb..ba890b5884 100644 --- a/Documentation/config/fetch.txt +++ b/Documentation/config/fetch.txt @@ -63,3 +63,8 @@ fetch.negotiationAlgorithm:: Unknown values will cause 'git fetch' to error out. + See also the `--negotiation-tip` option for linkgit:git-fetch[1]. + +fetch.showForcedUpdates:: + Set to false to enable `--no-show-forced-updates` in + linkgit:git-fetch[1] and linkgit:git-pull[1] commands. + Defaults to true. diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt index 91c47752ec..5801d23ae4 100644 --- a/Documentation/fetch-options.txt +++ b/Documentation/fetch-options.txt @@ -221,6 +221,19 @@ endif::git-pull[] When multiple `--server-option=