summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2026-06-12Merge branch 'ml/repo-discovery'Johannes Sixt2-175/+222
* ml/repo-discovery: git-gui: add gui and pick as explicit subcommands git-gui: check browser/blame arguments carefully git-gui: allow specifying path '.' to the browser git-gui: try harder to find worktree from gitdir git-gui: simplify [is_bare] to report if a worktree is known git-gui: use git rev-parse for worktree discovery git-gui: use rev-parse exclusively to find a repository git-gui: use --absolute-git-dir git-gui: do not change global vars in choose_repository::pick git-gui: guard set/unset of GIT_DIR and GIT_WORK_TREE git-gui: remove unnecessary 'cd $_gitworktree' from do_gitk git-gui: use HEAD as current branch when detached
2026-06-11MyFirstContribution: mention trimming quoted text in repliesWeijie Yuan1-0/+5
ReviewingGuidelines already advises reviewers to trim irrelevant quoted context when replying. Give the same advice to new contributors in MyFirstContribution, so our documentation is consistent about mailing list reply etiquette. Signed-off-by: Weijie Yuan <wy@wyuan.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11doc: git-config: escape erroneous highlight markupTuomas Ahola1-3/+3
Paired octothorpes are used in AsciiDoc to mark highlighted text, <mark> being the equivalent HTML tag. To use the symbol as a literal character, it can be escaped with backticks. Do so in git-config.adoc. While at it, tweak the text slightly to make it scan better. Signed-off-by: Tuomas Ahola <taahol@utu.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11doc: config/sideband: fix description list delimiterTuomas Ahola1-1/+1
Signed-off-by: Tuomas Ahola <taahol@utu.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11doc: config: terminate runaway listsTuomas Ahola4-1/+9
There are many places in git-config(1) where paragraphs that should logically come after a list are instead appended to the last item of the list. This is a well-documented quirk of AsciiDoc, and can be mitigated by enclosing the list in an open block: -- * first item * last item -- + New paragraph after the list. Fix the issue accordingly. Signed-off-by: Tuomas Ahola <taahol@utu.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11bash-completions: add --max-count-oldestMirko Faina1-1/+1
Add missing completion for log --max-count-oldest Signed-off-by: Mirko Faina <mroik@delayed.space> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11t1400: have fifo test clean after itselfJunio C Hamano1-0/+1
One test in this script creates a pair of FIFOs, "in" and "out", that are named so generically that later tests may be tempted to use them. By the time those later tests run a command with its output redirected to the file (e.g., "git foobar >out"), however, nobody is reading from the lingering FIFO, and the test gets blocked forever. Clean them up when the test finishes. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11treewide: drop USE_THE_REPOSITORY_VARIABLEPatrick Steinhardt4-11/+5
Adapt a couple of trivial callers of `is_bare_repository()` to instead use a repository available via the caller's context so that we can drop the `USE_THE_REPOSITORY_VARIABLE` macro. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11environment: stop using `the_repository` in `is_bare_repository()`Patrick Steinhardt19-24/+24
Refactor `is_bare_repository()` to take in a repository parameter so that we no longer depend on `the_repository`. Adjust callers accordingly. Furthermore, move the function outside of the declarations that are only available when `USE_THE_REPOSITORY_VARIABLE` is set, as it no longer depends on that variable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11environment: split up concerns of `is_bare_repository_cfg`Patrick Steinhardt9-14/+39
The `is_bare_repository_cfg` variable tracks two different pieces of information: - It tracks whether the user has invoked git with the "--bare" flag, which makes us treat any discovered Git repository as if it was a bare repository. - Otherwise it tracks whether the discovered `the_repository` is bare. This makes the flag extremely confusing and creates a bit of a challenge when handling multiple repositories in the same process. Split up the concerns of this variable into two pieces: - `startup_info.force_bare_repository` tracks whether the user has passed the "--bare" flag. This is used as a hint to treat newly set up repositories as bare regardless of whether or not they have a worktree. - `struct repository::bare_cfg` tracks whether or not a repository is considered bare. This takes into account both whether the user has passed "--bare" and the discovered state of the repository itself. Whether or not a repository is bare is now resolved when checking the repository's format, and is then later applied to the repository itself via `apply_repository_format()`. This enables a subsequent change where we make `is_bare_repository()` not depend on global state anymore. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11builtin/init: stop modifying `is_bare_repository_cfg`Patrick Steinhardt1-7/+8
We're modifying `is_bare_repository_cfg` in "builtin/init.c" to indicate whether the newly created repository is supposed to be a bare repository or not. This is ultimately unnecessary though: when initializing the repository in `init_db()` we eventually set `is_bare_repository_cfg = !work_tree`, so all that matters is whether or not we have a working tree configured, and the working tree is set up in the non-bare in "builtin/init.c". Stop modifying the global variable in "builtin/init.c" in favor of a local variable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11setup: remove global `git_work_tree_cfg` variablePatrick Steinhardt1-17/+11
The global `git_work_tree_cfg` variable used to be modified by both "setup.c" and by "builtin/init-db.c". We have refactored the latter user to not use that variable at all anymore in a preceding commit, which makes "setup.c" the only remaining user. Even for "setup.c" it is unnecessary though, as we only ever set it to the value we have stored in the discovered repository format. The consequence is that we only ever set it in case we already have it set to the same value in our discovered repository format, which makes it redundant. Refactor the code so that we instead use the worktree configuration as discovered via the repository format. Drop the global variable. Note that in `check_repository_format_gently()` we now have to free the candidate work tree variable. This change is required to retain previous semantics: before we essentially had an implicit `else` branch where we set `git_work_tree_cfg = NULL`, but we were able to elide that branch because we already knew that it would be `NULL` anyway. Now that we use the candidate work tree directly to populate the repository's work tree though we have to clear it to retain those semantics. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11builtin/init: simplify logic to configure worktreePatrick Steinhardt1-13/+18
In the preceding commit we have stopped modifying the global `git_work_tree_cfg` variable. With this change there's now some code paths where we end up setting the local `git_work_tree_cfg` variable, but without actually using the value for anything. Refactor the code a bit so that we only set the worktree configuration in case it's actually needed. Furthermore, reflow it a bit to make the code easier to follow. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11builtin/init: stop modifying global `git_work_tree_cfg` variablePatrick Steinhardt4-4/+7
When executing git-init(1) we need to figure out the final location of the worktree. This location can be configured in a couple of ways: via an environment variable, via the preexisting "core.worktree" config in case we're reinitializing, or implicitly when reinitializing a non-bare repository. When checking for the worktree location in "builtin/init-db.c" we populate any potentially-discovered value both by setting the global `git_work_tree_cfg` variable and via `set_git_work_tree()`, which ultimately ends up modifying `struct repository::worktree`. Modifying `git_work_tree_cfg` is unnecessary though: we configure the worktree in `create_default_files()`, and that function derives the worktree location via `repo_get_work_tree()`. Consequently, propagating the worktree via `set_git_work_tree()` is sufficient. Stop munging `git_work_tree_cfg` and make it file-local to "setup.c" and function-local to `cmd_init_db()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11Git 2.55-rc0v2.55.0-rc0Junio C Hamano2-1/+29
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-11Merge branch 'hn/macos-linker-warning'Junio C Hamano1-0/+6
A linker warning on macOS when building with Xcode 16.3 or newer has been avoided by passing -fno-common to the compiler when a sufficiently new linker is detected. * hn/macos-linker-warning: config.mak.uname: avoid macOS linker warning on Xcode 16.3+
2026-06-11Merge branch 'kk/wildmatch-windows-ls-files-prereq'Junio C Hamano1-6/+13
In t3070-wildmatch, "via ls-files" test variants with patterns containing backslash escapes are now skipped on Windows, avoiding 36 test failures caused by pathspec separator conversion. * kk/wildmatch-windows-ls-files-prereq: t3070: skip ls-files tests with backslash patterns on Windows
2026-06-11Merge branch 'mm/doc-word-diff'Junio C Hamano1-0/+8
The documentation for "--word-diff" has been extended with a bit of implementation detail of where these different words come from. * mm/doc-word-diff: doc: clarify that --word-diff operates on line-level hunks
2026-06-11Merge branch 'lp/http-fetch-pack-index-leak-fix'Junio C Hamano1-5/+5
A memory leak in `fetch_and_setup_pack_index()` when verification of the downloaded pack index fails has been plugged. Also an obsolete `unlink()` call on parse failure has been cleaned up. * lp/http-fetch-pack-index-leak-fix: http: fix memory leak in fetch_and_setup_pack_index() http: cleanup function fetch_and_setup_pack_index()
2026-06-11Merge branch 'ps/odb-source-loose'Junio C Hamano15-870/+973
The loose object source has been refactored into a proper `struct odb_source`. * ps/odb-source-loose: odb/source-loose: drop pointer to the "files" source odb/source-loose: stub out remaining callbacks odb/source-loose: wire up `write_object_stream()` callback object-file: refactor writing objects to use loose source odb/source-loose: wire up `write_object()` callback loose: refactor object map to operate on `struct odb_source_loose` odb/source-loose: wire up `freshen_object()` callback odb/source-loose: drop `odb_source_loose_has_object()` odb/source-loose: wire up `count_objects()` callback odb/source-loose: wire up `find_abbrev_len()` callback odb/source-loose: wire up `for_each_object()` callback odb/source-loose: wire up `read_object_stream()` callback odb/source-loose: wire up `read_object_info()` callback odb/source-loose: wire up `close()` callback odb/source-loose: wire up `reprepare()` callback odb/source-loose: start converting to a proper `struct odb_source` odb/source-loose: store pointer to "files" instead of generic source odb/source-loose: move loose source into "odb/" subsystem
2026-06-11Merge branch 'mm/line-log-cleanup'Junio C Hamano8-56/+120
The `git log -L` implementation has been refactored to use the standard diff output pipeline, enabling pickaxe and diff-filter to work as expected. Additionally, metadata-only diff formats like --raw and --name-only are now supported with -L. * mm/line-log-cleanup: line-log: allow non-patch diff formats with -L line-log: integrate -L output with the standard log-tree pipeline revision: move -L setup before output_format-to-diff derivation
2026-06-11Merge branch 'st/daemon-sockaddr-fixes'Junio C Hamano1-10/+21
Correct use of sockaddr API in "git daemon". * st/daemon-sockaddr-fixes: daemon: guard NULL REMOTE_PORT in execute() logging daemon: fix IPv6 address truncation in ip2str() daemon: fix IPv6 address corruption in lookup_hostname()
2026-06-10describe: limit default ref iteration to tagsTamir Duberstein2-0/+15
Without --all, git describe ignores refs outside refs/tags/. Commit 8a5a1884e9 (Avoid accessing non-tag refs in git-describe unless --all is requested, 2008-02-24) moved this check ahead of object lookup. That avoided loading objects for irrelevant refs, but the backend still has to yield every ref before get_name() can reject it. Pass refs/tags/ to the iterator so the backend can avoid visiting those refs in the first place. The new perf test creates 10,000 unrelated packed refs. It measures: git describe --exact-match HEAD The runtime drops from 0.03(0.01+0.01) to 0.02(0.00+0.00). In a repository with 120,532 refs but only 330 tags, the same command went from 171.7 ms to 9.9 ms. Signed-off-by: Tamir Duberstein <tamird@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-10Merge branch 'ps/setup-centralize-odb-creation' into ps/setup-drop-global-stateJunio 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-09unpack-trees: use repository from index instead of globalJayesh Daga1-7/+7
unpack_trees() currently initializes its repository from the global 'the_repository', even though a repository instance is already available via the source index. Use 'o->src_index->repo' instead of the global variable, reducing reliance on global repository state. This is a step towards eliminating global repository usage in unpack_trees(). Suggested-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Jayesh Daga <jayeshdaga99@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-09transport-helper: fix TSAN race in transfer_debug()Pushkar Singh2-12/+8
Currently, transfer_debug() lazily initializes a static variable based on GIT_TRANSLOOP_DEBUG. Since the function may be called from multiple worker threads, this initialization is racy and is therefore suppressed in .tsan-suppressions. Initialize the variable in bidirectional_transfer_loop() before any worker threads or processes are created. This patch removes the race and allows dropping the corresponding TSAN suppression. Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-09prio-queue: fold lazy_queue into prio_queue for automatic get+put fusionKristofer Karlsson6-132/+78
Defer the actual removal in prio_queue_get() until the next operation. If that next operation is a prio_queue_put(), the removal and insertion are fused into a single replace — writing the new element at the root and sifting it down — which avoids a full remove-rebalance-insert cycle. This matches the dominant usage pattern in git's commit traversal: get a commit, then put its parents. The first parent insertion after each get is now a replace operation automatically. This generalizes the lazy_queue pattern from builtin/describe.c (introduced in 08bb69d70f) into prio_queue itself. Three callers independently implemented the same get+put fusion: - builtin/describe.c had a full lazy_queue wrapper - commit.c:pop_most_recent_commit() used peek+replace - builtin/show-branch.c:join_revs() used peek+replace All three now collapse to plain _get() and _put(), with the data structure handling the fusion internally. This simplifies callers and means every prio_queue user gets the optimization for free without needing to implement it manually. Remove prio_queue_replace() since no external callers remain. Benchmarked on a 1.8M-commit monorepo (30 interleaved runs, paired t-test, Xeon @ 2.20GHz): Code paths that previously did eager get+put (new optimization): Command base patched change p merge-base --all A A~1000 3828ms 3725ms -2.69% 0.0001 rev-list --count A~1000..A 3055ms 2986ms -2.27% 0.0601 log --oneline A~1000..A 3408ms 3350ms -1.71% 0.0482 Code paths that already had manual get+put fusion (expect neutral — the optimization moves into prio_queue but the number of heap operations stays the same): Command base patched change p show-branch A A~1000 9156ms 9127ms -0.32% 0.3470 describe (4751 revs, 81K repo) 1983ms 1963ms -1.02% <0.001 No regressions in any scenario. Suggested-by: René Scharfe <l.s.r@web.de> Signed-off-by: Kristofer Karlsson <krka@spotify.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-09prio-queue: rename .nr to .nr_ and add accessor helpersKristofer Karlsson14-70/+85
Rename the .nr member to .nr_ so that callers outside prio-queue.c that directly reference .nr get a compilation error. This catches both existing misuse and future in-flight topics. Add prio_queue_size() for callers that need to know the element count and prio_queue_for_each() for callers that need to walk all elements. Convert all external .nr users: - Loop conditions: use prio_queue_size(), prio_queue_get(), or prio_queue_peek() as the loop condition - Array iterations: use prio_queue_for_each() Signed-off-by: Kristofer Karlsson <krka@spotify.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-09The 13th batchJunio C Hamano1-0/+30
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-09Merge branch 'jc/doc-monitor-ghci'Junio C Hamano1-0/+11
Encourage original authors to monitor the CI status. * jc/doc-monitor-ghci: SubmittingPatches: proactively monitor GHCI pages
2026-06-09Merge branch 'ib/doc-push-default-simple'Junio C Hamano1-3/+4
The documentation for `push.default = simple` has been clarified to better explain its behavior, making it clear that it pushes the current branch to a same-named branch on the remote, and detailing the upstream requirements for centralized workflows. * ib/doc-push-default-simple: doc: clarify push.default=simple behavior
2026-06-09Merge branch 'gh/jump-auto-mode'Junio C Hamano2-3/+35
The 'git-jump' command (in contrib/) has been taught to automatically pick a mode (merge, diff, or ws) when invoked without arguments. * gh/jump-auto-mode: git-jump: pick a mode automatically when invoked without arguments
2026-06-09Merge branch 'rs/strbuf-add-oid-hex'Junio C Hamano14-17/+37
Formatting object name in full hexadecimal form has been optimized by using a new strbuf_add_oid_hex() helper function. * rs/strbuf-add-oid-hex: hex: add and use strbuf_add_oid_hex()
2026-06-09Merge branch 'rs/strbuf-add-uint'Junio C Hamano5-14/+38
Adding a decimal integer with strbuf_addf("%u") appears commonly; they have been optimized by using a custom formatter. * rs/strbuf-add-uint: ls-tree: use strbuf_add_uint() ls-files: use strbuf_add_uint() cat-file: use strbuf_add_uint() strbuf: add strbuf_add_uint()
2026-06-09Merge branch 'ua/push-remote-group'Junio C Hamano7-85/+502
"git push" learned to take a "remote group" name to push to, which causes pushes to multiple places, just like "git fetch" would do. * ua/push-remote-group: push: support pushing to a remote group remote: move remote group resolution to remote.c remote: fix sign-compare warnings in push_cas_option
2026-06-09Merge branch 'th/promisor-quiet-per-repo'Junio C Hamano2-2/+45
The "promisor.quiet" configuration variable was not used from relevant submodules when commands like "grep --recurse-submodules" triggered a lazy fetch, which has been corrected. * th/promisor-quiet-per-repo: promisor-remote: fix promisor.quiet to use the correct repository
2026-06-09Merge branch 'tb/bitmap-build-performance'Junio C Hamano2-61/+377
Reachability bitmap generation has been significantly optimized. By reordering tree traversal, caching object positions, and refining how pseudo-merge bitmaps are constructed, the performance of "git repack --write-midx-bitmaps" is improved, especially for large repositories and when using pseudo-merges. * tb/bitmap-build-performance: pack-bitmap: build pseudo-merge bitmaps after regular bitmaps pack-bitmap: remember pseudo-merge parents pack-bitmap: sort bitmaps before XORing pack-bitmap: cache object positions during fill pack-bitmap: consolidate `find_object_pos()` success path pack-bitmap: reuse stored selected bitmaps pack-bitmap: check subtree bits before recursing pack-bitmap: pass object position to `fill_bitmap_tree()`
2026-06-08doc: fix typos via codespellAndrew Kreimer24-69/+69
There are some typos in the documentation, comments, etc. Fix them via codespell, and then adjust the "dump" files used by the subversion tests to match the updated contents. Signed-off-by: Andrew Kreimer <algonell@gmail.com> [dscho noticed and fixed the problems in svn test] Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> [jc did final assembling of the three patches] Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-07The 12th batchJunio C Hamano1-0/+24
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-07Merge branch 'ja/doc-synopsis-style-again'Junio C Hamano12-341/+346
A batch of documentation pages has been updated to use the modern synopsis style. * ja/doc-synopsis-style-again: doc: convert git-imap-send synopsis and options to new style doc: convert git-apply synopsis and options to new style doc: convert git-am synopsis and options to new style doc: convert git-grep synopsis and options to new style doc: git bisect: clarify the usage of the synopsis vs actual command doc: convert git-bisect to synopsis style
2026-06-07Merge branch 'kk/commit-reach-optim'Junio C Hamano2-28/+80
The check for non-stale commits in the priority queue used by `paint_down_to_common` and `ahead_behind` has been optimized by replacing an O(N) scan with an O(1) counter, yielding performance improvements in repositories with wide histories. * kk/commit-reach-optim: commit-reach: replace queue_has_nonstale() scan with O(1) tracking commit-reach: deduplicate queue entries in paint_down_to_common object.h: fix stale entries in object flag allocation table
2026-06-07Merge branch 'aj/stash-patch-optimize-temporary-index'Junio C Hamano2-6/+107
"git stash -p" has been optimized by reusing cached index entries in its temporary index, avoiding unnecessary lstat() calls on unchanged files. * aj/stash-patch-optimize-temporary-index: stash: reuse cached index entries in --patch temporary index
2026-06-07Merge branch 'kh/free-commit-list'Junio C Hamano4-24/+5
Code clean-up. * kh/free-commit-list: commit: remove deprecated functions *: replace deprecated free_commit_list
2026-06-07Merge branch 'ds/restore-sparse-index'Junio C Hamano2-6/+109
'git restore --staged' has been optimized to avoid unnecessarily expanding the sparse index when operating on paths within the sparse checkout definition, by handling sparse directory entries at the tree level. * ds/restore-sparse-index: restore: avoid sparse index expansion t1092: test 'git restore' with sparse index
2026-06-07Merge branch 'ar/receive-pack-worktree-env'Junio C Hamano2-1/+12
The GIT_WORK_TREE variable prepared to invoke the push-to-checkout hook was leaking into the environment even when there was no hook used and broke the default push-to-deploy (i.e., let "git checkout" update the working tree only when the working tree is clean). * ar/receive-pack-worktree-env: receive-pack: fix updateInstead with core.worktree
2026-06-06git-gui: silence install recipes under "make -s"Harald Nordgren1-4/+2
Several install and uninstall recipes embed "echo" calls that fire as part of the recipe itself, so the install banners (DEST, INSTALL, LINK, REMOVE) were visible whenever the variables expand non-empty. Guard the whole "ifndef V" block on "-s" so the loud variants are selected only when "-s" is absent and V=1 is unset. The existing "-s" check also had its findstring arguments in the wrong order (needle "-s" never fit in haystack "s"), so swap them while moving the check to wrap the block. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2026-06-06doc: fix typo in GIT_ALTERNATE_OBJECT_DIRECTORIESAlexander Monakov1-1/+1
One file accidentally spelled GIT_ALTERNATE_OBJECT_DIRECTORIES with REPOSITORIES instead of DIRECTORIES. Fix the typo. Signed-off-by: Alexander Monakov <amonakov@ispras.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-05Documentation: remove redundant 'instead' in --subject-prefixLucas Seiki Oshiro1-4/+3
The documentation for --subject-prefix has two words "instead" in the same sentence, making it a little bit confusing to read. Change the order of the phrase to a more natural "Use [...] instead of [...]" structure. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-05mingw: really handle SIGINTJohannes Schindelin1-0/+9
Previously, we did not install any handler for Ctrl+C, but now we really want to because the MSYS2 runtime learned the trick to call the ConsoleCtrlHandler when Ctrl+C was pressed. With this, hitting Ctrl+C while `git log` is running will only terminate the Git process, but not the pager. This finally matches the behavior on Linux and on macOS. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-05mingw: kill child processes in a gentler wayJohannes Schindelin2-7/+185
The TerminateProcess() function does not actually leave the child processes any chance to perform any cleanup operations. This is bad insofar as Git itself expects its signal handlers to run. A symptom is e.g. a left-behind .lock file that would not be left behind if the same operation was run, say, on Linux. To remedy this situation, we use an obscure trick: we inject a thread into the process that needs to be killed and to let that thread run the ExitProcess() function with the desired exit status. Thanks J Wyman for describing this trick. The advantage is that the ExitProcess() function lets the atexit handlers run. While this is still different from what Git expects (i.e. running a signal handler), in practice Git sets up signal handlers and atexit handlers that call the same code to clean up after itself. In case that the gentle method to terminate the process failed, we still fall back to calling TerminateProcess(), but in that case we now also make sure that processes spawned by the spawned process are terminated; TerminateProcess() does not give the spawned process a chance to do so itself. Please note that this change only affects how Git for Windows tries to terminate processes spawned by Git's own executables. Third-party software that *calls* Git and wants to terminate it *still* need to make sure to imitate this gentle method, otherwise this patch will not have any effect. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>