From 3c7c41d6b7ee4c4576490a3b6cfefe4d59d24172 Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Mon, 8 Dec 2025 17:48:56 -0800 Subject: [PATCH 1/8] object: apply skip_hash and discard_tree optimizations to unknown blobs too parse_object_with_flags() has an optimization to skip parsing blobs if PARSE_OBJECT_SKIP_HASH_CHECK is set and the object hasn't been seen before or might be a blob but hasn't been parsed yet. The latter can happen, for example, if add_tree_entries() walks a path that references a blob object that hasn't been seen before: lookup_blob() marks the referenced oid as being a blob, but does not provide any additional information about it until it is parsed. It's possible for an object to be created without even a type, such as when prepare_revision_walk() uses mark_uninteresting() to mark all promisor objects as uninteresting. These objects have obj->parsed == false and obj->type == OBJ_NONE. The skip_hash optimization does not consider this kind of object, so parse_object_with_flags() proceeds to fully parse the object to determine its type. Improve the optimization by applying it to OBJ_NONE objects as well as OBJ_BLOB ones. Apply a similar fix for trees. Fixes: 8db2dad7a045 ("parse_object(): check on-disk type of suspected blob") Signed-off-by: Aaron Plattner Signed-off-by: Junio C Hamano --- object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/object.c b/object.c index b08fc7a163ae69..4669b8d65e74ab 100644 --- a/object.c +++ b/object.c @@ -328,7 +328,7 @@ struct object *parse_object_with_flags(struct repository *r, return &commit->object; } - if ((!obj || obj->type == OBJ_BLOB) && + if ((!obj || obj->type == OBJ_NONE || obj->type == OBJ_BLOB) && odb_read_object_info(r->objects, oid, NULL) == OBJ_BLOB) { if (!skip_hash && stream_object_signature(r, repl) < 0) { error(_("hash mismatch %s"), oid_to_hex(oid)); @@ -344,7 +344,7 @@ struct object *parse_object_with_flags(struct repository *r, * have the on-disk object with the correct type. */ if (skip_hash && discard_tree && - (!obj || obj->type == OBJ_TREE) && + (!obj || obj->type == OBJ_NONE || obj->type == OBJ_TREE) && odb_read_object_info(r->objects, oid, NULL) == OBJ_TREE) { return &lookup_tree(r, oid)->object; } From 3f5d1749e7eb8ab745b348aa138564b809957d3d Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Mon, 8 Dec 2025 17:48:57 -0800 Subject: [PATCH 2/8] packfile: skip hash checks in add_promisor_object() When is_promisor_object() is called for the first time, it lazily initializes a set of all promisor objects by iterating through all objects in promisor packs. For each object, add_promisor_object() calls parse_object(), which decompresses and hashes the entire object. For repositories with large pack files, this can take an extremely long time. For example, on a production repository with a 176 GB promisor pack: $ time ~/git/git/git-rev-list --objects --all --exclude-promisor-objects --quiet ________________________________________________________ Executed in 76.10 mins fish external usr time 72.10 mins 1.83 millis 72.10 mins sys time 3.56 mins 0.17 millis 3.56 mins add_promisor_object() just wants to construct the set of all promisor objects, so it doesn't really need to verify the hash of every object. Set PARSE_OBJECT_SKIP_HASH_CHECK to skip the hash check. This has the side effect of skipping decompression of blob objects completely, saving a significant amount of time: $ time ~/git/git/git-rev-list --objects --all --exclude-promisor-objects --quiet ________________________________________________________ Executed in 124.70 secs fish external usr time 46.94 secs 0.00 millis 46.94 secs sys time 43.11 secs 1.03 millis 43.11 secs Signed-off-by: Aaron Plattner Signed-off-by: Junio C Hamano --- packfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packfile.c b/packfile.c index 9cc11b6dc56225..01b992a4e12f89 100644 --- a/packfile.c +++ b/packfile.c @@ -2310,7 +2310,8 @@ static int add_promisor_object(const struct object_id *oid, we_parsed_object = 0; } else { we_parsed_object = 1; - obj = parse_object(pack->repo, oid); + obj = parse_object_with_flags(pack->repo, oid, + PARSE_OBJECT_SKIP_HASH_CHECK); } if (!obj) From 4d75f2aea776f434b51481ae65233d6012da1a66 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 12 Dec 2025 21:54:14 +0900 Subject: [PATCH 3/8] FLEX_ARRAY: require platforms to support the C99 syntax Before C99 syntax to express that the final member in a struct is an array of unknown number of elements, i.e., struct { ... T flexible_array[]; }; came along, GNU introduced their own extension to declare such a member with 0 size, i.e., T flexible_array[0]; and the compilers that did not understand even that were given a way to emulate it by wasting one element, i.e., T flexible_array[1]; As we are using more and more C99 language features, let's see if the platforms that still need to resort to the historical forms of flexible array member support are still there, by forcing all the flex array definitions to use the C99 syntax and see if anybody screams (in which case reverting the changes is rather easy). Signed-off-by: Junio C Hamano --- git-compat-util.h | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index 398e0fac4fab60..8010397bdb5b80 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -38,37 +38,8 @@ struct strbuf; DISABLE_WARNING(-Wsign-compare) #endif -#ifndef FLEX_ARRAY -/* - * See if our compiler is known to support flexible array members. - */ - -/* - * Check vendor specific quirks first, before checking the - * __STDC_VERSION__, as vendor compilers can lie and we need to be - * able to work them around. Note that by not defining FLEX_ARRAY - * here, we can fall back to use the "safer but a bit wasteful" one - * later. - */ -#if defined(__SUNPRO_C) && (__SUNPRO_C <= 0x580) -#elif defined(__GNUC__) -# if (__GNUC__ >= 3) -# define FLEX_ARRAY /* empty */ -# else -# define FLEX_ARRAY 0 /* older GNU extension */ -# endif -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -# define FLEX_ARRAY /* empty */ -#endif - -/* - * Otherwise, default to safer but a bit wasteful traditional style - */ -#ifndef FLEX_ARRAY -# define FLEX_ARRAY 1 -#endif -#endif - +#undef FLEX_ARRAY +#define FLEX_ARRAY /* empty - weather balloon to require C99 FAM */ /* * BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression. From 1129780f6ab19f0a295c0b436890c510f71024f4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 17 Dec 2025 03:54:15 +0900 Subject: [PATCH 4/8] commit: document that $command.signoff will not be added Every now and then we see this coming up on the list. Let's help new contributors who are not aware of past discussions by clearly documenting our past consensus. Helped-by: brian m. carlson Helped-by: Elijah Newren Helped-by: Johannes Sixt Signed-off-by: Junio C Hamano --- Documentation/gitfaq.adoc | 19 +++++++++++++++++++ Documentation/signoff-option.adoc | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/Documentation/gitfaq.adoc b/Documentation/gitfaq.adoc index f2917d142c3630..8d3647d359423b 100644 --- a/Documentation/gitfaq.adoc +++ b/Documentation/gitfaq.adoc @@ -83,6 +83,25 @@ Windows would be the configuration `"C:\Program Files\Vim\gvim.exe" --nofork`, which quotes the filename with spaces and specifies the `--nofork` option to avoid backgrounding the process. +[[sign-off]] +Why not have `commit.signoff` and other configuration variables?:: + Git intentionally does not (and will not) provide a + configuration variable, such as `commit.signoff`, to + automatically add `--signoff` by default. The reason is to + protect the legal and intentional significance of a sign-off. + If there were more automated and widely publicized ways for + sign-offs to be appended, it would become easier for someone + to argue later that a "Signed-off-by" trailer was just added + out of habit or by automation, without the committer's full + awareness or intent to certify their agreement with the + Developer Certificate of Origin (DCO) or a similar statement. + This could undermine the sign-off’s credibility in legal or + contractual situations. ++ +There exists `format.signoff`, but that is a historical mistake, and +it is not an excuse to add more mistakes of the same kind on top. + + Credentials ----------- diff --git a/Documentation/signoff-option.adoc b/Documentation/signoff-option.adoc index cddfb225d1d62a..9a80d60f1bb1b8 100644 --- a/Documentation/signoff-option.adoc +++ b/Documentation/signoff-option.adoc @@ -16,3 +16,7 @@ endif::git-commit[] + The `--no-signoff` option can be used to countermand an earlier `--signoff` option on the command line. ++ +Git does not (and will not) have a configuration variable to enable +the `--signoff` command line option by default; see the +`commit.signoff` entry in the gitfaq for more details. From a0c813951afc4bbf5978e67201bccd8d20e9b36b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 19 Dec 2025 21:51:01 +0900 Subject: [PATCH 5/8] signoff-option: linkify the reference to gitfaq The GitFAQ is a proper manual page in the section 7, so refer to it using the usual linkgit:stuff[7] syntax. Helped-by: Kristoffer Haugsbakk Signed-off-by: Junio C Hamano --- Documentation/signoff-option.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/signoff-option.adoc b/Documentation/signoff-option.adoc index 9a80d60f1bb1b8..6fc27692573688 100644 --- a/Documentation/signoff-option.adoc +++ b/Documentation/signoff-option.adoc @@ -19,4 +19,4 @@ option on the command line. + Git does not (and will not) have a configuration variable to enable the `--signoff` command line option by default; see the -`commit.signoff` entry in the gitfaq for more details. +`commit.signoff` entry in linkgit:gitfaq[7] for more details. From b2ff85e12c9b8c9997ac22d2c1e49c5aa9660abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= Date: Fri, 19 Dec 2025 18:54:15 +0000 Subject: [PATCH 6/8] doc: fix asciidoc markup issues in several files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix incorrect use of backticks for markup in git-checkout.adoc, git-worktree.adoc * switch tabs to spaces in git-send-email.adoc list items Signed-off-by: Jean-Noël Avila Signed-off-by: Junio C Hamano --- Documentation/git-checkout.adoc | 2 +- Documentation/git-send-email.adoc | 14 +++++++------- Documentation/git-worktree.adoc | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Documentation/git-checkout.adoc b/Documentation/git-checkout.adoc index 6f281b298efac1..43ccf47cf6de28 100644 --- a/Documentation/git-checkout.adoc +++ b/Documentation/git-checkout.adoc @@ -509,7 +509,7 @@ ARGUMENT DISAMBIGUATION ----------------------- When you run `git checkout `, Git tries to guess whether -`` is intended to be a branch, a commit, or a set of file(s), +__ is intended to be a branch, a commit, or a set of file(s), and then either switches to that branch or commit, or restores the specified files. diff --git a/Documentation/git-send-email.adoc b/Documentation/git-send-email.adoc index 263b977353f334..caf9d693a33f4a 100644 --- a/Documentation/git-send-email.adoc +++ b/Documentation/git-send-email.adoc @@ -277,7 +277,7 @@ must be used for each option. --smtp-ssl:: Legacy alias for `--smtp-encryption ssl`. ---smtp-ssl-cert-path:: +--smtp-ssl-cert-path :: Path to a store of trusted CA certificates for SMTP SSL/TLS certificate validation (either a directory that has been processed by `c_rehash`, or a single file containing one or more PEM format @@ -510,12 +510,12 @@ have been specified, in which case default to `compose`. Currently, validation means the following: + -- - * Invoke the sendemail-validate hook if present (see linkgit:githooks[5]). - * Warn of patches that contain lines longer than - 998 characters unless a suitable transfer encoding - (`auto`, `base64`, or `quoted-printable`) is used; - this is due to SMTP limits as described by - https://www.ietf.org/rfc/rfc5322.txt. +* Invoke the sendemail-validate hook if present (see linkgit:githooks[5]). +* Warn of patches that contain lines longer than + 998 characters unless a suitable transfer encoding + (`auto`, `base64`, or `quoted-printable`) is used; + this is due to SMTP limits as described by + https://www.ietf.org/rfc/rfc5322.txt. -- + Default is the value of `sendemail.validate`; if this is not set, diff --git a/Documentation/git-worktree.adoc b/Documentation/git-worktree.adoc index f272f797837f45..d74ad7b0e9bd75 100644 --- a/Documentation/git-worktree.adoc +++ b/Documentation/git-worktree.adoc @@ -104,7 +104,7 @@ associated with a new unborn branch named __ (after passed to the command. In the event the repository has a remote and `--guess-remote` is used, but no remote or local branches exist, then the command fails with a warning reminding the user to fetch from their remote -first (or override by using `-f/--force`). +first (or override by using `-f`/`--force`). `list`:: From 8ee262985a1197970cc8938a2fb5c70817d213ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= Date: Fri, 19 Dec 2025 18:54:16 +0000 Subject: [PATCH 7/8] doc: correct minor wording issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * use imperative mood for consistency in options descriptions * add missing parenthesis * reword verbose phrase in git-repack.adoc Signed-off-by: Jean-Noël Avila Signed-off-by: Junio C Hamano --- Documentation/git-rebase.adoc | 2 +- Documentation/git-repack.adoc | 6 +++--- Documentation/git-send-email.adoc | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/git-rebase.adoc b/Documentation/git-rebase.adoc index 005caf61646ec7..ecc347680c3d63 100644 --- a/Documentation/git-rebase.adoc +++ b/Documentation/git-rebase.adoc @@ -87,7 +87,7 @@ of the to-be-rebased branch. However, `ORIG_HEAD` is not guaranteed to still point to that commit at the end of the rebase if other commands that change `ORIG_HEAD` (like `git reset`) are used during the rebase. The previous branch tip, however, is accessible using the reflog of the current branch (i.e. `@{1}`, -see linkgit:gitrevisions[7]. +see linkgit:gitrevisions[7]). TRANSPLANTING A TOPIC BRANCH WITH --ONTO ---------------------------------------- diff --git a/Documentation/git-repack.adoc b/Documentation/git-repack.adoc index d12c4985f61c06..673ce91083720d 100644 --- a/Documentation/git-repack.adoc +++ b/Documentation/git-repack.adoc @@ -77,14 +77,14 @@ to the new separate pack will be written. Only useful with `--cruft -d`. --max-cruft-size=:: - Overrides `--max-pack-size` for cruft packs. Inherits the value of + Override `--max-pack-size` for cruft packs. Inherits the value of `--max-pack-size` (if any) by default. See the documentation for `--max-pack-size` for more details. --combine-cruft-below-size=:: When generating cruft packs without pruning, only repack - existing cruft packs whose size is strictly less than ``, - where `` represents a number of bytes, which can optionally + existing cruft packs whose size is strictly less than `` + bytes, which can optionally be suffixed with "k", "m", or "g". Cruft packs whose size is greater than or equal to `` are left as-is and not repacked. Useful when you want to avoid repacking large cruft pack(s) in diff --git a/Documentation/git-send-email.adoc b/Documentation/git-send-email.adoc index caf9d693a33f4a..cdaf421cda9ca9 100644 --- a/Documentation/git-send-email.adoc +++ b/Documentation/git-send-email.adoc @@ -208,7 +208,7 @@ Sending for your own case. Default is the value of `sendemail.smtpEncryption`. --smtp-domain=:: - Specifies the Fully Qualified Domain Name (FQDN) used in the + Specify the Fully Qualified Domain Name (FQDN) used in the HELO/EHLO command to the SMTP server. Some servers require the FQDN to match your IP address. If not set, `git send-email` attempts to determine your FQDN automatically. Default is the value of @@ -245,7 +245,7 @@ a password is obtained using linkgit:git-credential[1]. Disable SMTP authentication. Short hand for `--smtp-auth=none`. --smtp-server=:: - If set, specifies the outgoing SMTP server to use (e.g. + Specify the outgoing SMTP server to use (e.g. `smtp.example.com` or a raw IP address). If unspecified, and if `--sendmail-cmd` is also unspecified, the default is to search for `sendmail` in `/usr/sbin`, `/usr/lib` and `$PATH` if such a @@ -258,7 +258,7 @@ command names. For those use cases, consider using `--sendmail-cmd` instead. --smtp-server-port=:: - Specifies a port different from the default port (SMTP + Specify a port different from the default port (SMTP servers typically listen to smtp port 25, but may also listen to submission port 587, or the common SSL smtp port 465); symbolic port names (e.g. `submission` instead of 587) @@ -266,7 +266,7 @@ instead. `sendemail.smtpServerPort` configuration variable. --smtp-server-option=