summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2026-06-30Merge branch 'ps/setup-drop-global-state' into ↵Junio C Hamano24-75/+97
ps/setup-split-discovery-and-setup * ps/setup-drop-global-state: treewide: drop USE_THE_REPOSITORY_VARIABLE environment: stop using `the_repository` in `is_bare_repository()` environment: split up concerns of `is_bare_repository_cfg` builtin/init: stop modifying `is_bare_repository_cfg` setup: remove global `git_work_tree_cfg` variable builtin/init: simplify logic to configure worktree builtin/init: stop modifying global `git_work_tree_cfg` variable
2026-06-30Merge branch 'ps/refs-onbranch-fixes' into ps/setup-split-discovery-and-setupJunio C Hamano29-389/+561
* ps/refs-onbranch-fixes: refs: protect against chicken-and-egg recursion refs/reftable: lazy-load configuration to fix chicken-and-egg reftable: split up write options refs/files: lazy-load configuration to fix chicken-and-egg refs: move parsing of "core.logAllRefUpdates" back into ref stores repository: free main reference database chdir-notify: drop unused `chdir_notify_reparent()` refs: unregister reference stores from "chdir_notify" setup: don't apply "GIT_REFERENCE_BACKEND" without a repository setup: stop applying repository format twice setup: inline `check_and_apply_repository_format()`
2026-06-30format-patch: fix leak of rev_info in prepare_bases()Jeff King1-0/+1
In prepare_bases() we do a custom revision walk, separate from the main format-patch walk. After we finish, we fail to call release_revisions(), possibly leaking its contents. We failed to notice it so far because the revision machinery doesn't always allocate. But at least one case can trigger the leak: if a commit graph is present, then the topo-walk allocates revs.topo_walk_info and some associated data structures. You can see it in the test suite by running: make SANITIZE=leak cd t GIT_TEST_COMMIT_GRAPH=1 ./t4014-format-patch.sh which yields many entries like: ==git==3687620==ERROR: LeakSanitizer: detected memory leaks Direct leak of 200 byte(s) in 1 object(s) allocated from: #0 0x7f4ccba185cb in malloc ../../../../src/libsanitizer/lsan/lsan_interceptors.cpp:74 #1 0x55cd452cdd0b in do_xmalloc wrapper.c:55 #2 0x55cd452cdd9d in xmalloc wrapper.c:76 #3 0x55cd45255473 in init_topo_walk revision.c:3845 #4 0x55cd45255bef in prepare_revision_walk revision.c:4017 #5 0x55cd44ffec40 in prepare_bases builtin/log.c:1872 #6 0x55cd450010ec in cmd_format_patch builtin/log.c:2439 The un-released rev_info has been there since the code was added in fa2ab86d18 (format-patch: add '--base' option to record base tree info, 2016-04-26), but back then we didn't even have a way to release rev_info resources! The actual leak probably started around f0d9cc4196 (revision.c: begin refactoring --topo-order logic, 2018-11-01), but it's hard to bisect because there were so many other unrelated leaks back then. So I'm not sure exactly when the leak started beyond "long ago", but it is easy-ish to find now (since we've plugged all those other leaks) and the solution is clear. I didn't add a new test since we can demonstrate it with the existing ones, but it does require tweaking a test variable. We might consider ways to get more automatic leak-checking coverage there, but I think it should be done outside of this fix. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-30t: move LSan errors from stdout to stderrJeff King1-3/+3
When we find LSan errors, we dump them via "say_color", which goes to stdout. This is mostly harmless, since stdout and stderr tend to go to the same place (either the user's terminal, or to the ".out" file with --verbose-log). But when running under a TAP harness like prove, they are split and stdout is interpreted as TAP output. Historically even this was fine, as the extra lines on stdout would be ignored. But since 389c83025d (t: let prove fail when parsing invalid TAP output, 2026-06-04) we instruct the TAP reader to complain, and a leaking test will result in complaints like this (this is a real leak which we have yet to fix): $ GIT_TEST_COMMIT_GRAPH=1 make SANITIZE=leak test [...] Test Summary Report ------------------- t4014-format-patch.sh (Wstat: 256 (exited 1) Tests: 226 Failed: 30) Failed tests: 197-226 Non-zero exit status: 1 Parse errors: Unknown TAP token: "" Unknown TAP token: "=================================================================" Unknown TAP token: "==git==3693658==ERROR: LeakSanitizer: detected memory leaks" Unknown TAP token: "" Unknown TAP token: "Direct leak of 200 byte(s) in 1 object(s) allocated from:" Displayed the first 5 of 1531 TAP syntax errors. Re-run prove with the -p option to see them all. You still see the failing tests, so it's mostly just an annoyance. We can fix it by redirecting to stderr (actually descriptor 4, which is our verbose-respecting variant). I confirmed manually that the output still appears with --verbose-log, and even with a single-test "-i --verbose-only=197" going to the terminal. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-29commit-reach: guard !FIND_ALL early exit with generation ordering checkKristofer Karlsson2-4/+8
When paint_down_to_common() falls back to commit-date ordering (for v1 commit graphs without corrected commit dates), the !FIND_ALL early exit incorrectly fires. The exit assumes the queue is generation- ordered, so the first RESULT commit found must be the shallowest. With date ordering this is not guaranteed: a closer merge base with a lower committer date (clock skew) may still be in the queue behind deeper commits. Add a gen_ordered flag that is cleared when the date fallback fires, and require it for the early exit. Update the test from the previous commit to test_expect_success. Signed-off-by: Kristofer Karlsson <krka@spotify.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-29t6600: add test for merge-base early exit with clock skewKristofer Karlsson1-0/+41
Add a topology where the correct merge base (M2) has a lower committer date than its ancestor (M1) due to clock skew. With a v1 commit graph (topological levels only, no corrected commit dates), paint_down_to_common() falls back to commit-date ordering. In that mode, M1 pops before M2, acquires both paint sides, and the !FIND_ALL early exit fires -- returning the wrong merge base. Mark the test as test_expect_failure to document the bug; the next commit will fix it. Signed-off-by: Kristofer Karlsson <krka@spotify.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-29history: streamline message preparation and plug file stream leakJunio C Hamano1-7/+10
An early part of fill_commit_message() function uses write_file_buf() to write out what was prepared in a strbuf, which is primarily meant for use by callers that have their own message prepared fully and called as the last thing to flush it to the destination file. However, the function then opens a file stream in append mode to further write into it. It may have been understandable if this was a later addition, but it seems it came from a single commit, d205234c (builtin/history: implement "reword" subcommand, 2026-01-13), which is somewhat puzzling, but anyway... Just open the file stream upfront for writing, write the message the function has in the strbuf, and then keep writing whatever it wants to write to the same open file stream. And do not forget to close the stream. We are about to pass the resulting file to an external editor, and on some systems, notably Windows, you are not supposed to keep a file open while expecting another program to access it. Diagnosed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-29Git 2.55v2.55.0maintJunio C Hamano2-2/+4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-29Merge branch 'jk/t5551-expensive-test-timeouts-fix'Junio C Hamano2-4/+6
The Apache timeout in HTTP tests has been increased to prevent test failures on heavily loaded CI runners. The tests creating an enormous number of refs have been isolated to their own repositories to avoid slowing down subsequent tests. * jk/t5551-expensive-test-timeouts-fix: t5551: put many-tags case into its own repo t/lib-httpd: bump apache timeout
2026-06-29t5551: put many-tags case into its own repoJeff King1-4/+5
Most of the t5551 http fetch tests use a handful of refs. But there are a few test cases which check our handling of large numbers of refs. These tests use the same server-side repo, so all subsequent tests end up having to consider those extra refs, too. The result is that the test script is a bit slower than it needs to be. In a normal run, moving the "2,000 tags" test into its own repo drops my runtime for the whole script from ~2.7s to ~1.9s. This is a modest gain, but when we add the "--long" flag it gets much bigger. There we trigger a test (marked with EXPENSIVE) that adds 100,000 tags, and the script runtime jumps to ~95s. But if we use the same "many tags" repo for that, our runtime drops to just ~37s. This is a pretty easy win to drop the cost of the script. It may even be a larger gain on a heavily loaded system, since one of the main costs here is unpacked refs, which are heavy on system time and I/O costs. It's possible we are reducing test coverage, since all of those other tests were inadvertently using large ref advertisements (and thus could have uncovered some unexpected interaction). But that seems somewhat unlikely; the tests targeted at the large number of refs are doing roughly similar things to the other tests. Note that the real performance culprit is the 100k-tag --long test, not the 2k-tag one. So we could just let the 100k one use its own repo, and keep the 2k tags in the main repo. But since these two tests are somewhat interlinked, it's easier to just move them both (and it does provide a small gain even for the 2000-tag test). I also notice that the 2000-tag test is gated on the CMDLINE_LIMIT prereq, and without that the later EXPENSIVE test will fail (since we won't have a too-many-refs clone). Nobody seems to have noticed or complained after many years, and I left it alone for this patch. Signed-off-by: Jeff King <peff@peff.net> [jc: made the new "many-tags.git" bare to match the original "repo.git"] Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-28Merge branch 'js/http-https-proxy-fix'Junio C Hamano1-0/+2
We lost ability to use https:// proxies during this cycle; this is a hotfix for the regression. * js/http-https-proxy-fix: http: accept https:// proxies again
2026-06-28reftable: fix unlikely leak on API errorJeff King1-4/+4
If the reftable writer sees a bogus block size, we return with REFTABLE_API_ERROR, leaking the reftable_writer struct we previously allocated. Originally this case was a BUG(), but it became a regular return in 445f9f4f35 (reftable: stop using `BUG()` in trivial cases, 2025-02-18). We could obviously fix it by calling "reftable_free(wp)". But we can observe that we never use the allocated "wp" until after we've validated the input options. So let's just bump the allocation down. That fixes the leak, and I think makes the flow of the function more logical (we validate our inputs before doing any work). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-28t/lib-httpd: bump apache timeoutJeff King1-0/+1
Since enabling more tests with 7a094d68a2 (ci: run expensive tests on push builds to integration branches, 2026-05-08), we sometimes see test failures or timeouts in GitHub CI. The culprit seems to be the "enormous ref negotiation" test in t5551, which creates ~100k tag refs in our http server-side repo. Iterating through the loose refs of this repo to generate a ref advertisement can take a long time, especially on a platform with slow I/O. On my otherwise unloaded local machine, a cold cache ref advertisement takes ~10s. On a busy CI machine running tests in parallel, it can presumably top 60s, which runs afoul of Apache's default CGI timeout. The result in t5551 is a test failure, where Apache simply hangs up the connection and the client reports an error. But worse, t5559 runs the same test with HTTP/2, and a bug in Apache causes the connection to hang indefinitely! We eventually see this as a CI timeout after 6 hours. Let's bump Apache's timeout to something much larger: 600 seconds. This doesn't eliminate the possibility of a timeout, but it makes it much less likely. It should eliminate both the test failures and the CI timeouts in practice, and it protects us from running into similar problems with other tests in the future. There are two counter-arguments to consider. One, could/should we just make the test faster? Probably yes. The biggest mistake here is having such an absurd number of unpacked refs on a system which is bottle-necked on I/O. But I think it's worth bumping the timeout so that we can fix this (and possibly other) correctness issues, and then consider performance separately (which we'll do in subsequent patches). And two, is this just papering over a problem that users might see in the real world? We could teach Git to handle this case more gracefully with optimizations or keep-alives. But I think it's really an artificial situation. You need a combination of this silly number of loose refs, plus a very heavily loaded system. If you were trying to run a real server and it took more than 60s to generate the ref advertisement, I don't think the timeout is your biggest problem. Your crappy service is, and you should adjust your resources to match your load. I.e., it is probably reasonable for Git to assume that advertisements happen fast-ish and don't need protocol-level keepalives. Though the patch here is small, tons of work went into analyzing the problem. Many thanks to the contributors credited below. Helped-by: Michael Montalbo <mmontalbo@gmail.com> Helped-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-28http: accept https:// proxies againJohannes Schindelin1-0/+2
Since 663d7abe07ea (http: reject unsupported proxy URL schemes, 2026-05-05), set_curl_proxy_type() returns 0 only for the "http" and SOCKS variants via dedicated early returns, and -1 for everything else. The "https" branch configures the CURL handle for HTTPS proxying but then falls through to the trailing `return -1` intended for unknown schemes, so the caller in get_curl_handle() treats a perfectly valid https:// proxy URL as unsupported and refuses to use it. Noticed while looking into a Coverity report against the same function; the unchecked curl_easy_setopt() return values it flags are orthogonal to this fix. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-28Merge tag 'l10n-2.55.0-v1' of https://github.com/git-l10n/git-poJunio C Hamano13-3760/+9697
l10n-2.55.0-v1 * tag 'l10n-2.55.0-v1' of https://github.com/git-l10n/git-po: l10n: zh-TW.po: Update Chinese (Traditional) translation l10n: uk: add 2.55 translation l10n: ga.po: update for Git 2.55 l10n: fr: mass fix of typos l10n: fr: version 2.55 l10n: po-id for 2.55 l10n: AGENTS.md: add quotation mark preservation guidelines l10n: zh_CN: updated translation for 2.55 l10n: TEAMS: change Simplified Chinese team leader l10n: sv.po: Update Swedish translation l10n: ca.po: update Catalan translation l10n: tr: Update Turkish translations l10n: bg.po: Updated Bulgarian translation (6322t) l10n: it: fix italian usage messages alignment
2026-06-28Merge branch '2.55-uk-pr' of github.com:arkid15r/git-ukrainian-l10nJiang Xin1-617/+1761
* '2.55-uk-pr' of github.com:arkid15r/git-ukrainian-l10n: l10n: uk: add 2.55 translation
2026-06-28Merge branch 'l10n-ga-2.55' of github.com:aindriu80/git-poJiang Xin1-209/+655
* 'l10n-ga-2.55' of github.com:aindriu80/git-po: l10n: ga.po: update for Git 2.55
2026-06-28Merge branch 'l10n/zh-TW/2026-06-26' of github.com:l10n-tw/git-poJiang Xin1-972/+1285
* 'l10n/zh-TW/2026-06-26' of github.com:l10n-tw/git-po: l10n: zh-TW.po: Update Chinese (Traditional) translation
2026-06-28Merge branch 'ca-20260624-b' of github.com:Softcatala/git-poJiang Xin1-427/+994
* 'ca-20260624-b' of github.com:Softcatala/git-po: l10n: ca.po: update Catalan translation
2026-06-28Merge branch 'zh_CN-2.55' of github.com:lilydjwg/git-poJiang Xin2-269/+769
* 'zh_CN-2.55' of github.com:lilydjwg/git-po: l10n: zh_CN: updated translation for 2.55 l10n: TEAMS: change Simplified Chinese team leader
2026-06-28Merge branch 'tr-l10n' of github.com:bitigchi/git-poJiang Xin1-169/+583
* 'tr-l10n' of github.com:bitigchi/git-po: l10n: tr: Update Turkish translations
2026-06-28Merge branch 'po-id' of github.com:bagasme/git-poJiang Xin1-524/+1754
* 'po-id' of github.com:bagasme/git-po: l10n: po-id for 2.55
2026-06-28Merge branch 'master' of github.com:alshopov/git-poJiang Xin1-164/+632
* 'master' of github.com:alshopov/git-po: l10n: bg.po: Updated Bulgarian translation (6322t)
2026-06-28Merge branch 'fr_v2.55' of github.com:jnavila/gitJiang Xin1-225/+611
* 'fr_v2.55' of github.com:jnavila/git: l10n: fr: mass fix of typos l10n: fr: version 2.55
2026-06-28Merge branch 'master' of github.com:nafmo/git-l10n-svJiang Xin1-182/+602
* 'master' of github.com:nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation
2026-06-28l10n: zh-TW.po: Update Chinese (Traditional) translationLumynous1-972/+1285
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2026-06-27push: suggest <remote> <branch> for a slash slipHarald Nordgren5-1/+74
When pushing the 'main' branch to the remote 'origin', i.e., $ git push origin main it is easy to mistakenly write $ git push origin/main That is parsed as the repository to push to, and since 'origin/main' is neither a configured remote nor a path it dies with: fatal: 'origin/main' does not appear to be a git repository Often 'origin/main' does not exist as a repository, so the command fails without doing any harm, but it gives no hint that a space was meant instead of a slash and can leave the user puzzled. When the argument is not an existing path or configured remote but its part before the first slash names one, suggest the intended '<remote> <branch>' form: $ git push origin main The suggestion is shown as advice so it can be silenced with advice.pushRepoLooksLikeRef. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-27branch: suggest <remote>/<branch> on upstream slipHarald Nordgren2-0/+70
When setting the upstream of the current branch to the 'main' branch of the remote 'origin', i.e., $ git branch --set-upstream-to origin/main it is easy to mistakenly write $ git branch --set-upstream-to origin main That is parsed as a request to set the upstream of the local branch 'main' to 'origin'. When 'main' does not exist, the command dies with: fatal: branch 'main' does not exist pointing at a branch the user never meant to name. When 'main' does exist, it instead dies with: fatal: the requested upstream branch 'origin' does not exist leaving the user equally puzzled. When the operated-on branch is missing and '<remote>/<branch>' names a real remote-tracking ref, suggest the intended form: $ git branch --set-upstream-to=origin/main The suggestion is gated on '<remote>/<branch>' existing so it only appears when a slipped slash is the likely explanation. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-27t3420-rebase-autostash: don't try to grep non-existing filesSZEDER Gábor1-1/+1
Several tests in 't3420-rebase-autostash.sh' start various rebase processes that are expected to fail because of merge conflicts. The tests [1] checking that 'git rebase --quit' and autostash work together as expected after such a failure then run '! grep ...' to ensure that the dirty contents of the file is gone. However, due to the test repo's history and the choice of upstream branch that file shouldn't exist in the conflicted state at all, and thus it shouldn't exist after the subsequent 'git rebase --quit' either. Consequently, this 'grep' doesn't fail as expected, i.e. because it can't find the dirty content, but instead it fails, because it can't open the file. Thighten this check by using 'test_path_is_missing' instead, thereby avoiding unexpected errors from 'grep' as well. Previously 2745817028 (t3420-rebase-autostash: don't try to grep non-existing files, 2018-08-22) fixed a couple of similar issues; this one was added later in 9b2df3e8d0 (rebase: save autostash entry into stash reflog on --quit, 2020-04-28). [1] This patch modifies only a single test, but that test is run several times with different strategies ('--apply', '--merge', and '--interactive'), hence the plural "tests". Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-27l10n: uk: add 2.55 translationArkadii Yakovets1-617/+1761
Co-authored-by: Kate Golovanova <kate@kgthreads.com> Signed-off-by: Arkadii Yakovets <ark@cho.red> Signed-off-by: Kate Golovanova <kate@kgthreads.com>
2026-06-27l10n: ga.po: update for Git 2.55Aindriú Mac Giolla Eoin1-209/+655
Signed-off-by: Aindriú Mac Giolla Eoin <aindriu80@gmail.com>
2026-06-27l10n: fr: mass fix of typosJean-Noël Avila1-30/+30
Helped-by: Kévin Leprêtre <k.lepretre@houseofhr.onmicrosoft.com> Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2026-06-27l10n: fr: version 2.55Jean-Noël Avila1-195/+581
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2026-06-27l10n: po-id for 2.55Bagas Sanjaya1-524/+1754
Update following components: * add-patch.c * apply.c * bisect.c * builtin/add.c * builtin/backfill.c * builtin/bisect.c * builtin/cat-file.c * builtin/checkout.c * builtin/config.c * builtin/fast-import.c * builtin/fetch.c * builtin/fsmonitor--daemon.c * builtin/hook.c * builtin/index-pack.c * builtin/interpret-trailers.c * builtin/last-modified.c * builtin/log.c * builtin/multi-pack-index.c * builtin/name-rev.c * builtin/pack-objects.c * builtin/push.c * builtin/repack.c * builtin/replay.c * builtin/repo.c * builtin/show-index.c * builtin/stash.c * builtin/submodule--helper.c * builtin/worktree.c * command-list.h * diff.c * fetch-pack.c * hook.c * list-objects-filter-options.c * lockfile.c * midx-write.c * midx.c * object-file.c * object.c * packfile.c * path-walk.c * pretty.c * promisor-remote.c * pseudo-merge.c * read-cache.c * refs.c * remote-curl.c * repack-midx.c * replay.c * repository.c * revision.c * sequencer.c * setup.c * submodule.c * t/helper/test-path-walk.c * t/helper/test-read-midx.c * trailer.c * git-send-email.perl Translate following new components: * builtin/history.c * builtin/url-parse.c * compat/fsmonitor/fsm-listen-linux.c * sideband.c * t/helper/test-synthesize.c Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2026-06-26refs: protect against chicken-and-egg recursionPatrick Steinhardt1-0/+7
In the preceding commits we have fixed recursion when creating the reference backends due to a chicken-and-egg situation with "onbranch" conditions. Unfortunately, this issue has existed for a while, and we didn't really have a good mechanism to detect this recursion. Improve the status quo by detecting the recursion when creating the main reference store. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26refs/reftable: lazy-load configuration to fix chicken-and-eggPatrick Steinhardt3-61/+116
Same as with the "files" backend, the "reftable" backend also has a chicken-and-egg problem with "onbranch" conditions. Fix this issue the same as we did with the "files" backend by lazy-loading configuration. Now that both the "files" and the "reftable" backend handle this properly, add a generic test to t1400 that verifies that the user can configure "core.logAllRefUpdates" via an "onbranch" condition. This is mostly a nonsensical thing to do in the first place, but it serves as a good sanity check. Note that we had to move `should_write_log()` around so that it can access the new `reftable_be_write_options()` function. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26reftable: split up write optionsPatrick Steinhardt14-198/+258
When initializing the reftable stack the caller may optionally pass some write options. These write options mix up two different concerns though: - Of course, they allow the caller to configure how new reftables are being written. - But they also allow the caller to configure the stack itself, like its hash ID and the `on_reload` callback. This is somewhat awkward, as it doesn't easily give the caller the flexibility to for example write multiple reftables with different options. Furthermore, this requires us to eagerly parse relevant configuration when initializing the reftable backend. Refactor the code by splitting out those options that configure the stack itself. Creating a new stack will thus only require this limited set of options, whereas the caller is expected to pass write options to all functions that end up writing tables. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26refs/files: lazy-load configuration to fix chicken-and-eggPatrick Steinhardt2-11/+54
When initializing the "files" reference backend we read the repository's config to parse "core.preferSymlinkRefs" and "core.logAllRefUpdates". This results in a chicken-and-egg problem though, because parsing the configuration may require us to have access to the reference store already when an "onbranch" condition exists. Luckily, all the configuration that we honor only relates to writing references. Consequently, we don't strictly need that configuration to be readily available at initialization time, and we can easiliy defer parsing it to a later point in time. Implement this fix and add tests that verify that we can indeed properly parse these config knobs via an "onbranch" condition. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26refs: move parsing of "core.logAllRefUpdates" back into ref storesPatrick Steinhardt9-47/+56
In cc42c88945 (refs: extract out reflog config to generic layer, 2026-05-04) we have refactored how we parse "core.logAllRefUpdates" so that it happens in the generic layer. Unfortunately, this has worsened a preexisting issue where we may recurse when creating the reference store because of a chicken-and-egg problem between parsing the configuration and evaluating "onbranch" conditions. Prepare for a fix by essentially reverting that change so that we handle this setting in the respective backends again. The backends are already parsing other configuration anyway, so by moving the logic back in there we can ensure that all backend configuration is parsed the same way. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26repository: free main reference databasePatrick Steinhardt1-0/+5
While we release worktree and submodule reference databases when clearing a repository, we don't ever release the main reference database. This memory leak went unnoticed because its pointer is kept alive by the "chdir_notify" subsystem. Fix the memory leak. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26chdir-notify: drop unused `chdir_notify_reparent()`Patrick Steinhardt2-31/+1
With the preceding commit we've removed all callers of `chdir_notify_reparent()`, so the function is unused now. Drop it. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26refs: unregister reference stores from "chdir_notify"Patrick Steinhardt3-5/+49
When creating reference stores we register them with the "chdir_notify" subsystem. This is required because some of the paths we track may be relative paths, so we have to reparent them in case the current working directory changes. But while we register the reference stores, we never unregister them. This can have multiple outcomes: - For a repository's main reference database we essentially keep the pointer alive. We never free that database, either, and our leak checker doesn't notice because it's still registered. - For submodule and worktree reference databases we do eventually free them in `repo_clear()`, so we may keep pointers to free'd memory registered. We never notice though as we don't tend to chdir around in the middle of the process. We never noticed either of these symptoms, but they are obviously bad. Partially fix those issues by unregistering the reference stores when releasing them. The leak of the main reference database will be fixed in a subsequent commit. Note that this requires us to use `chdir_notify_register()` instead of `chdir_notify_reparent()`, as there is no infrastructure to unregister the latter. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26setup: don't apply "GIT_REFERENCE_BACKEND" without a repositoryPatrick Steinhardt1-20/+19
When discovering a repository we eventually also apply the "GIT_REFERENCE_BACKEND" environment variable to the repository. There's two problems with that: - We do this unconditionally, which is rather pointless: we really only have to configure the repository when we have found one. - We have already applied the repository format at that point in time, so we need to manually reapply it. Move the logic around so that we only apply the environment variable when a repository was discovered. This also allows us to drop the explcit call to `repo_set_ref_storage_format()` because we now adjust the format before we apply it via `apply_repository_format()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26setup: stop applying repository format twicePatrick Steinhardt1-7/+2
When discovering the repository in "setup.c" we apply the final repository format multiple times: - Once via `repository_format_configure()`, where we apply the hash algorithm and ref storage format to both `struct repository_format` and `struct repository`. - And once via `apply_repository_format()`, where we apply these two settings from `struct repository_format` to `struct repository`. With the current flow both of these are in fact necessary. But this is only because we call `repository_format_configure()` after we have called `apply_repository_format()`. Consequently, if we only changed the repository format in `repository_format_configure()` it would never propagate to the repository. Refactor the code so that we first configure the repository format before applying it to the repository so that we can stop setting the hash and reference storage format multiple times. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26setup: inline `check_and_apply_repository_format()`Patrick Steinhardt1-31/+16
We have two callsites of `check_and_apply_repository_format()`. In a subsequent commit we'll want to adapt one of those callsites to change the order in which we read and apply the repository format, at which point the helper function will not really be a good fit for us anymore. Inline the function to both of the callsites. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-26Merge branch 'ps/setup-centralize-odb-creation' into ps/refs-onbranch-fixesJunio C Hamano8-100/+118
* ps/setup-centralize-odb-creation: setup: construct object database in `apply_repository_format()` repository: stop reading loose object map twice on repo init setup: stop initializing object database without repository setup: stop creating the object database in `setup_git_env()` repository: stop initializing the object database in `repo_set_gitdir()` setup: deduplicate logic to apply repository format setup: drop `setup_git_env()` t0001: plug test gaps for git-init(1) with GIT_OBJECT_DIRECTORY
2026-06-26Merge branch 'master' of github.com:mbeniamino/git-poJiang Xin1-1/+1
* 'master' of github.com:mbeniamino/git-po: l10n: it: fix italian usage messages alignment
2026-06-26l10n: AGENTS.md: add quotation mark preservation guidelinesJiang Xin1-1/+50
Add a "Preserving Quotation Marks" section to prevent AI-assisted translation and review from incorrectly converting language-specific UTF-8 curly quotes (e.g., „ U+201E, " U+201C for Bulgarian) into ASCII straight quotes " (U+0022), which would cause PO string truncation and syntax errors. Also update the "Special characters" item in the Quality checklist to reference the new section. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2026-06-26l10n: zh_CN: updated translation for 2.55lilydjwg1-266/+766
Reviewed-by: Jiang Xin <worldhello.net@gmail.com> Reviewed-by: Fangyi Zhou <me@fangyi.io> Signed-off-by: lilydjwg <lilydjwg@gmail.com>
2026-06-26l10n: TEAMS: change Simplified Chinese team leaderlilydjwg1-3/+3
Signed-off-by: lilydjwg <lilydjwg@gmail.com>