From 7f1a09dbb643c8669928ee32337ff92370fc1157 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 9 May 2025 02:13:13 -0400 Subject: [PATCH 1/5] thread-utils.c: detect online CPU count on OpenBSD / NetBSD OpenBSD / NetBSD use HW_NCPUONLINE to detect the online CPU count. OpenBSD ships with SMT disabled on X86 systems so HW_NCPU would provide double the number of CPUs as opposed to the proper online count. Signed-off-by: Brad Smith Reviewed-by: Collin Funk Signed-off-by: Junio C Hamano --- thread-utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/thread-utils.c b/thread-utils.c index 1f89ffab4c32bc..374890e6b05b69 100644 --- a/thread-utils.c +++ b/thread-utils.c @@ -46,11 +46,11 @@ int online_cpus(void) mib[0] = CTL_HW; # ifdef HW_AVAILCPU mib[1] = HW_AVAILCPU; - len = sizeof(cpucount); - if (!sysctl(mib, 2, &cpucount, &len, NULL, 0)) - return cpucount; -# endif /* HW_AVAILCPU */ +# elif defined(HW_NCPUONLINE) + mib[1] = HW_NCPUONLINE; +# else mib[1] = HW_NCPU; +# endif /* HW_AVAILCPU */ len = sizeof(cpucount); if (!sysctl(mib, 2, &cpucount, &len, NULL, 0)) return cpucount; From 23d30ea2008829bbc87a78c55d9c310413f1d971 Mon Sep 17 00:00:00 2001 From: Kristoffer Haugsbakk Date: Sun, 1 Jun 2025 13:36:53 +0200 Subject: [PATCH 2/5] doc: column: fix blank lines around block delimiters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 227c4f33a03 (doc: add a blank line around block delimiters, 2025-03-09) added blank lines around block delimiters as a defensive measure. For each block you had to mind the con- text (like the commit says): • Top-level: just add blank lines • Block: use list continuation (+) But list continuation was used here at the top level, which results in literal `+` in the output formats. Acked-by: Jean-Noël Avila Signed-off-by: Kristoffer Haugsbakk Signed-off-by: Junio C Hamano --- Documentation/git-column.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/git-column.adoc b/Documentation/git-column.adoc index 5a4f2b6fde9f27..8e0047214dc992 100644 --- a/Documentation/git-column.adoc +++ b/Documentation/git-column.adoc @@ -50,7 +50,7 @@ EXAMPLES -------- Format data by columns: -+ + ------------ $ seq 1 24 | git column --mode=column --padding=5 1 4 7 10 13 16 19 22 @@ -59,7 +59,7 @@ $ seq 1 24 | git column --mode=column --padding=5 ------------ Format data by rows: -+ + ------------ $ seq 1 21 | git column --mode=row --padding=5 1 2 3 4 5 6 7 @@ -68,7 +68,7 @@ $ seq 1 21 | git column --mode=row --padding=5 ------------ List some tags in a table with unequal column widths: -+ + ------------ $ git tag --list 'v2.4.*' --column=row,dense v2.4.0 v2.4.0-rc0 v2.4.0-rc1 v2.4.0-rc2 v2.4.0-rc3 From 35c1d592cd11429e402501df3ad68bcd0fb86bef Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 1 Jun 2025 04:24:12 -0400 Subject: [PATCH 3/5] builtin/gc: correct physical memory detection for OpenBSD / NetBSD OpenBSD / NetBSD use HW_PHYSMEM64 to detect the amount of physical memory in a system. HW_PHYSMEM will not provide the correct amount on a system with >=4GB of memory. Signed-off-by: Brad Smith Reviewed-by: Collin Funk Signed-off-by: Junio C Hamano --- builtin/gc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin/gc.c b/builtin/gc.c index e33ba946e43602..7dc94f243d7dc6 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -516,7 +516,7 @@ static uint64_t total_ram(void) total *= (uint64_t)si.mem_unit; return total; } -#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM)) +#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM) || defined(HW_PHYSMEM64)) int64_t physical_memory; int mib[2]; size_t length; @@ -524,6 +524,8 @@ static uint64_t total_ram(void) mib[0] = CTL_HW; # if defined(HW_MEMSIZE) mib[1] = HW_MEMSIZE; +# elif defined(HW_PHYSMEM64) + mib[1] = HW_PHYSMEM64; # else mib[1] = HW_PHYSMEM; # endif From d5b3c38b8a1356921a87cc3d435e6de91a9fbff1 Mon Sep 17 00:00:00 2001 From: shejialuo Date: Mon, 2 Jun 2025 22:41:35 +0800 Subject: [PATCH 4/5] fsck: ignore missing "refs" directory for linked worktrees "git refs verify" doesn't work if there are worktrees created on Git v2.43.0 or older versions. These versions don't automatically create the "refs" directory, causing the error: error: cannot open directory .git/worktrees//refs: No such file or directory Since 8f4c00de95 (builtin/worktree: create refdb via ref backend, 2024-01-08), we automatically create the "refs" directory for new worktrees. And in 7c78d819e6 (ref: support multiple worktrees check for refs, 2024-11-20), we assume that all linked worktrees have this directory and would wrongly report an error to the user, thus introducing compatibility issue. Check for ENOENT errno before reporting directory access errors for linked worktrees to maintain backward compatibility. Reported-by: Kristoffer Haugsbakk Signed-off-by: shejialuo Signed-off-by: Junio C Hamano --- refs/files-backend.c | 3 +++ t/t0602-reffiles-fsck.sh | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/refs/files-backend.c b/refs/files-backend.c index 6c6e67dc1c48ed..7fd9d49c87df03 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3772,6 +3772,9 @@ static int files_fsck_refs_dir(struct ref_store *ref_store, iter = dir_iterator_begin(sb.buf, 0); if (!iter) { + if (errno == ENOENT && !is_main_worktree(wt)) + goto out; + ret = error_errno(_("cannot open directory %s"), sb.buf); goto out; } diff --git a/t/t0602-reffiles-fsck.sh b/t/t0602-reffiles-fsck.sh index d4a08b823b7db7..a7f25c96057bf9 100755 --- a/t/t0602-reffiles-fsck.sh +++ b/t/t0602-reffiles-fsck.sh @@ -106,6 +106,25 @@ test_expect_success 'ref name check should be adapted into fsck messages' ' test_must_be_empty err ' +test_expect_success 'no refs directory of worktree should not cause problems' ' + test_when_finished "rm -rf repo" && + git init repo && + ( + cd repo && + test_commit initial && + git worktree add --detach ./worktree && + + ( + cd worktree && + worktree_refdir="$(git rev-parse --git-dir)/refs" && + # Simulate old directory layout + rmdir "$worktree_refdir" && + git refs verify 2>err && + test_must_be_empty err + ) + ) +' + test_expect_success 'ref name check should work for multiple worktrees' ' test_when_finished "rm -rf repo" && git init repo && From 0bd2d791cc9f745ebaedafc0e1cbebdebe41343e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 3 Jun 2025 08:50:59 -0700 Subject: [PATCH 5/5] Git 2.50-rc1 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.50.0.adoc | 14 ++++++++++++-- GIT-VERSION-GEN | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Documentation/RelNotes/2.50.0.adoc b/Documentation/RelNotes/2.50.0.adoc index c3d5dad704eea7..95349ea50c001e 100644 --- a/Documentation/RelNotes/2.50.0.adoc +++ b/Documentation/RelNotes/2.50.0.adoc @@ -300,7 +300,7 @@ Fixes since v2.49 (merge e7ef4be7c2 mh/left-right-limited later to maint). * Document the convention to disable hooks altogether by setting the - hooksPath configuration variable to /dev/nulll + hooksPath configuration variable to /dev/null. (merge 1b2eee94f1 ds/doc-disable-hooks later to maint). * Make sure outage of third-party sites that supply P4, Git-LFS, and @@ -318,6 +318,7 @@ Fixes since v2.49 * Update to arm64 Windows port. (merge 436a42215e js/windows-arm64 later to maint). + * hashmap API clean-up to ensure hashmap_clear() leaves a cleared map in a reusable state. (merge 9481877de3 en/hashmap-clear-fix later to maint). @@ -351,7 +352,7 @@ Fixes since v2.49 (merge 5dbaec628d pw/sequencer-reflog-use-after-free later to maint). * win+Meson CI pipeline, unlike other pipelines for Windows, - used to build artifacts in develper mode, which has been changed to + used to build artifacts in developer mode, which has been changed to build them in release mode for consistency. (merge 184abdcf05 js/ci-build-win-in-release-mode later to maint). @@ -379,6 +380,15 @@ Fixes since v2.49 reverse failed to give the mode bits of the path "removed" by the patch to the file it creates, which has been corrected. + * "git verify-refs" (and hence "git fsck --reference") started + erroring out in a repository in which secondary worktrees were + prepared with Git 2.43 or lower. + (merge d5b3c38b8a sj/ref-contents-check-fix later to maint). + + * Update total_ram() functrion on BSD variants. + + * Update online_cpus() functrion on BSD variants. + * Other code cleanup, docfix, build fix, etc. (merge 227c4f33a0 ja/doc-block-delimiter-markup-fix later to maint). (merge 2bfd3b3685 ab/decorate-code-cleanup later to maint). diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index cea2a13401353f..1047b8d11de767 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,6 +1,6 @@ #!/bin/sh -DEF_VER=v2.50.0-rc0 +DEF_VER=v2.50.0-rc1 LF=' '