aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2025-06-03BUG(): remove leading underscore of the format stringLidong Yan3-3/+3
BUG() is not end-user facing but programmer facing, and we do not use _("...") in them. Replace all `BUG(_("..."))` with `BUG("...")` Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03sequencer: replace error() with BUG() in update_squash_messages ()Lidong Yan1-2/+4
In sequencer.c, caller only pass TODO_SQUASH or TODO_FIXUP to update_squash_messages(), any other command passed in should be considered as BUG. Replace `return error('unknown command')` with `BUG('not a FIXUP or SQUASH')`. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/maintenance: fix locking race when handling "gc" taskPatrick Steinhardt2-20/+33
The "gc" task has a similar locking race as the one that we have fixed for the "pack-refs" and "reflog-expire" tasks in preceding commits. Fix this by splitting up the logic of the "gc" task: - We execute `gc_before_repack()` in the foreground, which contains the logic that git-gc(1) itself would execute in the foreground, as well. - We spawn git-gc(1) after detaching, but with a new hidden flag that suppresses calling `gc_before_repack()`. Like this we have roughly the same logic as git-gc(1) itself and know to repack refs and reflogs before detaching, thus fixing the race. Note that `gc_before_repack()` is renamed to `gc_foreground_tasks()` to better reflect what this function does. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/gc: avoid global state in `gc_before_repack()`Patrick Steinhardt1-15/+9
The `gc_before_repack()` should only ever run once in git-gc(1), but we may end up calling it twice when the "--detach" flag is passed. The duplicated call is avoided though via a static flag in this function. This pattern is somewhat unintuitive though. Refactor it to drop the static flag and instead guard the second call of `gc_before_repack()` via `opts.detach`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03usage: allow dying without writing an error messagePatrick Steinhardt5-11/+13
Sometimes code wants to die in a situation where it already has written an error message. To use the same error code as `die()` we have to use `exit(128)`, which is easy to get wrong and leaves magic numbers all over our codebase. Teach `die_message_builtin()` to not print any error when passed a `NULL` pointer as error string. Like this, such users can now call `die(NULL)` to achieve the same result without any hardcoded error codes. Adapt a couple of builtins to use this new pattern to demonstrate that there is a need for such a helper. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/maintenance: fix locking race with refs and reflogs tasksPatrick Steinhardt1-2/+2
As explained in the preceding commit, git-gc(1) knows to detach only after it has already packed references and expired reflogs. This is done to avoid racing around their respective lockfiles. Adapt git-maintenance(1) accordingly and run the "pack-refs" and "reflog-expire" tasks in the foreground. Note that the "gc" task has the same issue, but the fix is a bit more involved there and will thus be done in a subsequent commit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/maintenance: split into foreground and background tasksPatrick Steinhardt1-21/+49
Both git-gc(1) and git-maintenance(1) have logic to daemonize so that the maintenance tasks are performed in the background. git-gc(1) has some special logic though to not perform _all_ housekeeping tasks in the background: both references and reflogs are still handled synchronously in the foreground. This split exists because otherwise it may easily happen that git-gc(1) keeps the "packed-refs" file locked for an extended amount of time, where the next Git command that wants to modify any reference could now fail. This was especially important in the past, where git-gc(1) was still executed directly as part of our automatic maintenance: git-gc(1) was invoked via `git gc --auto --detach`, so we knew to handle most of the maintenance tasks in the background while doing those parts that may cause locking issues in the foreground. We have since moved to git-maintenance(1), which is a more flexible replacement for git-gc(1). By default this command runs git-gc(1), only, but it can be configured to run different tasks, as well. This command does not know about the split between maintenance tasks that should run before and after detach though, and this has led to several bug reports about spurious locking errors for the "packed-refs" file. Prepare for a fix by introducing this split for maintenance tasks. Note that this commit does not yet change any of the tasks, so there should not (yet) be a change in behaviour. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/maintenance: fix typedef for function pointersPatrick Steinhardt1-5/+5
The typedefs for `maintenance_task_fn` and `maintenance_auto_fn` are somewhat confusingly not true function pointers. As such, any user of those typedefs needs to manually add the pointer to make use of them. Fix this by making these true function pointers. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/maintenance: extract function to run tasksPatrick Steinhardt1-12/+23
Extract the function to run maintenance tasks. This function will be reused in a subsequent commit where we introduce a split between maintenance tasks that run before and after daemonizing the process. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/maintenance: stop modifying global array of tasksPatrick Steinhardt1-94/+112
When configuring maintenance tasks run by git-maintenance(1) we do so by modifying the global array of tasks directly. This is already quite bad on its own, as global state makes for logic that is hard to follow. Even more importantly though we use multiple different fields to track whether or not a task should be run: - "enabled" tracks the "maintenance.*.enabled" config key. This field disables execution of a task, unless the user has explicitly asked for the task. - "selected_order" tracks the order in which jobs have been asked for by the user via the "--task=" command line option. It overrides everything else, but only has an effect if at least one job has been selected. - "schedule" tracks the schedule priority for a job, that is how often it should run. This field only plays a role when the user has passed the "--schedule=" command line option. All of this makes it non-trivial to figure out which job really should be running right now. The logic to configure these fields and the logic that interprets them is distributed across multiple functions, making it even harder to follow it. Refactor the logic so that we stop modifying global state. Instead, we now compute which jobs should be run in `initialize_task_config()`, represented as an array of jobs to run that is stored in the options structure. Like this, all logic becomes self-contained and any users of this array only need to iterate through the tasks and execute them one by one. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/maintenance: mark "--task=" and "--schedule=" as incompatiblePatrick Steinhardt2-3/+10
The "--task=" option explicitly allows the user to say which maintenance tasks should be run, whereas "--schedule=" only respects the maintenance strategy configured for a specific repository. As such, it is not sensible to accept both options at the same time. Mark them as incompatible with one another. While at it, also convert the existing logic that marks "--auto" and "--schedule=" as incompatible to use `die_for_incompatible_opt2()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/maintenance: centralize configuration of explicit tasksPatrick Steinhardt1-23/+24
Users of git-maintenance(1) can explicitly ask it to run specific tasks by passing the `--task=` command line option. This option can be passed multiple times, which causes us to execute tasks in the same order as the tasks have been provided by the user. The order in which tasks are run is computed in `task_option_parse()`: every time we parse such a command line argument, we modify the global array of tasks by seting the selected index for that specific task. This has two downsides: - We modify global state, which makes it hard to follow the logic. - The configuration of tasks is split across multiple different functions, so it is not easy to figure out the different factors that play a role in selecting tasks. Refactor the logic so that `task_option_parse()` does not modify global state anymore. Instead, this function now only collects the list of configured tasks. The logic to configure ordering of the respective tasks is then deferred to `initialize_task_config()`. This refactoring solves the second problem, that the configuration of tasks is spread across multiple different locations. The first problem, that we modify global state, will be fixed in a subsequent commit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/gc: drop redundant local variablePatrick Steinhardt1-6/+5
We have two different variables that track the quietness for git-gc(1): - The local variable `quiet`, which we wire up. - The `quiet` field of `struct maintenance_run_opts`. This leads to confusion which of these variables should be used and what the respective effect is. Simplify this logic by dropping the local variable in favor of the options field. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03builtin/gc: use designated field initializers for maintenance tasksPatrick Steinhardt1-27/+27
Convert the array of maintenance tasks to use designated field initializers. This makes it easier to add more fields to the struct without having to modify all tasks. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-03compat: fixes for header handling with OpenBSD / NetBSDBrad Smith1-5/+5
Handle OpenBSD and NetBSD as FreeBSD / DragonFly are. OpenBSD would need _XOPEN_SOURCE to be set to 700. Its simpler to just not set _XOPEN_SOURCE. CC strbuf.o strbuf.c:645:6: warning: call to undeclared function 'getdelim'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] r = getdelim(&sb->buf, &sb->alloc, term, fp); ^ 1 warning generated. Signed-off-by: Brad Smith <brad@comstyle.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02MyFirstContribution: add walken.c to meson.buildLucas Seiki Oshiro1-1/+14
Instruct in the documentation to also add an entry in meson.build for builtin/walken.c, as currently both Meson and Make are supported. Helped-by: Karthik Nayak <karthik.188@gmail.com> Helped-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02MyFirstContribution: use struct repository in examplesLucas Seiki Oshiro1-10/+10
Add the parameter `struct repository *repo` to the cmd_walken function. Since commit 9b1cb5070f (builtin: add a repository parameter for builtin functions, 2024-09-13), all the cmd_* have the `repo` parameter and new commands must follow this convention, so the documentation should also be changed. Change the `git_config` calls to `repo_config`, also passing the `repo` parameter, as since 036876a106 (config: hide functions using `the_repository` by default, 2024-08-13) the non-repo config functions are no longer recommended as they use the global `repository` variable. Helped-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02completion: make sed command that generates config-list.h portable.Collin Funk3-3/+4
The OpenBSD 'sed' command does not support '\n' to represent newlines in sed expressions. This leads to the follow compiler error: In file included from builtin/help.c:15: ./config-list.h:282:18: error: use of undeclared identifier 'n' "gitcvs.dbUser",n "gitcvs.dbPass", ^ 1 error generated. gmake: *** [Makefile:2821: builtin/help.o] Error 1 We can fix this by documenting related configuration variables one-per-line instead of listing them separated by commas. This allows us to remove the unportable part of the sed expression in generate-configlist.sh. Signed-off-by: Collin Funk <collin.funk1@gmail.com> Reviewed-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02fsck: ignore missing "refs" directory for linked worktreesshejialuo2-0/+22
"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/<worktree name>/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 <code@khaugsbakk.name> Signed-off-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02A bit more before -rc1Junio C Hamano1-0/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02Merge branch 'wk/sparse-checkout-doc-fix'Junio C Hamano1-1/+1
Doc update. * wk/sparse-checkout-doc-fix: doc: sparse-checkout: use consistent inline list style
2025-06-02Merge branch 'jc/signed-fast-export-is-experimental'Junio C Hamano5-30/+16
Mark a new feature added during this cycle as experimental and fix its default so that existing users of the fast-export command is not broken. * jc/signed-fast-export-is-experimental: fast-export: --signed-commits is experimental
2025-06-02Merge branch 'ja/doc-synopsis-style'Junio C Hamano12-400/+403
Doc mark-up fixes. * ja/doc-synopsis-style: doc: convert git-switch manpage to new synopsis style doc: convert git-mergetool options to new synopsis style doc: convert git-mergetool manpage to new synopsis style doc: switch merge config description to new synopsis format doc: convert merge strategies to synopsis format doc: merge-options.adoc remove a misleading double negation doc: convert merge options to new synopsis format doc: convert git-merge manpage to new style doc: convert git-checkout manpage to new style
2025-06-02meson: parse TAP output generated by our testsPatrick Steinhardt1-0/+8
By default, Meson only knows to pay respect to the exit code of tests to judge whether or not it ran successfully. This can be changed though by specifying the "protocol" parameter. Next to the default "exitcode" protocol, Meson also supports the "tap" output that our tests already know to generate. Unfortunately, the "tap" protocol was incompatible with `meson test --interactive` and caused a hang. We have upstreamed a fix [1] though, so with the recent release of Meson 1.8 that fix is finally out and we can start using the "tap" protocol when running with a recent-enough version of this build tool. With this change in place, Meson now properly detects how many subtests ran and whether test suites have been skipped: ``` $ meson test t002* ninja: Entering directory `/home/pks/Development/git/build' 1/10 t0024-crlf-archive OK 0.17s 2 subtests passed 2/10 t0022-crlf-rename OK 0.18s 2 subtests passed 3/10 t0029-core-unsetenvvars SKIP 0.15s 4/10 t0023-crlf-am OK 0.18s 2 subtests passed 5/10 t0025-crlf-renormalize OK 0.21s 3 subtests passed 6/10 t0026-eol-config OK 0.25s 5 subtests passed 7/10 t0020-crlf OK 0.81s 36 subtests passed 8/10 t0028-working-tree-encoding OK 0.85s 22 subtests passed 9/10 t0021-conversion OK 3.45s 38 subtests passed 10/10 t0027-auto-crlf OK 26.35s 2600 subtests passed Ok: 9 Fail: 0 Skipped: 1 ``` Note that when running `meson test --interactive` the test results will now be marked as "ignored". This is because in interactive mode the file descriptors will remain connected to the user's terminal, and it is expected that the user interacts with the tests (e.g., spawn a debugger or use `test_pause`). As such, the TAP output cannot be parsed reliably by Meson in that case, so the tests are marked as ignored accordingly. [1]: https://github.com/mesonbuild/meson/pull/13980 Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02meson: introduce kwargs variable for testsPatrick Steinhardt4-5/+9
Meson has the ability to create a kwargs dictionary that can then be passed to any function call with the `kwargs:` positional argument. This allows one to deduplicate common parameters that one wishes to pass to several different function invocations. Our tests already have one common parameter that we use everywhere, "timeout", and we're about to add a second common parameter in the next commit. Let's prepare for this by introducing `test_kwargs` so that we can deduplicate these common arguments. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02test-lib: fail on unexpectedly passing testsPatrick Steinhardt2-3/+10
When tests are executed via `test_expect_failure` we rather obviously expect the test itself to fail. If it unexpectedly does not fail then we count the test as a "fixed" test and announce that a known breakage has vanished: ok 1 - setup ok 2 - create refs/heads/main # TODO known breakage vanished ok 3 - create refs/heads/main with oldvalue verification ... ok 299 - update-ref should also create reflog for HEAD # 1 known breakage(s) vanished; please update test(s) # passed all remaining 298 test(s) 1..299 While we announce that tests should be updated, the overall test suite still passes. This makes it quite hard to detect when a test that has previously failed succeeds now as the developer needs to pay close attention to the exact output. Even more importantly, tests that only succeed on _some_ systems are even easier to miss now, as one would have to explicitly take a look at respective CI jobs to notice that those do pass now. Furthermore, we are about to introduce support for parsing TAP output in Meson. In contrast to prove(1), which treats unexpected passes as a successful test run, Meson treats those as failure. Neither of these tools is wrong in doing so. Quoting the TAP specification [1]: Should a todo test point begin succeeding, the harness may report it in some way that indicates that whatever was supposed to be done has been, and it should be promoted to a normal Test Point. So it is essentially implementation-defined how exactly the unexpected pass is reported, and whether it should cause the overall test suite to fail or not. It is unarguably a bad thing for us though if these tools interpret these differently, as it would mean that test results now depend on whether the developer uses prove(1) or Meson. Unify the behaviour by causing a test suite to fail when there are any unexpected passes. As prove(1) does not consider an unexpected pass to be an error this leads to somewhat funky output: t1400-update-ref.sh ................................ Dubious, test returned 1 (wstat 256, 0x100) All 299 subtests passed (1 TODO test unexpectedly succeeded) ... Test Summary Report ------------------- t1400-update-ref.sh (Wstat: 256 (exited 1) Tests: 299 Failed: 0) TODO passed: 2 Non-zero exit status: 1 But as we directly announce that the root cause is an unexpected TODO that has succeeded it's not all that bad. [1]: https://testanything.org/tap-version-14-specification.html Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02t7815: fix unexpectedly passing test on macOSPatrick Steinhardt2-1/+4
In t7815, we have the following test: test_expect_failure !CYGWIN 'git grep .fi a' ' git grep .fi a ' The test passes if '.' matches a NUL byte, which we expect to only happen on Cygwin. The upcoming changes to support parsing TAP output in Meson surface that this test, surprisingly, passes on macOS as well. It is unclear how long the test has been passing on macOS already. 064eed36c7f (config.mak.uname: only set NO_REGEX on cygwin for v1.7, 2025-04-17) mentions that the test started to pass for Cygwin. This was attributed to a new implementation of regcomp(3p) and friends, which was inherited from FreeBSD. Given the BSD lineage of macOS it is feasible that it also inherited similar code eventually that made the test pass now. It is somewhat dubious what the test actually brings to the table given that it is quite platform specific. Ideally, we would fix this mess by having a configure-time check whether regcomp(3p) works as expected, including NUL bytes, and use our bundled version of the regex library in case it doesn't. Like this, we could ensure that all platforms work the same in this edge case and mark the new behaviour as expected. This change is outside of the scope of this patch series, which only introduces support for TAP. So instead of fixing the bigger issue, ignore the test on Darwin like we already do for Cygwin. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02t/test-lib: fix TAP format for BASH_XTRACEFD warningPatrick Steinhardt1-1/+1
When the Bash version is too old to support BASH_XTRACEFD we print a warning to stderr. This warning is not prefixed with "#", which causes TAP parsers to (wrongly) interpret the warning as part of the protocol. Fix this issue by prefixing the warning with a "#" so that it is treated as comment. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02t/test-lib: don't print shell traces to stdoutPatrick Steinhardt2-18/+21
We have several flags like "--verbose", "--verbose-only" or "-x" that cause us to generate shell traces. The generated tracing output is split up in these cases so that the test's stdout is printed to file descriptor 3 whereas its stderr is printed to file descriptor 4. Depending on which options have been given, we then end up either: - Redirecting both file descriptors to a file. - Redirecting them to stdout and stderr, respectively. - Closing them in case we're running in none-verbose mode. The second case causes problems though when passing output to a TAP parser. We print the test's stdout to the console's stdout, and that results in broken TAP output. Fix the issue by instead redirecting the test's stdout to the shell's stderr. This makes it impossible to discern stdout from stderr, but going by my own experience I never came across a usecase where I would have needed this distinction. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02t983*: use prereq to check for Python-specific git-p4(1) supportPatrick Steinhardt2-22/+26
The tests in t9835 and t9836 verify that git-p4(1) works with both Python 2 and 3, respectively. To determine whether we have those Python versions in the first place we create a wrapper script that directly executes the git-p4(1) script with `python2` or `python3` binaries. We then condition the execution of tests on whether that wrapper script can be executed successfully. The logic that does all of this is not contained in a prerequisite block though, so the output it generates causes us to break the TAP format. Refactor the logic to use `test_lazy_prereq()` to fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02t9822: use prereq to check for ISO-8859-1 supportPatrick Steinhardt1-4/+9
Tests in t9822 depend on filesystem support for ISO-8859-1 encoding. We thus have a block of code that acts as a prerequisite -- if we fail to write a file with an ISO-8859-1-encoded file name to disk then we skip all tests. When the prerequisite fails though we end up printing an error message to stderr, which breaks the TAP format. Fix this by converting the code to a proper prerequisite, which handles output redirection for us. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02t: silence output from `test_create_repo()`Patrick Steinhardt4-20/+31
There are a couple users of `test_create_repo()` that use this function outside of any test case. This function is nowadays only a thin wrapper around `git init`, which by default prints a message to stdout that the repository has been initialized. The resulting output may thus confuse TAP parsers. Refactor these users to instead create the repository in a "setup" test case so that we don't explicitly have to silence them. There's one exception in t1007: we use `push_repo()` and its `pop_repo()` equivalent multiple times, so to reduce the noise introduced by this patch we instead silence this invocation. While at it, convert callsites to use git-init(1) directly as the `test_create_repo()` function has been deprecated in f0d4d398e28 (test-lib: split up and deprecate test_create_repo(), 2021-05-10). Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-02t: stop announcing prereqsPatrick Steinhardt5-43/+14
We have a couple of cases where our tests end up announcing that a certain prerequisite is or isn't fulfilled. While this is supposed to help the developer it has the downside that it breaks the TAP format. We could convert these cases to just have a "#" prefix, but it feels rather unlikely that these are generally useful in the first place. We already do announce why a specific test is being skipped, so we should try to use this mechanism to the best extent possible. Stop announcing these prereqs to fix the TAP format. Where possible, convert the tests to rely on the prerequisites themselves to announce why a test ran or didn't ran. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-01config.mak.uname: update settings for OpenBSDBrad Smith1-4/+1
OpenBSD requires DIR_HAS_BSD_GROUP_SEMANTICS. OpenBSD has never had the BSD sysctl KERN_PROC_PATHNAME nor does it support or use the /proc filesystem. OpenBSD has had strcasestr() since 3.8. OpenBSD has had memmem() since 5.4. Signed-off-by: Brad Smith <brad@comstyle.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-01builtin/gc: correct physical memory detection for OpenBSD / NetBSDBrad Smith1-1/+3
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 <brad@comstyle.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-01doc: column: fix blank lines around block delimitersKristoffer Haugsbakk1-3/+3
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 <jn.avila@free.fr> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-01thread-utils.c: detect online CPU count on OpenBSD / NetBSDBrad Smith1-4/+4
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 <brad@comstyle.com> Reviewed-by: Collin Funk <collin.funk1@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-30t: run tests from a normalized working directoryMark Mentovai1-0/+2
Some tests make git perform actions that produce observable pathnames, and have expectations on those paths. Tests run with $HOME set to a $TRASH_DIRECTORY, and with their working directory the same $TRASH_DIRECTORY, although these paths are logically identical, they do not observe the same pathname canonicalization rules and thus might not be represented by strings that compare equal. In particular, no pathname normalization is applied to $TRASH_DIRECTORY or $HOME, while tests change their working directory with `cd -P`, which normalizes the working directory's path by fully resolving symbolic links. t7900's macOS maintenance tests (which are not limited to running on macOS) have an expectation on a path that `git maintenance` forms by using abspath.c strbuf_realpath() to resolve a canonical absolute path based on $HOME. When t7900 runs from a working directory that contains symbolic links in its pathname, $HOME will also contain symbolic links, which `git maintenance` resolves but the test's expectation does not, causing a test failure. Align $TRASH_DIRECTORY and $HOME with the normalized path as used for the working directory by resetting them to match the working directory after it's established by `cd -P`. With all paths in agreement and symbolic links resolved, pathname expectations can be set and met based on string comparison without regard to external environmental factors such as the presence of symbolic links in a path. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Mark Mentovai <mark@chromium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-30A bit more topics for -rc1Junio C Hamano1-0/+22
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-30Merge branch 'ps/midx-negative-packfile-cache'Junio C Hamano2-2/+21
When a stale .midx file refers to .pack files that no longer exist, we ended up checking for these non-existent files repeatedly, which has been optimized by memoizing the non-existence. * ps/midx-negative-packfile-cache: midx: stop repeatedly looking up nonexistent packfiles packfile: explain ordering of how we look up auxiliary pack files
2025-05-30Merge branch 'kh/notes-doc-fixes'Junio C Hamano3-26/+38
"git notes --help" documentation updates. * kh/notes-doc-fixes: doc: notes: use stuck form throughout doc: notes: treat --stdin equally between copy/remove doc: notes: point out copy --stdin use with argv doc: notes: clearly state that --stripspace is the default doc: notes: remove stripspace discussion from other options doc: notes: rework --[no-]stripspace doc: notes: split out options with negated forms doc: config: mention core.commentChar on commit.cleanup doc: stripspace: mention where the default comes from
2025-05-30Merge branch 'mm/apply-reverse-mode-of-deleted-path'Junio C Hamano2-6/+227
"git apply --index/--cached" when applying a deletion patch in reverse failed to give the mode bits of the path "removed" by the patch to the file it creates, which has been corrected. * mm/apply-reverse-mode-of-deleted-path: apply: set file mode when --reverse creates a deleted file t4129: test that git apply warns for unexpected mode changes
2025-05-30Merge branch 'op/cvsserver-perl-warning'Junio C Hamano1-24/+3
Recent versions of Perl started warning against "! A =~ /pattern/" which does not negate the result of the matching. As it turns out that the problematic function is not even called, it was removed. * op/cvsserver-perl-warning: cvsserver: remove unused escapeRefName function
2025-05-30Merge branch 'am/sparse-index-name-hash-fix'Junio C Hamano1-2/+4
Avoid adding directory path to a sparse-index tree entries to the name-hash, since they would bloat the hashtable without anybody querying for them. This was done already for a single threaded part of the code, but now the multi-threaded code also does the same. * am/sparse-index-name-hash-fix: name-hash: don't add sparse directories in threaded lazy init
2025-05-30Merge branch 'pw/midx-repack-overflow-fix'Junio C Hamano3-10/+39
Integer overflow fix around code paths for "git multi-pack-index repack".. * pw/midx-repack-overflow-fix: midx docs: clarify tie breaking midx: avoid negative array index midx repack: avoid potential integer overflow on 64 bit systems midx repack: avoid integer overflow on 32 bit systems
2025-05-30Merge branch 'cb/reftable-unused-portability-fix'Junio C Hamano1-0/+4
Build fix. * cb/reftable-unused-portability-fix: reftable: make REFTABLE_UNUSED C99 compatible
2025-05-30docs: make the purpose of using app password for Gmail more clear in send-emailAditya Garg1-7/+10
The current example for Gmail suggests using app passwords for send-email if user has multi-factor authentication set up for their account. However, it does not clarify that the user cannot use their normal password in case they do not have multi-factor authentication enabled. Most likely the example was written in the days when Google allowed using normal passwords without multi-factor authentication. Clarify that regular passwords do not work for Gmail and app-passwords are the only way for basic authentication. Also encourage users to use OAuth2.0 as a more secure alternative. While at it, also prefer using the word "mechanism" over "method" for `OAUTHBEARER` and `XOAUTH2` since that is what official docs use. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-30docs: remove credential helper links for emails from gitcredentialsAditya Garg1-4/+0
In a recent attempt to add links of email helpers to git-scm.com [1], I came to a conclusion that the links in the gitcredentials page are meant for people needing credential helpers for cloning, fetching and pushing repositories to remote hosts, and not sending emails. gitcredentials docs don't even talk about send emails, thus confirming this view. So, lets remove these links from the gitcredentials page. The links are still available in the git-send-email documentation, which is the right place for them. [1]: https://github.com/git/git-scm.com/pull/2005 Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-30docs: improve formatting in git-send-email documentationAditya Garg2-122/+130
The current documentation for git-send-email had an inconsistent use of "", ``, and '' for quoting. This commit improves the formatting by using the same style throughout the documentation. Missing full stops have also been added at some places. Finally, the cpan links of necessary perl modules have been added to make their installation easier. While at it, the unecessary use of $ with <num> and <int> placeholders has also been removed. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-30docs: add credential helper for yahoo and link Google's sendgmail toolAditya Garg1-2/+8
This commit links `git-credential-yahoo` as a credential helper for Yahoo accounts. Also, Google's `sendgmail` tool has been linked as an alternative method for sending emails through Gmail. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>