forked from git-for-windows/git
-
Notifications
You must be signed in to change notification settings - Fork 0
index.html: replace outdated FAQ link #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git for Windows' wiki pages were moved as part of git-for-windows/git-for-windows.github.io#59. Let's adjust the FAQ URL that pointed to the wiki. Signed-off-by: Johannes Schindelin <[email protected]>
mjcheetham
approved these changes
Mar 19, 2025
gitforwindowshelper bot
pushed a commit
that referenced
this pull request
Jun 3, 2025
The GitHub's CI workflow uses 'actions/checkout@v4' to checkout the repository. This action defaults to using the GitHub REST API to obtain the repository if the `git` executable isn't available. The step to build Git in the GitHub workflow can be summarized as: ... - uses: actions/checkout@v4 #1 - run: ci/install-dependencies.sh #2 ... - run: sudo --preserve-env --set-home --user=builder ci/run-build-and-tests.sh git-for-windows#3 ... Step #1, clones the repository, since the `git` executable isn't present at this step, it uses GitHub's REST API to obtain a tar of the repository. Step #2, installs all dependencies, which includes the `git` executable. Step git-for-windows#3, sets up the build, which includes setting up meson in the meson job. At this point the `git` executable is present. This means while the `git` executable is present, the repository doesn't contain the '.git' folder. To keep both the CI's (GitLab and GitHub) behavior consistent and to ensure that the build is performed on a real-world scenario, install `git` before the repository is checked out. This ensures that 'actions/checkout@v4' will clone the repository instead of using a tarball. We also update the package cache while installing `git`, this is because some distros will fail to locate the package without updating the cache. Helped-by: Phillip Wood <[email protected]> Signed-off-by: Karthik Nayak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
gitforwindowshelper bot
pushed a commit
that referenced
this pull request
Aug 5, 2025
find_cfg_ent() allocates a struct reflog_expire_entry_option via
FLEX_ALLOC_MEM and inserts it into a linked list in the
reflog_expire_options structure. The entries in this list are never
freed, resulting in a leak in cmd_reflog_expire and the gc reflog expire
maintenance task:
Direct leak of 39 byte(s) in 1 object(s) allocated from:
#0 0x7ff975ee6883 in calloc (/lib64/libasan.so.8+0xe6883)
#1 0x0000010edada in xcalloc ../wrapper.c:154
#2 0x000000df0898 in find_cfg_ent ../reflog.c:28
git-for-windows#3 0x000000df0898 in reflog_expire_config ../reflog.c:70
git-for-windows#4 0x00000095c451 in configset_iter ../config.c:2116
git-for-windows#5 0x0000006d29e7 in git_config ../config.h:724
git-for-windows#6 0x0000006d29e7 in cmd_reflog_expire ../builtin/reflog.c:205
git-for-windows#7 0x0000006d504c in cmd_reflog ../builtin/reflog.c:419
git-for-windows#8 0x0000007e4054 in run_builtin ../git.c:480
git-for-windows#9 0x0000007e4054 in handle_builtin ../git.c:746
git-for-windows#10 0x0000007e8a35 in run_argv ../git.c:813
git-for-windows#11 0x0000007e8a35 in cmd_main ../git.c:953
git-for-windows#12 0x000000441e8f in main ../common-main.c:9
git-for-windows#13 0x7ff9754115f4 in __libc_start_call_main (/lib64/libc.so.6+0x35f4)
git-for-windows#14 0x7ff9754116a7 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x36a7)
git-for-windows#15 0x000000444184 in _start (/home/jekeller/libexec/git-core/git+0x444184)
Close this leak by adding a reflog_clear_expire_config() function which
iterates the linked list and frees its elements. Call it upon exit of
cmd_reflog_expire() and reflog_expire_condition().
Add a basic test which covers this leak. While at it, cover the
functionality from commit commit 3cb22b8 (Per-ref reflog expiry
configuration, 2008-06-15). We've had this support for years, but lacked
any tests.
Co-developed-by: Jeff King <[email protected]>
Signed-off-by: Jacob Keller <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
gitforwindowshelper bot
pushed a commit
that referenced
this pull request
Sep 29, 2025
The fill_packs_from_midx() method was refactored in fcb2205 (midx: implement support for writing incremental MIDX chains, 2024-08-06) to allow for preferred packfiles and incremental multi-pack-indexes. However, this led to some conditions that can cause improperly initialized memory in the context's list of packfiles. The conditions caring about the preferred pack name or the incremental flag are currently necessary to load a packfile. But the context is still being populated with pack_info structs based on the packfile array for the existing multi-pack-index even if prepare_midx_pack() isn't called. Add a new test that breaks under --stress when compiled with SANITIZE=address. The chosen number of 100 packfiles was selected to get the --stress output to fail about 50% of the time, while 50 packfiles could not get a failure in most --stress runs. The test case is marked as EXPENSIVE not only because of the number of packfiles it creates, but because some CI environments were reporting errors during the test that I could not reproduce, specifically around being unable to open the packfiles or their pack-indexes. When it fails under SANITIZE=address, it provides the following error: AddressSanitizer:DEADLYSIGNAL ================================================================= ==3263517==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000027 ==3263517==The signal is caused by a READ memory access. ==3263517==Hint: address points to the zero page. #0 0x562d5d82d1fb in close_pack_windows packfile.c:299 #1 0x562d5d82d3ab in close_pack packfile.c:354 #2 0x562d5d7bfdb4 in write_midx_internal midx-write.c:1490 git-for-windows#3 0x562d5d7c7aec in midx_repack midx-write.c:1795 git-for-windows#4 0x562d5d46fff6 in cmd_multi_pack_index builtin/multi-pack-index.c:305 ... This failure stack trace is disconnected from the real fix because the bad pointers are accessed later when closing the packfiles from the context. There are a few different aspects to this fix that are worth noting: 1. We return to the previous behavior of fill_packs_from_midx to not rely on the incremental flag or existence of a preferred pack. 2. The behavior to scan all layers of an incremental midx is kept, so this is not a full revert of the change. 3. We skip allocating more room in the pack_info array if the pack fails prepare_midx_pack(). 4. The method has always returned 0 for success and 1 for failure, but the condition checking for error added a check for a negative result for failure, so that is now updated. 5. The call to open_pack_index() is removed, but this is needed later in the case of a preferred pack. That call is moved to immediately before its result is needed (checking for the object count). Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
gitforwindowshelper bot
pushed a commit
that referenced
this pull request
Jan 16, 2026
When pushing to a set of remotes using a nickname for the group, the
client initializes the connection to each remote, talks to the
remote and reads and parses capabilities line, and holds the
capabilities in a file-scope static variable server_capabilities_v1.
There are a few other such file-scope static variables, and these
connections cannot be parallelized until they are refactored to a
structure that keeps track of active connections.
Which is *not* the theme of this patch ;-)
For a single connection, the server_capabilities_v1 variable is
initialized to NULL (at the program initialization), populated when
we talk to the other side, used to look up capabilities of the other
side possibly multiple times, and the memory is held by the variable
until program exit, without leaking. When talking to multiple remotes,
however, the server capabilities from the second connection overwrites
without freeing the one from the first connection, which leaks.
==1080970==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 421 byte(s) in 2 object(s) allocated from:
#0 0x5615305f849e in strdup (/home/gitster/g/git-jch/bin/bin/git+0x2b349e) (BuildId: 54d149994c9e85374831958f694bd0aa3b8b1e26)
#1 0x561530e76cc4 in xstrdup /home/gitster/w/build/wrapper.c:43:14
#2 0x5615309cd7fa in process_capabilities /home/gitster/w/build/connect.c:243:27
git-for-windows#3 0x5615309cd502 in get_remote_heads /home/gitster/w/build/connect.c:366:4
git-for-windows#4 0x561530e2cb0b in handshake /home/gitster/w/build/transport.c:372:3
git-for-windows#5 0x561530e29ed7 in get_refs_via_connect /home/gitster/w/build/transport.c:398:9
git-for-windows#6 0x561530e26464 in transport_push /home/gitster/w/build/transport.c:1421:16
git-for-windows#7 0x561530800bec in push_with_options /home/gitster/w/build/builtin/push.c:387:8
git-for-windows#8 0x5615307ffb99 in do_push /home/gitster/w/build/builtin/push.c:442:7
git-for-windows#9 0x5615307fe926 in cmd_push /home/gitster/w/build/builtin/push.c:664:7
git-for-windows#10 0x56153065673f in run_builtin /home/gitster/w/build/git.c:506:11
git-for-windows#11 0x56153065342f in handle_builtin /home/gitster/w/build/git.c:779:9
git-for-windows#12 0x561530655b89 in run_argv /home/gitster/w/build/git.c:862:4
git-for-windows#13 0x561530652cba in cmd_main /home/gitster/w/build/git.c:984:19
git-for-windows#14 0x5615308dda0a in main /home/gitster/w/build/common-main.c:9:11
git-for-windows#15 0x7f051651bca7 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
SUMMARY: AddressSanitizer: 421 byte(s) leaked in 2 allocation(s).
Free the capablities data for the previous server before overwriting
it with the next server to plug this leak.
The added test fails without the freeing with SANITIZE=leak; I
somehow couldn't get it fail reliably with SANITIZE=leak,address
though.
Signed-off-by: Junio C Hamano <[email protected]>
gitforwindowshelper bot
pushed a commit
that referenced
this pull request
Jan 16, 2026
When performing auto-maintenance we check whether commit graphs need to
be generated by counting the number of commits that are reachable by any
reference, but not covered by a commit graph. This search is performed
by iterating through all references and then doing a depth-first search
until we have found enough commits that are not present in the commit
graph.
This logic has a memory leak though:
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x55555562e433 in malloc (git+0xda433)
#1 0x555555964322 in do_xmalloc ../wrapper.c:55:8
#2 0x5555559642e6 in xmalloc ../wrapper.c:76:9
git-for-windows#3 0x55555579bf29 in commit_list_append ../commit.c:1872:35
git-for-windows#4 0x55555569f160 in dfs_on_ref ../builtin/gc.c:1165:4
git-for-windows#5 0x5555558c33fd in do_for_each_ref_iterator ../refs/iterator.c:431:12
git-for-windows#6 0x5555558af520 in do_for_each_ref ../refs.c:1828:9
git-for-windows#7 0x5555558ac317 in refs_for_each_ref ../refs.c:1833:9
git-for-windows#8 0x55555569e207 in should_write_commit_graph ../builtin/gc.c:1188:11
git-for-windows#9 0x55555569c915 in maintenance_is_needed ../builtin/gc.c:3492:8
git-for-windows#10 0x55555569b76a in cmd_maintenance ../builtin/gc.c:3542:9
git-for-windows#11 0x55555575166a in run_builtin ../git.c:506:11
git-for-windows#12 0x5555557502f0 in handle_builtin ../git.c:779:9
git-for-windows#13 0x555555751127 in run_argv ../git.c:862:4
git-for-windows#14 0x55555575007b in cmd_main ../git.c:984:19
git-for-windows#15 0x5555557523aa in main ../common-main.c:9:11
git-for-windows#16 0x7ffff7a2a4d7 in __libc_start_call_main (/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libc.so.6+0x2a4d7) (BuildId: cddea92d6cba8333be952b5a02fd47d61054c5ab)
git-for-windows#17 0x7ffff7a2a59a in __libc_start_main@GLIBC_2.2.5 (/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libc.so.6+0x2a59a) (BuildId: cddea92d6cba8333be952b5a02fd47d61054c5ab)
git-for-windows#18 0x5555555f0934 in _start (git+0x9c934)
The root cause of this memory leak is our use of `commit_list_append()`.
This function expects as parameters the item to append and the _tail_ of
the list to append. This tail will then be overwritten with the new tail
of the list so that it can be used in subsequent calls. But we call it
with `commit_list_append(parent->item, &stack)`, so we end up losing
everything but the new item.
This issue only surfaces when counting merge commits. Next to being a
memory leak, it also shows that we're in fact miscounting as we only
respect children of the last parent. All previous parents are discarded,
so their children will be disregarded unless they are hit via another
reference.
While crafting a test case for the issue I was puzzled that I couldn't
establish the proper border at which the auto-condition would be
fulfilled. As it turns out, there's another bug: if an object is at the
tip of any reference we don't mark it as seen. Consequently, if it is
the tip of or reachable via another ref, we'd count that object multiple
times.
Fix both of these bugs so that we properly count objects without leaking
any memory.
Signed-off-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
gitforwindowshelper bot
pushed a commit
that referenced
this pull request
Jan 16, 2026
It is possible to hit a memory leak when reading data from a submodule
via git-grep(1):
Direct leak of 192 byte(s) in 1 object(s) allocated from:
#0 0x55555562e726 in calloc (git+0xda726)
#1 0x555555964734 in xcalloc ../wrapper.c:154:8
#2 0x555555835136 in load_multi_pack_index_one ../midx.c:135:2
git-for-windows#3 0x555555834fd6 in load_multi_pack_index ../midx.c:382:6
git-for-windows#4 0x5555558365b6 in prepare_multi_pack_index_one ../midx.c:716:17
git-for-windows#5 0x55555586c605 in packfile_store_prepare ../packfile.c:1103:3
git-for-windows#6 0x55555586c90c in packfile_store_reprepare ../packfile.c:1118:2
git-for-windows#7 0x5555558546b3 in odb_reprepare ../odb.c:1106:2
git-for-windows#8 0x5555558539e4 in do_oid_object_info_extended ../odb.c:715:4
git-for-windows#9 0x5555558533d1 in odb_read_object_info_extended ../odb.c:862:8
git-for-windows#10 0x5555558540bd in odb_read_object ../odb.c:920:6
git-for-windows#11 0x55555580a330 in grep_source_load_oid ../grep.c:1934:12
git-for-windows#12 0x55555580a13a in grep_source_load ../grep.c:1986:10
git-for-windows#13 0x555555809103 in grep_source_is_binary ../grep.c:2014:7
git-for-windows#14 0x555555807574 in grep_source_1 ../grep.c:1625:8
git-for-windows#15 0x555555807322 in grep_source ../grep.c:1837:10
git-for-windows#16 0x5555556a5c58 in run ../builtin/grep.c:208:10
git-for-windows#17 0x55555562bb42 in void* ThreadStartFunc<false>(void*) lsan_interceptors.cpp.o
git-for-windows#18 0x7ffff7a9a979 in start_thread (/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libc.so.6+0x9a979) (BuildId: cddea92d6cba8333be952b5a02fd47d61054c5ab)
git-for-windows#19 0x7ffff7b22d2b in __GI___clone3 (/nix/store/xx7cm72qy2c0643cm1ipngd87aqwkcdp-glibc-2.40-66/lib/libc.so.6+0x122d2b) (BuildId: cddea92d6cba8333be952b5a02fd47d61054c5ab)
The root caues of this leak is the way we set up and release the
submodule:
1. We use `repo_submodule_init()` to initialize a new repository. This
repository is stored in `repos_to_free`.
2. We now read data from the submodule repository.
3. We then call `repo_clear()` on the submodule repositories.
4. `repo_clear()` calls `odb_free()`.
5. `odb_free()` calls `odb_free_sources()` followed by `odb_close()`.
The issue here is the 5th step: we call `odb_free_sources()` _before_ we
call `odb_close()`. But `odb_free_sources()` already frees all sources,
so the logic that closes them in `odb_close()` now becomes a no-op. As a
consequence, we never explicitly close sources at all.
Fix the leak by closing the store before we free the sources.
Signed-off-by: Patrick Steinhardt <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Yet another follow-up for git-for-windows/git-for-windows.github.io#59.