From efb61591ee482fd9ec0ebabffef1bed5b71fdfab Mon Sep 17 00:00:00 2001 From: Jan Mazur Date: Wed, 4 Jun 2025 17:11:21 +0000 Subject: [PATCH 01/10] bundle-uri: send debug output to given FILE * stream d796cedb (bundle-uri: unit test "key=value" parsing, 2022-10-12) introduced the print_bundle_list() function, which takes a "FILE *fp" to write the output to. Later with c93c3d2f (bundle-uri: parse bundle.heuristic=creationToken, 2023-01-31) the function started showing additional information, which is always written to the standard output stream. It does not look like a deliberate decision to do so, and it does not hurt, as all callers of the function passes stdout to it. We could change the function not to take fp and always write to the standard output to simplify, but let's use the FILE *fp provided by the caller consistently to write out output. Signed-off-by: Jan Mazur Signed-off-by: Junio C Hamano --- bundle-uri.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle-uri.c b/bundle-uri.c index 8a3c39ce572b6c..72e70c51fdd1db 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -115,7 +115,7 @@ void print_bundle_list(FILE *fp, struct bundle_list *list) int i; for (i = 0; i < BUNDLE_HEURISTIC__COUNT; i++) { if (heuristics[i].heuristic == list->heuristic) { - printf("\theuristic = %s\n", + fprintf(fp, "\theuristic = %s\n", heuristics[list->heuristic].name); break; } From 61372dd613b1715af439a02129ea08a2c30e212e Mon Sep 17 00:00:00 2001 From: Lidong Yan <502024330056@smail.nju.edu.cn> Date: Thu, 5 Jun 2025 06:27:26 +0000 Subject: [PATCH 02/10] repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode () pretty.c:repo_logmsg_reencode() allocated memory should be freed with repo_unuse_commit_buffer(). Callers sometimes forgot free it at exit point. Add `repo_unuse_commit_buffer()` in insert_records_from_trailers at builtin/shortlog.c and create_commit at builtin/replay.c Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano --- builtin/replay.c | 1 + builtin/shortlog.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin/replay.c b/builtin/replay.c index 225cef08807e33..6172c8aacc9873 100644 --- a/builtin/replay.c +++ b/builtin/replay.c @@ -84,6 +84,7 @@ static struct commit *create_commit(struct repository *repo, obj = parse_object(repo, &ret); out: + repo_unuse_commit_buffer(the_repository, based_on, message); free_commit_extra_headers(extra); free_commit_list(parents); strbuf_release(&msg); diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 30075b67be8dac..fe15e11497379f 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -187,7 +187,7 @@ static void insert_records_from_trailers(struct shortlog *log, ctx->output_encoding); body = strstr(commit_buffer, "\n\n"); if (!body) - return; + goto out; trailer_iterator_init(&iter, body); while (trailer_iterator_advance(&iter)) { @@ -206,6 +206,7 @@ static void insert_records_from_trailers(struct shortlog *log, } trailer_iterator_release(&iter); +out: strbuf_release(&ident); repo_unuse_commit_buffer(the_repository, commit, commit_buffer); } From 65dff89c6b829a95d53c5cee8af435346c54406e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C3=85gren?= Date: Fri, 6 Jun 2025 14:31:36 +0200 Subject: [PATCH 03/10] diff-generate-patch.adoc: drop spurious backticks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 0b080a70ab (doc: git-diff: apply format changes to diff-generate-patch, 2024-11-18) wrapped the ".." in mode ,.. in backticks. Note how the line before is quite similar, index ,.. but did not get any backticks. Remove the backticks, since they confuse Asciidoctor. The exact failure mode changed with c87b2b3a6f (doc: fix asciidoctor synopsis processing of triple-dots, 2025-04-12), and arguably to the better. But Asciidoctor (2.0.18) still ends up confused by these backticks and leaves the manpage rendering as index ,.. mode ,`..____ {empty}`new file mode Drop the backticks. This is a no-op with asciidoc (10.2.0). Signed-off-by: Martin Ă…gren Signed-off-by: Junio C Hamano --- Documentation/diff-generate-patch.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/diff-generate-patch.txt b/Documentation/diff-generate-patch.txt index e5c813c96f3ac4..7b6cdd198012b0 100644 --- a/Documentation/diff-generate-patch.txt +++ b/Documentation/diff-generate-patch.txt @@ -138,7 +138,7 @@ or like this (when the `--cc` option is used): + [synopsis] index ,.. -mode ,`..` +mode ,.. new file mode deleted file mode , + From 3717a5775a7ba9e5f5b2794171ab205c0a177ef8 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Wed, 21 May 2025 19:05:10 +0000 Subject: [PATCH 04/10] doc: update references to renamed AsciiDoc files The .txt extensions were changed to .adoc in 1f010d6 (doc: use .adoc extension for AsciiDoc files, 2025-01-20). References to the renamed files were not updated yet. Signed-off-by: Jouke Witteveen Signed-off-by: Junio C Hamano --- Documentation/gitprotocol-v2.adoc | 4 ++-- Documentation/technical/build-systems.adoc | 5 ++++- contrib/subtree/README | 2 +- mergetools/vimdiff | 4 ++-- sub-process.h | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Documentation/gitprotocol-v2.adoc b/Documentation/gitprotocol-v2.adoc index 5598c93e67c314..9a57005d77773b 100644 --- a/Documentation/gitprotocol-v2.adoc +++ b/Documentation/gitprotocol-v2.adoc @@ -54,7 +54,7 @@ In general a client can request to speak protocol v2 by sending `version=2` through the respective side-channel for the transport being used which inevitably sets `GIT_PROTOCOL`. More information can be found in linkgit:gitprotocol-pack[5] and linkgit:gitprotocol-http[5], as well as the -`GIT_PROTOCOL` definition in `git.txt`. In all cases the +`GIT_PROTOCOL` definition in linkgit:git[1]. In all cases the response from the server is the capability advertisement. Git Transport @@ -99,7 +99,7 @@ Uses the `--http-backend-info-refs` option to linkgit:git-upload-pack[1]. The server may need to be configured to pass this header's contents via -the `GIT_PROTOCOL` variable. See the discussion in `git-http-backend.txt`. +the `GIT_PROTOCOL` variable. See the discussion in linkgit:git-http-backend[1]. Capability Advertisement ------------------------ diff --git a/Documentation/technical/build-systems.adoc b/Documentation/technical/build-systems.adoc index d9dafb407c4090..3c5237b9fd4727 100644 --- a/Documentation/technical/build-systems.adoc +++ b/Documentation/technical/build-systems.adoc @@ -32,7 +32,10 @@ that generally have somebody running test pipelines against regularly: - OpenBSD The platforms which must be supported by the tool should be aligned with our -[platform support policy](platform-support.txt). +platform support policy (see platform-support.adoc). +// once we lose AsciiDoc compatibility, we can start writing the above as: +// xref:platform-support.adoc#platform-support-policy[platform support policy] +// or something like that, but until then.... === Auto-detection of supported features diff --git a/contrib/subtree/README b/contrib/subtree/README index c686b4a69b1257..65d167b678c83e 100644 --- a/contrib/subtree/README +++ b/contrib/subtree/README @@ -1,5 +1,5 @@ -Please read git-subtree.txt for documentation. +Please read git-subtree.adoc for documentation. Please don't contact me using github mail; it's slow, ugly, and worst of all, redundant. Email me instead at apenwarr@gmail.com and I'll be happy to diff --git a/mergetools/vimdiff b/mergetools/vimdiff index 78710858e84b08..fca1044f65f5a8 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -274,8 +274,8 @@ gen_cmd () { # definition. # # The syntax of the "layout definitions" is explained in "Documentation/ - # mergetools/vimdiff.txt" but you can already intuitively understand how - # it works by knowing that... + # mergetools/vimdiff.adoc" but you can already intuitively understand + # how it works by knowing that... # # * "+" means "a new vim tab" # * "/" means "a new vim horizontal split" diff --git a/sub-process.h b/sub-process.h index 6a61638a8ace0b..bfc3959a1b4894 100644 --- a/sub-process.h +++ b/sub-process.h @@ -73,7 +73,7 @@ static inline struct child_process *subprocess_get_child_process( /* * Perform the version and capability negotiation as described in the - * "Handshake" section of long-running-process-protocol.txt using the + * "Handshake" section of long-running-process-protocol.adoc using the * given requested versions and capabilities. The "versions" and "capabilities" * parameters are arrays terminated by a 0 or blank struct. * From 47e7dee00a7f6730eb46705ccab33fb9a0a372b5 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sat, 7 Jun 2025 21:26:52 -0400 Subject: [PATCH 05/10] config.mak.uname: update settings for Solaris 10 and 11 Solaris 10 and newer has strtoumax(). Solaris 11 and newer has mkdtemp(), memmem(), and strcasestr(). Signed-off-by: Brad Smith Reviewed-by: Collin Funk Signed-off-by: Junio C Hamano --- config.mak.uname | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/config.mak.uname b/config.mak.uname index b12d4e168ae119..b4af8770a77592 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -190,9 +190,6 @@ ifeq ($(uname_S),SunOS) SHELL_PATH = /bin/bash SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin HAVE_ALLOCA_H = YesPlease - NO_STRCASESTR = YesPlease - NO_MEMMEM = YesPlease - NO_MKDTEMP = YesPlease NO_REGEX = YesPlease NO_MSGFMT_EXTENDED_OPTIONS = YesPlease HAVE_DEV_TTY = YesPlease @@ -202,7 +199,10 @@ ifeq ($(uname_S),SunOS) NO_IPV6 = YesPlease NO_SOCKADDR_STORAGE = YesPlease NO_UNSETENV = YesPlease + NO_MKDTEMP = YesPlease + NO_MEMMEM = YesPlease NO_SETENV = YesPlease + NO_STRCASESTR = YesPlease NO_STRLCPY = YesPlease NO_STRTOUMAX = YesPlease GIT_TEST_CMP = cmp @@ -212,23 +212,45 @@ ifeq ($(uname_S),SunOS) NO_IPV6 = YesPlease NO_SOCKADDR_STORAGE = YesPlease NO_UNSETENV = YesPlease + NO_MKDTEMP = YesPlease + NO_MEMMEM = YesPlease NO_SETENV = YesPlease + NO_STRCASESTR = YesPlease NO_STRLCPY = YesPlease NO_STRTOUMAX = YesPlease GIT_TEST_CMP = cmp endif ifeq ($(uname_R),5.8) NO_UNSETENV = YesPlease + NO_MKDTEMP = YesPlease + NO_MEMMEM = YesPlease NO_SETENV = YesPlease + NO_STRCASESTR = YesPlease NO_STRTOUMAX = YesPlease GIT_TEST_CMP = cmp endif ifeq ($(uname_R),5.9) NO_UNSETENV = YesPlease + NO_MKDTEMP = YesPlease + NO_MEMMEM = YesPlease NO_SETENV = YesPlease + NO_STRCASESTR = YesPlease NO_STRTOUMAX = YesPlease GIT_TEST_CMP = cmp endif + ifeq ($(uname_R),5.10) + NO_UNSETENV = YesPlease + NO_MKDTEMP = YesPlease + NO_MEMMEM = YesPlease + NO_SETENV = YesPlease + NO_STRCASESTR = YesPlease + GIT_TEST_CMP = cmp + endif + ifeq ($(uname_R),5.11) + NO_UNSETENV = YesPlease + NO_SETENV = YesPlease + GIT_TEST_CMP = cmp + endif INSTALL = /usr/ucb/install TAR = gtar BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ From bfc9f9cc6454609e63fefdb95e3dc4f25fcdc8ef Mon Sep 17 00:00:00 2001 From: Lidong Yan <502024330056@smail.nju.edu.cn> Date: Sun, 8 Jun 2025 03:56:59 +0000 Subject: [PATCH 06/10] builtin/submodule--helper: fix leak when remote_submodule_branch() failed In builtin/submodule--helper.c:update_submodule(), the variable remote_name is allocated in get_default_remote_submodule() but may be leaked if remote_submodule_branch() fails. Although it is unlikely that remote_submodule_branch() would fail after successfully obtaining a remote ref name from get_default_remote_submodule(), it is still possible. To prevent a potential memory leak, add a call to free(remote_name) at the early exit point. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano --- builtin/submodule--helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index c1a8029714bfe9..c5f2863b55d805 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2660,8 +2660,10 @@ static int update_submodule(struct update_data *update_data) if (code) return code; code = remote_submodule_branch(update_data->sm_path, &branch); - if (code) + if (code) { + free(remote_name); return code; + } remote_ref = xstrfmt("refs/remotes/%s/%s", remote_name, branch); free(remote_name); From 81cd1eef7dfc3edcdeaea1a2e8d5e31cc10e244a Mon Sep 17 00:00:00 2001 From: Lidong Yan <502024330056@smail.nju.edu.cn> Date: Mon, 9 Jun 2025 08:18:44 +0000 Subject: [PATCH 07/10] pack-bitmap: remove checks before bitmap_free In pack-bitmap.c:find_boundary_objects(), the roots_bitmap is only freed if cascade_pseudo_merges_1() fails. However, cascade_pseudo_merges_1() uses roots_bitmap as a mutable reference without taking ownership of it. As a result, if cascade_pseudo_merges_1() succeeds, roots_bitmap is leaked. And this leak currently lacks a dedicated test to detect it. To fix this leak, remove if cascade_pseudo_merges_1() succeed check and always calling bitmap_free(roots_bitmap); To trigger this leak, we need roots_bitmap that contains at least one pseudo merge. So that we can use pseudo merge bitmap when we compute roots reachable bitmap. Here we create two commits: first A then B. Add A to the pseudo-merge and perform a traversal over the range A..B. In this scenario, the "haves" set will be {A}, and cascade_pseudo_merges_1 will succeed, thereby exposing the leak due to the missing roots_bitmap cleanup. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano --- pack-bitmap.c | 4 ++-- t/t5333-pseudo-merge-bitmaps.sh | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pack-bitmap.c b/pack-bitmap.c index ac6d62b980c5a8..8727f316de9254 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -1363,8 +1363,8 @@ static struct bitmap *find_boundary_objects(struct bitmap_index *bitmap_git, bitmap_set(roots_bitmap, pos); } - if (!cascade_pseudo_merges_1(bitmap_git, cb.base, roots_bitmap)) - bitmap_free(roots_bitmap); + cascade_pseudo_merges_1(bitmap_git, cb.base, roots_bitmap); + bitmap_free(roots_bitmap); } /* diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh index 56674db562f948..ba5ae6a00c9847 100755 --- a/t/t5333-pseudo-merge-bitmaps.sh +++ b/t/t5333-pseudo-merge-bitmaps.sh @@ -445,4 +445,21 @@ test_expect_success 'pseudo-merge closure' ' ) ' +test_expect_success 'use pseudo-merge in boundary traversal' ' + git init pseudo-merge-boundary-traversal && + ( + cd pseudo-merge-boundary-traversal && + + git config bitmapPseudoMerge.test.pattern refs/ && + git config pack.useBitmapBoundaryTraversal true && + + test_commit A && + git repack -adb && + test_commit B && + + nr=$(git rev-list --count --use-bitmap-index HEAD~1..HEAD) && + test 1 -eq "$nr" + ) +' + test_done From 2f71f6104526448dc9d0fa1ab32835bf9b6d66e1 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Mon, 9 Jun 2025 18:13:38 +0100 Subject: [PATCH 08/10] test-lib: add missing prerequisites for Darwin commit d3d8c601fd ("t7815: fix unexpectedly passing test on macOS", 2025-06-02) added a MACOS prerequisite by adding a 'Darwin' case label to the 'OS-specific' case statement. However, this commit forgot to set several prerequisites which appear in the 'default' case label, in addition to the new MACOS prerequisite. This causes several tests, which macOS should pass, being skipped. In order to run all applicable tests on macOS, add the missing prerequisites to the 'Darwin' case. Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- t/test-lib.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/test-lib.sh b/t/test-lib.sh index 5352209d3e41b8..cd9e78a6cc4355 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1645,6 +1645,9 @@ uname_s=$(uname -s) case $uname_s in Darwin) test_set_prereq MACOS + test_set_prereq POSIXPERM + test_set_prereq BSLASHPSPEC + test_set_prereq EXECKEEPSPID ;; *MINGW*) # Windows has its own (incompatible) sort and find From ff67eea529b450293b19182386b48d317895a414 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Tue, 3 Jun 2025 15:45:39 -0700 Subject: [PATCH 09/10] CodingGuidelines: document formatting of similar config variables. Document that related `git config` variables should be placed one-per-line instead of separated by commas. Suggested-by: Junio C Hamano Signed-off-by: Collin Funk Signed-off-by: Junio C Hamano --- Documentation/CodingGuidelines | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index a0e7041c54b497..129c409a9226e7 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -874,6 +874,17 @@ Markup: As a side effect, backquoted placeholders are correctly typeset, but this style is not recommended. + When documenting multiple related `git config` variables, place them on + a separate line instead of separating them by commas. For example, do + not write this: + `core.var1`, `core.var2`:: + Description common to `core.var1` and `core.var2`. + +Instead write this: + `core.var1`:: + `core.var2`:: + Description common to `core.var1` and `core.var2`. + Synopsis Syntax The synopsis (a paragraph with [synopsis] attribute) is automatically From cb3b40381e1d5ee32dde96521ad7cfd68eb308a6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 18 Jun 2025 13:53:08 -0700 Subject: [PATCH 10/10] The second batch Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.51.0.adoc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Documentation/RelNotes/2.51.0.adoc b/Documentation/RelNotes/2.51.0.adoc index 478dbd5fb335aa..4f2a34b47d44d1 100644 --- a/Documentation/RelNotes/2.51.0.adoc +++ b/Documentation/RelNotes/2.51.0.adoc @@ -25,6 +25,13 @@ Performance, Internal Implementation, Development Support etc. * "git pack-objects" learned to find delta bases from blobs at the same path, using the --path-walk API. + * CodingGuidelines update. + + * Add settings for Solaris 10 & 11. + + * Meson-based build/test framework now understands TAP output + generated by our tests. + Fixes since v2.50 ----------------- @@ -35,11 +42,17 @@ Fixes since v2.50 * A memory-leak in an error code path has been plugged. (merge aedebdb6b9 ly/fetch-pack-leakfix later to maint). - * Meson-based build/test framework now understands TAP output - generated by our tests. - (merge c1bc974923 ps/meson-tap-parse later to maint). + * Some leftover references to documentation source files that no + longer exist, due to recent ".txt" -> ".adoc" renaming, have been + corrected. + (merge 3717a5775a jw/doc-txt-to-adoc-refs later to maint). * Other code cleanup, docfix, build fix, etc. (merge b257adb571 lo/my-first-ow-doc-update later to maint). (merge 8b34b6a220 ly/sequencer-update-squash-is-fixup-only later to maint). (merge 5dceb8bd05 ly/do-not-localize-bug-messages later to maint). + (merge 61372dd613 ly/commit-buffer-reencode-leakfix later to maint). + (merge 81cd1eef7d ly/pack-bitmap-root-leakfix later to maint). + (merge bfc9f9cc64 ly/submodule-update-failure-leakfix later to maint). + (merge 65dff89c6b ma/doc-diff-cc-headers later to maint). + (merge efb61591ee jm/bundle-uri-debug-output-to-fp later to maint).