aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2025-08-04Merge branch 'kn/for-each-ref-skip-updates'Junio C Hamano5-11/+33
Code clean-up. * kn/for-each-ref-skip-updates: ref-filter: use REF_ITERATOR_SEEK_SET_PREFIX instead of '1' t6302: add test combining '--start-after' with '--exclude' for-each-ref: reword the documentation for '--start-after' for-each-ref: fix documentation argument ordering ref-cache: use 'size_t' instead of int for length
2025-08-04Merge branch 'jt/switch-restore-no-longer-experimental'Junio C Hamano2-4/+0
"git switch" and "git restore" are declared to be no longer experimental. * jt/switch-restore-no-longer-experimental: builtin: unmark git-switch and git-restore as experimental
2025-08-04Merge branch 'jb/t7510-gpg-program-path'Junio C Hamano1-1/+11
A new test to ensure that a recent change will keep working. * jb/t7510-gpg-program-path: t7510: use $PWD instead of $(pwd) inside PATH t7510: add test cases for non-absolute gpg program
2025-08-04Merge branch 'cc/t9350-cleanup'Junio C Hamano1-124/+91
Test clean-up. * cc/t9350-cleanup: t9350: redirect input to only fast-import
2025-08-04Merge branch 'hy/blame-simplify-get-commit-info'Junio C Hamano1-11/+4
Code simplification. * hy/blame-simplify-get-commit-info: blame: remove parameter detailed in get_commit_info()
2025-08-03The seventeenth batch, just before -rc0Junio C Hamano1-0/+17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-03Merge branch 'hl/test-helper-fd-close'Junio C Hamano2-53/+27
A few file descriptors left unclosed upon program completion in a few test helper programs are now closed. * hl/test-helper-fd-close: test-delta: close output descriptor after use test-delta: use strbufs to hold input files test-delta: handle errors with die() t/helper/test-truncate: close file descriptor after truncation
2025-08-03Merge branch 'ow/rebase-verify-insn-fmt-before-initializing-state'Junio C Hamano2-21/+31
"git rebase -i" with bogus rebase.instructionFormat configuration failed to produce the todo file after recording the state files, leading to confused "git status"; this has been corrected. * ow/rebase-verify-insn-fmt-before-initializing-state: rebase: write script before initializing state
2025-08-03Merge branch 'ps/object-store-midx'Junio C Hamano10-124/+107
Redefine where the multi-pack-index sits in the object subsystem, which recently was restructured to allow multiple backends that support a single object source that belongs to one repository. A midx does span mulitple "object sources". * ps/object-store-midx: midx: remove now-unused linked list of multi-pack indices packfile: stop using linked MIDX list in `get_all_packs()` packfile: stop using linked MIDX list in `find_pack_entry()` packfile: refactor `get_multi_pack_index()` to work on sources midx: stop using linked list when closing MIDX packfile: refactor `prepare_packed_git_one()` to work on sources midx: start tracking per object database source
2025-08-03Merge branch 'kn/for-each-ref-skip'Junio C Hamano15-243/+584
"git for-each-ref" learns "--start-after" option to help applications that want to page its output. * kn/for-each-ref-skip: ref-cache: set prefix_state when seeking for-each-ref: introduce a '--start-after' option ref-filter: remove unnecessary else clause refs: selectively set prefix in the seek functions ref-cache: remove unused function 'find_ref_entry()' refs: expose `ref_iterator` via 'refs.h'
2025-08-01The sixteenth batchJunio C Hamano1-0/+22
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-01Merge branch 'sk/reftable-clarify-tests'Junio C Hamano14-1331/+1117
The reftable unit tests are now ported to the "clar" unit testing framework. * sk/reftable-clarify-tests: t/unit-tests: finalize migration of reftable-related tests t/unit-tests: convert reftable stack test to use clar t/unit-tests: convert reftable record test to use clar t/unit-tests: convert reftable readwrite test to use clar t/unit-tests: convert reftable table test to use clar t/unit-tests: convert reftable pq test to use clar t/unit-tests: convert reftable merged test to use clar t/unit-tests: convert reftable block test to use clar t/unit-tests: convert reftable basics test to use clar test framework t/unit-tests: implement clar specific reftable test helper functions
2025-08-01Merge branch 'ly/pull-autostash'Junio C Hamano3-3/+93
"git pull" learned to pay attention to pull.autostash configuration variable, which overrides rebase/merge.autostash. * ly/pull-autostash: pull: add pull.autoStash config option
2025-08-01Merge branch 'jc/document-test-balloons-in-flight'Junio C Hamano1-0/+8
To help our developers, document what C99 language features are being considered for adoption, in addition to what past experiments have already decided. * jc/document-test-balloons-in-flight: CodingGuidelines: document test balloons in flight
2025-08-01Merge branch 'ag/imap-send-list-folders-doc'Junio C Hamano1-0/+28
Document recently added "git imap-send --list" with an example. * ag/imap-send-list-folders-doc: docs: explain how to use `git imap-send --list` command to get a list of available folders
2025-08-01Merge branch 'cb/meson-avoid-broken-macos-pcre2'Junio C Hamano2-2/+28
Build fix for macOS. * cb/meson-avoid-broken-macos-pcre2: meson: work around broken system PCRE2 dependency in macOS
2025-08-01Merge branch 'jc/ci-print-test-failures-fix'Junio C Hamano1-1/+1
CI fix. * jc/ci-print-test-failures-fix: ci: allow github-actions print test failures again
2025-08-01Merge branch 'jk/unleak-reflog-expire-entry'Junio C Hamano5-0/+48
Leakfix. * jk/unleak-reflog-expire-entry: reflog: close leak of reflog expire entry
2025-08-01Merge branch 'jc/do-not-scan-argv-without-parsing'Junio C Hamano1-9/+13
Update a hard-to-read in-code NEEDSWORK comment. * jc/do-not-scan-argv-without-parsing: rev-list: update a NEEDSWORK comment
2025-08-01Merge branch 'jk/revision-no-early-output'Junio C Hamano3-154/+0
Remove unsupported, unused, and unsupportable old option from "git log". * jk/revision-no-early-output: revision: drop early output option
2025-08-01Merge branch 'jc/rev-list-info-cleanup'Junio C Hamano2-8/+8
Move structure definition from unrelated header file to where it belongs. * jc/rev-list-info-cleanup: rev-list: make "struct rev_list_info" static to the only user
2025-07-29t7510: use $PWD instead of $(pwd) inside PATHJeff King1-1/+1
On Windows, $(pwd) will give us a Windows-style path like "D:/foo". Putting that into $PATH confuses anybody parsing that variable, since colon is a separator character in $PATH. Instead, we should use the Unix-style value we get from $PWD ("/d/foo"). This is similar to the cases fixed by 71dd50472d (t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables, 2016-11-11). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28blame: remove parameter detailed in get_commit_info()Han Young1-11/+4
The get_commit_info() function accepts a parameter that can be used to stop the commit parsing early. However, none of the callers use this feature, and testing proved that the performance gain of stopping parsing early is negligible and unmeasurable. Signed-off-by: Han Young <hanyang.tony@bytedance.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28builtin: unmark git-switch and git-restore as experimentalJustin Tobler2-4/+0
In 4e43b7ff (Declare both git-switch and git-restore experimental, 2019-04-25), the newly introduced git-switch(1) and git-restore(1) commands were marked as experimental. This was done to provide time to make breaking changes to the interface. It has now been over six years since these commands were implemented and there hasn't been much change. Consequently, users have grown to rely on how these commands work and it is no longer feasible to make any breaking changes. Let's remove the experimental label for git-switch(1) and git-restore(1). Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28ref-filter: use REF_ITERATOR_SEEK_SET_PREFIX instead of '1'Karthik Nayak1-2/+3
In the commit 51511d68f4 (for-each-ref: introduce a '--start-after' option, 2025-07-15), for introducing the '--start-after' flag, the `ref_iterator_seek()` was modified to also accept a flag. This was to allow the function to also set the prefix when 'REF_ITERATOR_SEEK_SET_PREFIX' was set. In `do_filter_refs()` instead of passing the flag, we pass in '1' which is the value of the flag. While this works, this is definitely hard to read and introduces inconsistency. Change it to use the flag. While here, remove the unnecessary 'if (prefix)' clause in the 'else' statement, since the block already checks for 'prefix'. Reported-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28t6302: add test combining '--start-after' with '--exclude'Karthik Nayak1-0/+19
The '--start-after' doesn't explicitly mention being compatible with the '--exclude' flag, generally only incompatibility is explicitly called out. However, it would be nice to test the compatibility between the two to avoid future regressions. Let's do that. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28for-each-ref: reword the documentation for '--start-after'Karthik Nayak2-2/+3
The documentation for '--start-after' states that the flag cannot be used with general pattern matching. This is a bit vague, since there is no clear understanding about what 'general' means here. Rewrite the sentence to be more specific. While here, fix a typo in the 'OPT_STRING'. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28for-each-ref: fix documentation argument orderingKarthik Nayak1-5/+5
Improve the 'git-for-each-ref(1)' documentation with two corrections: 1. Add parentheses around `--exclude=<pattern>` to indicate this option can be repeated as a complete unit. 2. Move `--stdin | <pattern> ...` to the end, after all flags, since `<pattern>` is a positional argument that should appear last in the argument list. While here, change to using the synopsis block which will automatically format placeholders in italics and keywords in monospace. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28ref-cache: use 'size_t' instead of int for lengthKarthik Nayak1-2/+3
The commit 090eb5336c (refs: selectively set prefix in the seek functions, 2025-07-15) modified the ref-cache iterator to support seeking to a specified marker without setting the prefix. The commit adds and uses an integer 'len' to capture the length of the seek marker to compare with the entries of a given directory. Since the type of the variable is 'int', this is met with a typecast of converting a `strlen` to 'int' so it can be assigned to the 'len' variable. This is whole operation is a bit wrong: 1. Since the 'len' variable is eventually used in a 'strncmp', it should have been of type 'size_t'. 2. This also truncates the value provided from 'strlen' to an int, which could cause a large refname to produce a negative number. Let's do the correct thing here and simply use 'size_t' for `len`. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28The fifteenth batchJunio C Hamano1-0/+9
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-28Merge branch 'ac/auto-comment-char-fix'Junio C Hamano3-3/+22
"git commit" that concludes a conflicted merge failed to notice and remove existing comment added automatically (like "# Conflicts:") when the core.commentstring is set to 'auto'. * ac/auto-comment-char-fix: config: set comment_line_str to "#" when core.commentChar=auto commit: avoid scanning trailing comments when 'core.commentChar' is "auto"
2025-07-28Merge branch 'rs/pop-recent-commit-with-prio-queue'Junio C Hamano10-34/+170
The pop_most_recent_commit() function can have quite expensive worst case performance characteristics, which has been optimized by using prio-queue data structure. * rs/pop-recent-commit-with-prio-queue: commit: use prio_queue_replace() in pop_most_recent_commit() prio-queue: add prio_queue_replace() commit: convert pop_most_recent_commit() to prio_queue
2025-07-28t9350: redirect input to only fast-importChristian Couder1-124/+91
A number of tests in "t9350-fast-export.sh" are using sub-shells to redirect content to a number of commands instead of only `git fast-import`. This is confusing and possibly error-prone, so let's change those tests so that no sub-shell is used and the content goes only to `git fast-import`. Reported-by: Elijah Newren <newren@gmail.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24The fourteenth batchJunio C Hamano1-0/+18
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24Merge branch 'bc/contribution-under-non-real-names'Junio C Hamano1-2/+9
Document that we do not require "real" name when signing your patches off. * bc/contribution-under-non-real-names: SubmittingPatches: allow non-real name contributions
2025-07-24Merge branch 'rj/meson-libexecdir-fix'Junio C Hamano2-21/+22
Meson-based build did not handle libexecdir setting correctly, which has been corrected. * rj/meson-libexecdir-fix: po/meson.build: add missing 'ga' language code meson: fix installation when -Dlibexexdir is set
2025-07-24Merge branch 'ss/compat-bswap-revamp'Junio C Hamano1-64/+46
Clean-up compat/bswap.h mess. * ss/compat-bswap-revamp: bswap.h: provide a built-in based version of bswap32/64 if possible bswap.h: remove optimized x86 version of bswap32/64 bswap.h: always overwrite ntohl/ ntohll macros bswap.h: define GIT_LITTLE_ENDIAN on msvc as little endian bswap.h: add support for __BYTE_ORDER__
2025-07-24Merge branch 'pw/config-kvi-remove-path'Junio C Hamano2-17/+13
Remove a redundant member from kvi struct. * pw/config-kvi-remove-path: config: remove unneeded struct field
2025-07-24Merge branch 'kl/test-installed-fix'Junio C Hamano1-2/+3
GIT_TEST_INSTALLED was not honored in the recent topic related to SHA256 hashes, which has been corrected. * kl/test-installed-fix: test-lib: respect GIT_TEST_INSTALLED when querying default hash
2025-07-24Merge branch 'pw/adopt-c99-bool-officially'Junio C Hamano4-26/+29
Declare weather-balloon we raised for "bool" type 18 months ago a success and officially allow using the type in our codebase. * pw/adopt-c99-bool-officially: strbuf: convert predicates to return bool git-compat-util: convert string predicates to return bool CodingGuidelines: allow the use of bool
2025-07-24ref-cache: set prefix_state when seekingKarthik Nayak1-0/+1
In 090eb5336c (refs: selectively set prefix in the seek functions, 2025-07-15) we separated the seeking functionality of reference iterators from the functionality to set prefix to an iterator. This allows users of ref iterators to seek to a particular reference to provide pagination support. The files-backend, uses the ref-cache iterator to iterate over loose refs. The iterator tracks directories and entries already processed via a stack of levels. Each level corresponds to a directory under the files backend. New levels are added to the stack, and when all entries from a level is yielded, the corresponding level is popped from the stack. To accommodate seeking, we need to populate and traverse the levels to stop the requested seek marker at the appropriate level and its entry index. Each level also contains a 'prefix_state' which is used for prefix matching, this allows the iterator to skip levels/entries which don't match a prefix. The default value of 'prefix_state' is PREFIX_CONTAINS_DIR, which yields all entries within a level. When purely seeking without prefix matching, we want to yield all entries. The commit however, skips setting the value explicitly. This causes the MemorySanitizer to issue a 'use-of-uninitialized-value' error when running 't/t6302-for-each-ref-filter'. Set the value explicitly to avoid to fix the issue. Reported-by: Kyle Lippincott <spectral@google.com> Helped-by: Kyle Lippincott <spectral@google.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: finalize migration of reftable-related testsSeyi Kuforiji15-179/+38
The old `lib-reftable.{c,h}` implemented helper functions for our homegrown unit-testing framework. As part of migrating reftable-related tests to the Clar framework, Clar-specific versions of these functions in `lib-reftable-clar.{c,h}` were introduced. Now that all test files using these helpers have been converted to Clar, we can safely remove the original `lib-reftable.{c,h}` and rename the Clar- specific versions back to `lib-reftable.{c,h}`. This restores a clean and consistent naming scheme for shared test utilities. Finally, update our build system to reflect the changes made and remove redundant code related to the reftable tests and our old homegrown unit-testing setup. `test-lib.{c,h}` remains unchanged in our build system as some files particularly `t/helper/test-example-tap.c` depends on it in order to run, and removing that would be beyond the scope of this patch. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: convert reftable stack test to use clarSeyi Kuforiji3-454/+332
Adapt reftable stack test file to use clar by using clar assertions where necessary. This marks the end of all unit tests migrated away from the `unit-tests/t-*.c` pattern, there are no longer any files matching that glob. Remove the sanity check for `t-*.c` files to prevent Meson configuration errors during CI and local builds. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: convert reftable record test to use clarSeyi Kuforiji3-122/+131
Adapt reftable record test file to use clar by using clar assertions where necessary. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: convert reftable readwrite test to use clarSeyi Kuforiji3-230/+179
Adapt reftable readwrite test file to use clar by using clar assertions where necessary. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: convert reftable table test to use clarSeyi Kuforiji3-44/+38
Adapt reftable table test file to use clar by using clar assertions where necessary. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: convert reftable pq test to use clarSeyi Kuforiji3-34/+30
Adapt reftable priority queue test file to use clar by using clar assertions where necessary. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: convert reftable merged test to use clarSeyi Kuforiji3-94/+72
Adapt reftable merged test file to use clar testing framework by using clar assertions where necessary. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: convert reftable block test to use clarSeyi Kuforiji3-88/+80
Adapt reftable block test file to use clar testing framework by using clar assertions where necessary. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: convert reftable basics test to use clar test frameworkSeyi Kuforiji4-221/+229
Adapt reftable basics test file to clar by using clar assertions where necessary.Break up test edge case to improve modularity and clarity. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24t/unit-tests: implement clar specific reftable test helper functionsSeyi Kuforiji4-1/+124
Helper functions defined in `t/unit-tests/lib-reftable.{c,h}` are required for the reftable-related test files to run. In the current implementation these functions are designed to conform with our homegrown unit-testing structure. So in other to convert the reftable test files, there is need for a clar specific implementation of these helper functions. Implement equivalent helper functions in `lib-reftable-clar.{c,h}` to use clar. These functions conform with the clar testing framework and become available for all reftable-related test files implemented using the clar testing framework, which requires them. This will be used by subsequent commits. Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24test-delta: close output descriptor after useJeff King1-0/+2
After we write to the output file, the program exits. This naturally closes the descriptor. But we should do an explicit close for two reasons: 1. It's possible to hit an error on close(), which we should detect and report via our exit code. 2. Leaking descriptors is a bad practice in general. Even if it isn't meaningful here, it sets a bad example. It is tempting to write: if (write_in_full(fd, ...) < 0 || close(fd) < 0) die_errno(...); But that pattern contains a subtle problem that has resulted in descriptor leaks before. If write_in_full() fails, we'll short-circuit and never call close(), leaking the descriptor. That's not a problem here, since our error path dies instead of returning up the stack. But since we're trying to set a good example, let's write it out as two separate conditions. As a bonus, that lets us produce a slightly more specific error message. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24test-delta: use strbufs to hold input filesJeff King1-26/+14
We want to read the whole contents of two files into memory. If we switch from raw ptr/len pairs to strbufs, we can use strbuf_read_file() to shorten the code. This incidentally fixes two small bugs: 1. We stat() the files and allocate our buffers based on st.st_size. But that is an off_t which may be larger than the size_t we'd use to allocate. We should use xsize_t() to do a checked conversion. Otherwise integer truncation (on a file >4GB) could cause us to under-allocate (though in practice this does not result in a buffer overflow because the same truncation happens when read_in_full() also takes a size_t). 2. We get the size from st.st_size, and then try to read_in_full() that many bytes. But it may return fewer bytes than expected (if the file changed racily and we get an early EOF), leading us to read uninitialized bytes in the allocated buffer. We don't notice because we only check the value for error, not that we got the expected number of bytes. The strbuf code doesn't run into this, because it just reads to EOF, expanding the buffer dynamically as necessary. Neither bug is a big deal for a test helper, but fixing them is a nice bonus on top of simplifying the code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24test-delta: handle errors with die()Jeff King1-37/+18
This is a short test helper that does all of its work in the main function. When we encounter an error, we try to clean up memory and descriptors and then jump to an error return, which exits the program. We can get the same effect by just calling die(), which means we do not have to bother with cleaning up. This simplifies the code, and also removes some inconsistencies where a few code paths forgot to clean up descriptors (though in practice it was not a big deal since we were exiting anyway). In addition to die() and die_errno(), we'll also use a few of our usual helpers like xopen() and usage() that make things more ergonomic. This does change the exit code in these cases from 1 to 128, but I don't think it matters (and arguably is better, as we'd already exit 128 for other errors like xmalloc() failure). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24CodingGuidelines: document test balloons in flightJunio C Hamano1-0/+8
Due to portability concerns, we do not blindly say "It is in [[this standard]], so we will make liberal use of it" for many features, and use of C99 language features follow this same principle. When we contemplate adopting a language feature that we haven't used in our codebase, we typically first raise a test balloon, which - is a piece of code that exercises the language feature we are trying to see if it is OK to adopt - is in a small section of code that we know everybody who cares about having a working Git must be compiling - is in a fairly stable part of the code, to allow reverting it easily if some platforms do not understand it yet. After a few years, with no breakage report from the community, we'd declare that the feature is now safe to use in our codebase. Before that, we forbid the use of the language construct except for the designated test balloon code site. The CodingGuidelines document lists these selected features that we already have determined that they are safe, and also those features that we know some platforms had trouble with. Let's also start listing ongoing test balloons and expected timeline for adoption. Recently phillip proposed to adopt the syntax to spell a structure literally (i.e. compound literal) with a new test balloon, which Patrick made redundant by pointing out an existing one we had already.but without documenting it. Start the new section with an entry for that test balloon. Helped-by: Patrick Steinhardt <ps@pks.im> Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23The thirteenth batchJunio C Hamano1-0/+13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23Merge branch 'cc/fast-import-export-signature-names'Junio C Hamano7-44/+312
Clean up the way how signature on commit objects are exported to and imported from fast-import stream. * cc/fast-import-export-signature-names: fast-(import|export): improve on commit signature output format
2025-07-23Merge branch 'ps/sane-ctype-workaround'Junio C Hamano1-0/+9
Our <sane-ctype.h> header file relied on that the system-supplied <ctype.h> header is not later included, which would override our macro definitions, but "amazon linux" broke this assumption. Fix this by preemptively including <ctype.h> near the beginning of <sane-ctype.h> ourselves. * ps/sane-ctype-workaround: sane-ctype: fix compiler error on Amazon Linux 2
2025-07-23Merge branch 'ly/changed-paths-traversal'Junio C Hamano8-100/+204
Lift the limitation to use changed-path filter in "git log" so that it can be used for a pathspec with multiple literal paths. * ly/changed-paths-traversal: bloom: optimize multiple pathspec items in revision revision: make helper for pathspec to bloom keyvec bloom: replace struct bloom_key * with struct bloom_keyvec bloom: rename function operates on bloom_key bloom: add test helper to return murmur3 hash
2025-07-22reflog: close leak of reflog expire entryJacob Keller5-0/+48
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 #3 0x000000df0898 in reflog_expire_config ../reflog.c:70 #4 0x00000095c451 in configset_iter ../config.c:2116 #5 0x0000006d29e7 in git_config ../config.h:724 #6 0x0000006d29e7 in cmd_reflog_expire ../builtin/reflog.c:205 #7 0x0000006d504c in cmd_reflog ../builtin/reflog.c:419 #8 0x0000007e4054 in run_builtin ../git.c:480 #9 0x0000007e4054 in handle_builtin ../git.c:746 #10 0x0000007e8a35 in run_argv ../git.c:813 #11 0x0000007e8a35 in cmd_main ../git.c:953 #12 0x000000441e8f in main ../common-main.c:9 #13 0x7ff9754115f4 in __libc_start_call_main (/lib64/libc.so.6+0x35f4) #14 0x7ff9754116a7 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x36a7) #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 3cb22b8efe (Per-ref reflog expiry configuration, 2008-06-15). We've had this support for years, but lacked any tests. Co-developed-by: Jeff King <peff@peff.net> Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-22t/helper/test-truncate: close file descriptor after truncationHoyoung Lee1-0/+3
Fix a resource leak where the file descriptor was not closed after truncating a file in t/helper/test-truncate.c. Signed-off-by: Hoyoung Lee <lhywkd22@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-22Merge branch 'master' of https://github.com/j6t/git-guiJunio C Hamano32-2818/+2028
* 'master' of https://github.com/j6t/git-gui: (26 commits) git-gui: eliminate _search_exe git-gui: remove procs gitexec and _git_cmd git-gui: use dashless 'git cmd' form for read/write git-gui: default to full copy for linked worktrees git-gui: use git-clone git-gui: remove non-ttk code git-gui: remove ${NS} indirection for ttk git-gui: always use themed widgets from ttk git-gui: remove redundant check for Tk >= 8.5 git-gui: remove unreachable Tk 8.4 code git-gui: remove unused git-version git-gui: use git_init to create new repository dir git-gui: git-remote is always available git-gui: git merge understands --strategy=recursive git-gui: git-diff knows submodules and textconv git-gui: git-blame understands -w and textconv git-gui: git rev-parse knows show_toplevel git-gui: use git-branch --show-current git-gui: git-diff-index always knows submodules git-gui: git ls-files knows --exclude-standard ...
2025-07-22Merge branch 'master' of https://github.com/j6t/gitkJunio C Hamano1-632/+504
* 'master' of https://github.com/j6t/gitk: (21 commits) gitk: remove header of now empty section "General options" gitk: separate upstream refs when using the sort-by-type option gitk: make 'sort-refs-by-type' optional and persistent gitk: sort by ref type on the 'tags and heads' view gitk: choosefont - remove a stray debugging line gitk: allow horizontal commit-graph scrolling gitk: update aqua scrolling for TclTk 8.6 / TIP171 gitk: update x11 scrolling for TclTk 8.6 / TIP 171 gitk: update win32 scrolling for Tk 8.6 / TIP 171 gitk: mousewheel scrolling functions for Tk 8.6 gitk: wheel scrolling multiplier preference gitk: separate x11 / win32 / aqua Mouse bindings gitk: remove non-ttk support code gitk: replace ${NS} with ttk gitk: always use themed Tk (ttk) gitk: use $config_variables as list for save/restore gitk: remove implementations for Tcl/Tk < 8.6 gitk: Make TclTk 8.6 the minimum, allow 8.7 gitk: remove code targeting git <= 1.7.2 gitk: require git >= 2.20 ...
2025-07-22t7510: add test cases for non-absolute gpg programJonas Brandstötter1-1/+11
These cases cover scenarios where `gpg.program` is set as a program in `$PATH` or as a path relative to the user's home directory. Signed-off-by: Jonas Brandstötter <jonas.brandstoetter@gmx.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-22gitk: remove header of now empty section "General options"Johannes Sixt1-2/+0
An earlier commit remove the only option that was available under "General options". We don't need the header for the empty section. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-22Merge branch 'ml/abandon-old-version' (early part)Johannes Sixt1-602/+401
* 'ml/abandon-old-version' (early part): gitk: allow horizontal commit-graph scrolling gitk: update aqua scrolling for TclTk 8.6 / TIP171 gitk: update x11 scrolling for TclTk 8.6 / TIP 171 gitk: update win32 scrolling for Tk 8.6 / TIP 171 gitk: mousewheel scrolling functions for Tk 8.6 gitk: wheel scrolling multiplier preference gitk: separate x11 / win32 / aqua Mouse bindings gitk: remove non-ttk support code gitk: replace ${NS} with ttk gitk: always use themed Tk (ttk) gitk: use $config_variables as list for save/restore gitk: remove implementations for Tcl/Tk < 8.6 gitk: Make TclTk 8.6 the minimum, allow 8.7 gitk: remove code targeting git <= 1.7.2 gitk: require git >= 2.20
2025-07-22Merge branch 'mr/sort-refs-by-type'Johannes Sixt1-14/+57
* mr/sort-refs-by-type: gitk: separate upstream refs when using the sort-by-type option gitk: make 'sort-refs-by-type' optional and persistent gitk: sort by ref type on the 'tags and heads' view
2025-07-22Merge branch 'ti/support-sha256'Johannes Sixt1-25/+58
* ti/support-sha256: gitk: Add support of SHA256 repositories
2025-07-22docs: explain how to use `git imap-send --list` command to get a list of ↵Aditya Garg1-0/+28
available folders The output `git imap-send --list` command can be a bit confusing for new users since the IMAP LIST command output is very verbose. Help such users to analyse the same by using an example output. Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-22Merge branch 'ml/abandon-old-versions'Johannes Sixt7-685/+92
* ml/abandon-old-versions: git-gui: eliminate _search_exe git-gui: remove procs gitexec and _git_cmd git-gui: use dashless 'git cmd' form for read/write git-gui: default to full copy for linked worktrees git-gui: use git-clone git-gui: remove unused git-version git-gui: use git_init to create new repository dir git-gui: git-remote is always available git-gui: git merge understands --strategy=recursive git-gui: git-diff knows submodules and textconv git-gui: git-blame understands -w and textconv git-gui: git rev-parse knows show_toplevel git-gui: use git-branch --show-current git-gui: git-diff-index always knows submodules git-gui: git ls-files knows --exclude-standard git-gui: require git >= 2.36 Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-22Merge branch 'ml/tcl86'Johannes Sixt28-540/+361
* ml/tcl86: git-gui: remove non-ttk code git-gui: remove ${NS} indirection for ttk git-gui: always use themed widgets from ttk git-gui: remove redundant check for Tk >= 8.5 git-gui: remove unreachable Tk 8.4 code git-gui: Make TclTk 8.6 the minimum, allow 8.7 Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-22commit: use prio_queue_replace() in pop_most_recent_commit()René Scharfe1-2/+9
Optimize pop_most_recent_commit() by adding the first parent using the more efficient prio_queue_peek() and prio_queue_replace() instead of prio_queue_get() and prio_queue_put(). On my machine this neutralizes the performance hit it took in Git's own repository when we converted it to prio_queue two patches ago (git_pq): $ hyperfine -w3 -L git ./git_2.50.1,./git_pq,./git '{git} rev-parse :/^Initial.revision' Benchmark 1: ./git_2.50.1 rev-parse :/^Initial.revision Time (mean ± σ): 1.073 s ± 0.003 s [User: 1.053 s, System: 0.019 s] Range (min … max): 1.069 s … 1.078 s 10 runs Benchmark 2: ./git_pq rev-parse :/^Initial.revision Time (mean ± σ): 1.077 s ± 0.002 s [User: 1.057 s, System: 0.018 s] Range (min … max): 1.072 s … 1.079 s 10 runs Benchmark 3: ./git rev-parse :/^Initial.revision Time (mean ± σ): 1.069 s ± 0.003 s [User: 1.049 s, System: 0.018 s] Range (min … max): 1.065 s … 1.074 s 10 runs Summary ./git rev-parse :/^Initial.revision ran 1.00 ± 0.00 times faster than ./git_2.50.1 rev-parse :/^Initial.revision 1.01 ± 0.00 times faster than ./git_pq rev-parse :/^Initial.revision Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-22prio-queue: add prio_queue_replace()René Scharfe3-13/+63
Add a function to replace the top element of the queue that basically does the same as prio_queue_get() followed by prio_queue_put(), but without the work by prio_queue_get() to rebalance the heap. It can be used to optimize loops that get one element and then immediately add another one. That's common e.g., with commit history traversal, where we get out a commit and then put in its parents. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-22commit: convert pop_most_recent_commit() to prio_queueRené Scharfe7-21/+100
pop_most_recent_commit() calls commit_list_insert_by_date() for parent commits, which is itself called in a loop. This can lead to quadratic complexity if there are many merges. Replace the commit_list with a prio_queue to ensure logarithmic worst case complexity and convert all three users. Add a performance test that exercises one of them using a pathological history that consists of 50% merges and 50% root commits to demonstrate the speedup: Test v2.50.1 HEAD ---------------------------------------------------------------------- 1501.2: rev-parse ':/65535' 2.48(2.47+0.00) 0.20(0.19+0.00) -91.9% Alas, sane histories don't benefit from the conversion much, and traversing Git's own history takes a 1% performance hit on my machine: $ hyperfine -w3 -L git ./git_2.50.1,./git '{git} rev-parse :/^Initial.revision' Benchmark 1: ./git_2.50.1 rev-parse :/^Initial.revision Time (mean ± σ): 1.071 s ± 0.004 s [User: 1.052 s, System: 0.017 s] Range (min … max): 1.067 s … 1.078 s 10 runs Benchmark 2: ./git rev-parse :/^Initial.revision Time (mean ± σ): 1.079 s ± 0.003 s [User: 1.060 s, System: 0.017 s] Range (min … max): 1.074 s … 1.083 s 10 runs Summary ./git_2.50.1 rev-parse :/^Initial.revision ran 1.01 ± 0.00 times faster than ./git rev-parse :/^Initial.revision Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-22rev-list: update a NEEDSWORK commentJunio C Hamano1-9/+13
The comment is poorly phrased and it in't clear what it wanted to say. Strongly discourage this broken pattern to be copied and pasted to other code paths. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-21rev-list: make "struct rev_list_info" static to the only userJunio C Hamano2-8/+8
The structure has nothing to do with what "git bisect" does; as nobody other than "git rev-list" implementation uses it, move it as a private data type to builtin/rev-list.c Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-21git-gui: eliminate _search_exeMark Levedahl1-5/+3
git-gui has _search_exe as needed to give the executable suffix (.exe) on Windows. But, the prior commit eliminated the only user of this variable. Delete it. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-21git-gui: remove procs gitexec and _git_cmdMark Levedahl2-67/+2
gitexec looks up and caches the method to execute git subcommands using the long deprecated dashed form if found in $(git--exec-path). But, git_read and git_write now use the dashless form, by-passing gitexec. This leaves two remaining uses of gitexec: one during startup to define use of an ssh_key helper, and one in the about dialog box. These are neither performance critical nor likely to be called more than once, so do not justify an otherwise unused cacheing system. Let's change those two uses, making gitexec unused. This allows removing gitexec and _git_cmd. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-21git-gui: use dashless 'git cmd' form for read/writeMark Levedahl1-10/+10
git-gui implements its own approach to locating and running various git subcommands, bypassing git's capabilities for running git-*. This was written in 2007: at that time, many git commands were shell-scripts stored in $(git --exec-path), git's run-command api was not well adapted to Windows and had serious performance issues when it worked at all, and running subcommand 'git foo' as 'git-foo' was common and fully supported. On Windows, git-gui searches $(git --exec-path) for builtin commands, then attempts to find an interpreter on PATH to run those, invoking these differently than on other platforms. For instance, the explicit shebang #!/usr/bin/perl found in a script will be run by the first Perl interpreter found on $PATH, which might not be at that specific location so could be different than what git would run. The various issues leading to the current implemention no longer exist. Most git commands are now builtins, links to run those are not installed in $(git --exec-path) by default (the "dashless" form is recommended instead), and git's run-command api works well everywhere. So, let's use git to launch its subcommands on all platforms. Do so by modifying procs git_read and git_write to use the "dashless" form for invoking git commands, avoiding the search for git-<foo>. This leaves _git_cmd unused with cleanup in a later patch. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-21git-gui: default to full copy for linked worktreesMark Levedahl1-0/+19
git-gui's default clone method is git-clone's default, and this uses hardlinks rather than copying the objects directory for local repositories. However, this method explicitly fails if a symlink (or .gitfile) exists in the path to the objects directory. Thus, the default clone option fails for worktrees created by git-new-workdir or git-worktree. git-gui's original do_clone trapped this error for a symlinked git-new-workdir tree, directly falling back to a full clone, while the updated git-gui using git-clone does not. (The old do_clone could not handle gitfile linked worktrees, however). Let's apply the more friendly fallback to a full clone in both these cases where git-clone behavior throws an error on the default method. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-21git-gui: use git-cloneMark Levedahl2-435/+34
git-gui clones a repository by invoking git-plumbing commands, in proc do_clone, rather than using git-clone. The justification was that the low-level commands are guaranteed to provide a stable interface, while the higher level commands such as git-clone may not be stable. This approach requires git-gui to continually evolve by mirroring new features in git itself, which has not happened, while the user interface in git-clone has proven very stable. Also, git-gui does directly call many other non-plumbing commands in git's repertoire. do_clone's last significant functionality change was in 2015, and updates are required for shallow clones, the reftable backend, cloning from linked worktrees, and perhaps other features and bugs. For instance, I had reports of git-gui failing to correctly clone repositories prior to 2015, resulting in essentially the patch given here. The only significant work was supporting .gitfile linked worktrees unknown to do_clone, but supported by git-clone, and none regarding the interface to git-clone itself. That interface is clearly stable enough to not be a problem. Supporting new use-cases with this requires exposing new options in the clone dialog, then passing flags to git-clone. This avoids updating do_clone to understand those options, reducing the maintenance burdens. So, teach git-gui to use git-clone. This change is in one patch as there is no obvious incremental path to migration. The existing dialog / options / status screen are unchanged, the known user-visible changes are that cloning from a working directory linked by a gitfile now works, there is no auto-fallback to a full copy when cloning linked workdirs and worktrees (meaning git-clone fails unless a full or shared copy is selected), and messages displayed are from git-clone. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-21pull: add pull.autoStash config optionLidong Yan3-3/+93
Git uses `rebase.autostash` or `merge.autostash` to determine whether a dirty worktree is allowed during pull. However, this behavior is not clearly documented, making it difficult for users to discover how to enable autostash, or causing them to unknowingly enable it. Add new config option `pull.autostash` along with its documentation and test cases. `pull.autostash` provides the same functionality as `rebase.autostash` and `merge.autostash`, but overrides them when set. If `pull.autostash` is not set, it falls back to `rebase.autostash` or `merge.autostash`, depending on the value of `pull.rebase`. Signed-off-by: Lidong Yan <yldhome2d2@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-21revision: drop early output optionJeff King3-154/+0
We added the --early-output feature long ago in cdcefbc971 (Add "--early-output" log flag for interactive GUI use, 2007-11-03). The idea was that GUIs could use it to progressively render a history view, showing something quick-and-inaccurate at first and then enhancing it later. But we never documented it, and it appears never to have been used, even by the projects which initially expressed interest. There was an RFC patch for gitk to use it: http://public-inbox.org/git/18221.2285.259487.655684@cargo.ozlabs.ibm.com/ but it was never merged. Likewise QGit had a patch in: https://lore.kernel.org/git/e5bfff550711040225ne67c907r2023b1354c35f35@mail.gmail.com/ but it was never fully merged (to this day, QGit has a commented-out line to add "--early-output" to the "log" invocation). Searching for other mentions on the web or forges like github.com turns up nothing. Meanwhile, the feature has been broken off and on over the years without anybody noticing (and naturally, there are no tests, either). From 2011 to 2017 the option didn't even turn on via "--early-output"; this was fixed in e35b6ac56f (revision.h: turn rev_info.early_output back into an unsigned int, 2017-06-10). It worked for a while then, but it does not interact well at all with commit-graphs (which are turned on by default these days). The main logic to count early commits is triggered by limit_list(), which we traditionally invoked when showing output in topo-order (and --early-output always enables --topo-order). But that changed in f0d9cc4196 (revision.c: begin refactoring --topo-order logic, 2018-11-01). Now when we have generation numbers, we skip limit_list() entirely, and the early-output code shows no commits, and just the final header "Final output: 1 done". Which is syntactically OK, but semantically wrong: that message should give the total number of commits we're about to show. So let's drop the feature. It is extra code that is untested and undocumented, and makes working on the revision machinery more brittle. Given the history above, it seems unlikely that anybody is using it (or has used it), and we can drop it without the usual deprecation period. A gentler option might be to "soft" drop it: keep accepting the option, have it imply --topo-order as it does now, print "Final output: 1 done", and then do our regular traversal. That would keep any hypothetical caller working. But it doesn't seem worth the hassle to me. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-21The twelfth batchJunio C Hamano1-0/+19
2025-07-21Merge branch 'jb/gpg-program-variable-is-a-pathname'Junio C Hamano2-2/+2
The gpg.program configuration variable, which names a pathname to the (custom) GPG compatible program, can now be spelled with ~tilde expansion. * jb/gpg-program-variable-is-a-pathname: gpg-interface: expand gpg.program as a path
2025-07-21Merge branch 'cb/daemon-reap-children'Junio C Hamano3-6/+11
Futz with SIGCHLD handling in "git daemon". * cb/daemon-reap-children: daemon: use sigaction() to install child_handler() compat/mingw: allow sigaction(SIGCHLD)
2025-07-21Merge branch 'ja/doc-git-log-markup'Junio C Hamano11-472/+493
Doc mark-up updates. * ja/doc-git-log-markup: doc: git-log: convert log config to new doc format doc: git-log: convert diff options to new doc format doc: git-log: convert pretty formats to new doc format doc: git-log: convert pretty options to new doc format doc: git-log: convert rev list options to new doc format doc: git-log: convert line range format to new doc format doc: git-log: convert line range options to new doc format doc: git-log convert rev-list-description to new doc format doc: convert git-log to new documentation format
2025-07-21Merge branch 'rh/doc-glob-pathspec-fix'Junio C Hamano1-3/+2
Docfix. * rh/doc-glob-pathspec-fix: doc: correct doc for glob pathspec
2025-07-21Merge branch 'ps/meson-cleanups'Junio C Hamano6-36/+36
Meson-based build update. * ps/meson-cleanups: ci: use Meson's new `--slice` option meson: update subproject wrappers meson: fix lookup of shell on MINGW64 meson: clean up unnecessary variables meson: improve summary of auto-detected features meson: stop printing 'https' option twice in our summaries meson: stop discovering native version of Python
2025-07-21Merge branch 'jk/remote-avoid-overlapping-names'Junio C Hamano2-0/+31
"git remote" now detects remote names that overlap with each other (e.g., remote nickname "outer" and "outer/inner" are used at the same time), as it will lead to overlapping remote-tracking branches. * jk/remote-avoid-overlapping-names: remote: detect collisions in remote names
2025-07-21Merge branch 'tb/midx-avoid-cruft-packs'Junio C Hamano6-89/+571
"pack-objects" has been taught to avoid pointing into objects in cruft packs from midx. * tb/midx-avoid-cruft-packs: repack: exclude cruft pack(s) from the MIDX where possible pack-objects: introduce '--stdin-packs=follow' pack-objects: swap 'show_{object,commit}_pack_hint' pack-objects: fix typo in 'show_object_pack_hint()' pack-objects: perform name-hash traversal for unpacked objects pack-objects: declare 'rev_info' for '--stdin-packs' earlier pack-objects: factor out handling '--stdin-packs' pack-objects: limit scope in 'add_object_entry_from_pack()' pack-objects: use standard option incompatibility functions
2025-07-21Merge branch 'bc/use-sha256-by-default-in-3.0'Junio C Hamano25-32/+62
Prepare to flip the default hash function to SHA-256. * bc/use-sha256-by-default-in-3.0: Enable SHA-256 by default in breaking changes mode help: add a build option for default hash t5300: choose the built-in hash outside of a repo t4042: choose the built-in hash outside of a repo t1007: choose the built-in hash outside of a repo t: default to compile-time default hash if not set setup: use the default algorithm to initialize repo format Use legacy hash for legacy formats builtin: use default hash when outside a repository hash: add a constant for the legacy hash algorithm hash: add a constant for the default hash algorithm
2025-07-21git-gui: remove non-ttk codeMark Levedahl26-219/+70
git-gui has code paths to support older non-ttk widgets, but this code is no longer reachable as ttk is always used. Remove that code. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-20gitk: separate upstream refs when using the sort-by-type optionMichael Rappazzo1-5/+23
Since the upstream refs of local refs may be of more significance in the context of the local refs, they are sorted after local refs and before the remainder of the remote refs. Signed-off-by: Michael Rappazzo <michael.rappazzo@infor.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-20gitk: make 'sort-refs-by-type' optional and persistentMichael Rappazzo1-2/+10
On the 'tags and heads' view, add an option to enable or disable 'Sort refs by type'. This option is read from and written to the config file. Clicking on the option will update the refs in the view. Signed-off-by: Michael Rappazzo <michael.rappazzo@infor.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-20gitk: sort by ref type on the 'tags and heads' viewMichael Rappazzo1-10/+27
In the 'tags and heads' view, the list of refs was globally sorted, which caused the local ref list to be split around other ref list types. This change re-orders the view to be: local refs, remote refs, tags, and then other refs. Signed-off-by: Michael Rappazzo <rappazzo@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-18git-gui: remove ${NS} indirection for ttkMark Levedahl26-313/+308
git-gui uses ${NS} to switch between non-themed and themed widgets, with ${NS} == 'ttk' selecting the latter. As git-gui now always uses ttk, this indirection is not needed. Remove it. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: always use themed widgets from ttkMark Levedahl1-9/+5
git-gui optionally uses themed ui elements from ttk, but the full set of ttk ui elements is always available with Tk 8.6. Keeping code making ttk use optional increases maintenance burden for no benefit. Let's use ttk always, allowing removal of alternate code paths in subsequent patches. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: remove redundant check for Tk >= 8.5Mark Levedahl1-7/+5
Since commit c80d7be5e1e0d, git-gui checks for the availability of ttk before enabling its use, but this check is redundant as Tk >= 8.6 is required. Remove the redundant check. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: remove unreachable Tk 8.4 codeMark Levedahl4-38/+21
git-gui has remnant code to allow some drawing with Tk 8.4 predating the addition of themed widgets. As git-gui requires Tk >= 8.6, this code can never trigger. Remove it. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: remove unused git-versionMark Levedahl1-44/+0
git-version supports choosing different bodies of code passed into it, rather than using the more traditional if/else construct typically used. The only use of git-version in this mode was by its author in 2007, and that code has been deleted. So, delete this now unused function that was mostly ignored. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: use git_init to create new repository dirMark Levedahl1-8/+1
When creating a new repository, git-gui creates a directory, cds to it, then runs git-init, but git-init learned to create and initialize the directory in 1.6.5. git-gui requires git version >= 2.36, so teach git-gui to use git-init's full capability. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: git-remote is always availableMark Levedahl1-2/+0
git-gui checks for git version >= 1.6.6 before enabling the remotes menu. But git-gui requires git v2.36 or later, so git-remote is always available. Delete this check and always enable the menu. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: git merge understands --strategy=recursiveMark Levedahl1-10/+1
git-gui's merge driver includes code to invoke the recursive strategy for merging prior to git v2.5 that added a simpler syntax. As git-gui requires git v2.36 or later, let's delete the code targeting earlier git. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: git-diff knows submodules and textconvMark Levedahl1-16/+3
git-gui's diff functions avoid using textconv filters on git < 1.6.1, or asking about submodules on version before 1.7.2, but git-gui requires git >= v2.36. So, remove this now obsolete code. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: git-blame understands -w and textconvMark Levedahl1-7/+3
git-gui uses alternate code paths for git versions < 1.7.2, avoiding use of --ignore-all-space and textconv. git-gui requires git v2.36 or later, so this alternate code is obsolete. Remove it. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: git rev-parse knows show_toplevelMark Levedahl1-14/+1
git-gui has its own code to determine the worktree root for git-versions earlier than 1.7.0, where git rev-parse learned this function. git-gui requires git v2.36 or later, so delete the now obsolete alternate code. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: use git-branch --show-currentMark Levedahl1-21/+2
git-gui relies upon the files back-end to determine the current branch. This does not support the newer reftables backend. But, git-branch has long supported --show-current to get this same information regardless of backend cahnged. So teach git-gui to use git-branch --show-current. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: git-diff-index always knows submodulesMark Levedahl1-5/+1
git-gui asks for submodule info only on git-versions >=1.72, which introduced such capability. But, git-gui requires git version >= 2.36, so this alternate code path is obsolete. Remove it. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18git-gui: git ls-files knows --exclude-standardMark Levedahl1-12/+1
git-gui includes code to implement ls-files for git versions prior to 1.63 that did not know --exclude-standard. But, git-gui now requires git version >= 2.36, so remove the obsolete code. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-18meson: work around broken system PCRE2 dependency in macOSCarlo Marcelo Arenas Belón2-2/+28
macOS provides a PCRE2 library in base that is not usable and not configured properly, as it installs a pkgconf module that points to a non-existent pcre2.h header in /usr/local/include. Detect that case and if the feature is enabled, try to fallback to a wrapped subproject through an anonymous dependency, aborting with an error if that is not possible. Change the feature to "auto" and print a warning and disable it if a broken dependency was detected, but to keep consistency with the cmake build system used on Windows, add a special rule to re-enable the pcre2 feature by default there. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Suggested-by: Eli Schwartz <eschwartz@gentoo.org> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-18git-gui: Make TclTk 8.6 the minimum, allow 8.7Mark Levedahl1-3/+1
git-gui requires that Tcl and Tk are 8.5, though the check using 'package require' allows 8.6. As git-gui runs under wish, both Tcl and Tk are always available and of the same version, so only one need be checked. The 8.5 requirement is very outdated as the earliest Tcl currently shipping on any supported OS is 8.6. 8.7 is in alpha test and is generally compatible with 8.6, so should also be allowed. Tcl 9.0 has planned compatibility breaking changes so cannot be allowed. Let's update the requirements to be 8.6 or 8.7, and check only on Tcl as Tk will be the same version. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-17git-gui: require git >= 2.36Mark Levedahl1-33/+16
git-gui since commit d6967022 explicitly requires version >= 1.5.0, and this coded requirement has never been changed. But, since 0730a5a3a git-gui actually requires git 2.36, providing 'git hook run.' git-gui throws an error if that command is not supported. So, let's update the requirement checking code to 2.36, and throw a more useful error if this is not met. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-17gitk: choosefont - remove a stray debugging lineJohannes Sixt1-1/+0
This output was added in d93f1713b0 ("gitk: Use themed tk widgets", 2009-04-17), we can assume, by accident. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-16gitk: allow horizontal commit-graph scrollingMark Levedahl1-0/+4
gitk commit 5fdcbb1390 ("gitk: Fixes for Mac OS X TkAqua", 2009-03-23), adds horizontal scrolling of the commit graph pane on aqua, but not on x11 or win32. Also, the horizontal scrolling is triggered by MouseWheel events attached to any of the three panes, not just the commit graph that is the only one that scrolls. It is unusual to scroll a widget that is not under the mouse, many would consider this a bug. No horizontal scrollbar is provided for this, so there is no real cue for the user that horizontal scrolling is available. We removed this aqua only feature by transitioning aqua to use the common MouseWheel bindings set. Let's add this as a feature on all platforms, and use the same approach for scaling scroll motion as we do elsewhere. For horizontal scrolling, honor only events received by the commit graph in conformance with normal GUI design. Vertical scrolling is unchanged, and events received by any of the 3 panes continue to scroll all 3 in unison. Per the ancient and long ignored CUA standards, we should add a horizontal scrollbar to the commit-graph, but gitk's interface is already very cluttered: adding a scrollbar to only one of these three panes is difficult while maintaining common pane vertical size, especially so considering the movable sash separating panes 1 & 2, and will consume yet more space. So, leave this as a hidden feature, now available on all platforms. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: update aqua scrolling for TclTk 8.6 / TIP171Mark Levedahl1-8/+2
Tk provides MouseWheel events to aqua, similar to win32. But, these events on aqua have a nominal motion value (%D) of 1, not 120 as on win32. gitk on aqua provides specific bindings only for the top 3 panes, giving a nominal scrolling amount of +/- 1 for all events. gitk includes a hidden feature providing horizontal scrolling of the commit graph, added in 5fdcbb1390 ("gitk: Fixes for Mac OS X TkAqua", 2009-03-23). This horizontal scrolling is triggered by mouse events in any of the top 3 panes, and thus violates normal gui design where the object under the mouse cursor scrolls. Let's update this using the common bindings in 'proc bind_mousewheel', allowing user preferences on motion scaling to apply to all windows. The commit graph scrolling feature is removed by this, and will be added back for all platforms in a later commit. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: update x11 scrolling for TclTk 8.6 / TIP 171Mark Levedahl1-9/+18
gitk has x11 mouse bindings that receive button presses, not MouseWheel events, as this is the Tk implementation through Tk 8.6. On x11, gitk translates each button event to a scrolling value of +/- 5 for the upper three panes that scroll vertically as one unit. gitk applies similar scaling for horizontal scaling of the lower-left commit details pane (ctext), but not for vertical scrolling of either of the bottom panes. Rather, the Tk default scrolling actions are used for vertical scrolling. Let's make X11 behave similarly to the just modified win32 platform. Do so by connecting vertical and horizontal scrolling events for the same items bound in 'proc bind_mousewheel' and using the same user preference values. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: update win32 scrolling for Tk 8.6 / TIP 171Mark Levedahl1-24/+8
gitk on win32 binds windows_mousewheel_redirector to all MouseWheel events in the main window. This proc determines the widget under the cursor, then determines what scroll command to give, possibly none, and issues scroll commands to the widget. The top panes get only vertical scroll events, as does the lower right Patch/Tree pane. All others get both vertical and horizontal events. These are all hard coded at +/- five lines. We now have common MouseWheel event bindings that follow user preferences for the scrolling amount, bind for only the five main display widgets, and leave the other gui elements untouched. Let's use this instead. With the scrolling preference set at 5, the users should not notice much, if any, difference. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: mousewheel scrolling functions for Tk 8.6Mark Levedahl1-0/+15
gitk supports scrolling of 5 windows, but does this differently on the aqua, x11, and win32 platforms as Tk provides different events on each. TIP 171 removes some differences on win32 while altering the required bindings on x11. TIP 474, which is in Tk 8.7 and later, finally unifies all platforms on using common MouseWheel bindings. Importantly for now, TIP 171 causes delivery of MouseWheel events to the widget under the mouse cursor on win32, eliminating the need for completely different bindings on win32. Let's make some common functions to unify as much as we can in Tk 8.6. Examining the platforms shows that the default platform scrolling is overridden differently on the 3 platforms, and the nominal amount of motion achieved per mouse wheel "click" is different. win32 nominally makes everything move 5 lines per click, aqua 1 line per click, and x11 is a mixture. Part of this is due to win32 overriding all scroll events, while x11 and aqua override smaller sets. Also, note that the text widgets (the lower two panes) always scroll by 2-3 lines when given a smaller scroll amount, while the upper three canvas objects follow the requested scrolling value more accurately. First, let's have a common routine to calculate the scroll value to give to a widget in an event. This accounts for the user preference, the scale of the %D (delta) value given by the event (120 on win32, 1 on aqua, assumed 1 on x11), and must always be integer. Include negation as by convention the screen moves opposite to the MouseWheel delta. Allow setting an offset value to account for the larger minimum scrolling of text widgets. Second, let's have a common declaration of MouseWheel event bindings, as those are shared by all in Tcl9, and by aqua/win32 earlier. Bind all five display windows here. Note that the Patch/Tree widget (cflist) cannot scroll horizontally. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: wheel scrolling multiplier preferenceMark Levedahl1-0/+5
gitk provides scrolling of several windows, uses hard-coded values for the amount of scrolling, and these values differ across platforms and widgets. The nominal value used is either 1 text line per mouse / touchpad / button event, or 5 lines. Furthermore, Tk does not scroll text widgets by 1 line when told to, this usually gets 2-3 lines of motion. The upper canvas objects holding the commit graph do scroll as defined. But, clearly no value is universally preferred, so let's give the user some control over this. Provide a single multiplier to be applied for all scroll bindings, with a value of 3 to mean the default nominal value of 3 line. This is selected both as a compromise between the various defaults across platforms, and because it is the smallest value honored by the two text widgets on the bottom of the screen. Later commits will connect this variable for actual scrolling events. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: separate x11 / win32 / aqua Mouse bindingsMark Levedahl1-10/+11
Tk through 8.6 has different approaches for handling mouse wheel / touchpad scrolling events on the different platforms, and gitk has separate code for these. But, some x11 bindings are applied on aqua as we do not have these in a clean if / then / else tree based upon platform. Let's split these bindings apart. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: remove non-ttk support codeMark Levedahl1-187/+60
gitk has code and variables to use the earlier non-themed widget set, but this code is now irrelevant as gitk now always uses ttk. Clean this up. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: replace ${NS} with ttkMark Levedahl1-166/+166
gitk uses ${NS} to select between the original Tk widgets and the newer themed widgets in ttk. As gitk uses only themed widgets from ttk::, this indirection now serves no purpose, so let's switch to explicit use of ttk:: via global search/replace. More simplification, including removal of the NS variable, is kept for a later patch to keep this one smaller. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: always use themed Tk (ttk)Mark Levedahl1-21/+4
gitk added the option to used themed Tk (ttk) in 0cc08ff7dd ("gitk: Add a user preference to enable/disable use of themed widgets", 2009-09-05). Using ttk had to be optional as Tk 8.4, then in common use, does not have ttk. ttk is the default when available, so the ttk code paths are by now very well tested. gitk also has code paths for the older default widgets, increasing the maintenance burden. Let's make ttk non-optional to reduce code complexity in later commits. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: use $config_variables as list for save/restoreMark Levedahl1-30/+66
gitk includes many user defined configuration variables, has all of these are listed in $config_variables. But this list is not used to define the variables to be loaded, saved, or restored when cancelling the configuration dialog, and developers must maintain separate lists of variables for these purposes. This leads to unnecessary errors and merge conflicts. Let's replace those separate lists with $config_variables to make maintenance easier. While we are on topic, sort the list of names in $config_variables. This makes it simpler to scan and has fewer chances of conflicts when new names are introduced. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16ci: allow github-actions print test failures againJunio C Hamano1-1/+1
eab5dbab (ci: wire up Meson builds, 2024-12-13) added two instances of a very similar construct FAILED_TEST_ARTIFACTS=${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts one to ci/lib.sh and the other to ci/print-test-failures.sh Unfortunately, the latter had a typo causing shell to emit "Bad substitution". Fix it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16git-gui: Add support of SHA256 repoTakashi Iwai5-12/+31
This patch adds the basic support of SHA256 Git repositories. Most of changes are idiomatic replacement of the hard-coded hash ID length, but there are subtle things: * The hash length is determined on startup, and stored in $hashlength global variable (either 40 or 64). * The hard-coded "40" are replaced with $hashlength; for regexp patterns, the ugly string map is used. * Some code have the fixed numbers like 39 and 45, and those are replaced with the $hashlength and the offset correction. * $nullid and $nullid2 are generated for the hash length. A caveat is that repository picker dialog is performed before evaluating the repo type, hence $hashlength isn't set there yet. So the code dealing with the hard-coded "40" are handled differently; namely, the regexp range is expanded, and the null id is generated from the HEAD id length locally. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-16The eleventh batchJunio C Hamano1-0/+13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16Merge branch 'ag/doc-send-email'Junio C Hamano2-8/+55
Documentation updates for "git send-email". * ag/doc-send-email: docs: mention possible options for Proton Mail users docs: add a paragraph explaining the `sendmailCmd` option of sendemail docs: add an OAuth2.0 credential helper for AOL accounts docs: add outlookidfix config option to sendemail documentation docs: link OpenSSL's verify(1) manual page to know about -CAfile and -CApath options
2025-07-16Merge branch 'rs/parse-options-precision'Junio C Hamano7-42/+146
Define .precision to more canned parse-options type to avoid bugs coming from using a variable with a wrong type to capture the parsed values. * rs/parse-options-precision: parse-options: add precision handling for OPTION_COUNTUP parse-options: add precision handling for OPTION_BITOP parse-options: add precision handling for OPTION_NEGBIT parse-options: add precision handling for OPTION_BIT parse-options: add precision handling for OPTION_SET_INT parse-options: add precision handling for PARSE_OPT_CMDMODE parse-options: require PARSE_OPT_NOARG for OPTION_BITOP
2025-07-16Merge branch 'ps/doc-pack-refs-auto-with-files-backend-fix'Junio C Hamano1-1/+4
Doc update. * ps/doc-pack-refs-auto-with-files-backend-fix: docs/git-pack-refs: document heuristic used for packing loose refs
2025-07-16Merge branch 'ps/refs-files-remove-empty-parent'Junio C Hamano2-0/+21
When a ref creation at refs/heads/foo/bar fails, the files backend now removes refs/heads/foo/ if the directory is otherwise not used. * ps/refs-files-remove-empty-parent: refs/files: remove empty parent dirs when ref creation fails
2025-07-16Merge branch 'ps/t1006-tap-fix'Junio C Hamano1-1/+1
Test fix. * ps/t1006-tap-fix: t1006: fix broken TAP format
2025-07-16Merge branch 'ph/fetch-prune-optim'Junio C Hamano4-40/+23
"git fetch --prune" used to be O(n^2) expensive when there are many refs, which has been corrected. * ph/fetch-prune-optim: clean up interface for refs_warn_dangling_symrefs refs: remove old refs_warn_dangling_symref fetch-prune: optimize dangling-ref reporting
2025-07-16git-gui: Replace null_sha1 with nullidTakashi Iwai2-5/+4
Both $nullid and $null_sha1 point to the same content. Use only $nullid consistently. This is a preliminary cleanup for adding the support of SHA256 repo. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-16gitk: remove implementations for Tcl/Tk < 8.6Mark Levedahl1-114/+23
gitk includes code specifically for Tcl 8.4 and 8.5, but the requirement is now for at least 8.6. Remove the now unusable code targeting earlier Tcl. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: Make TclTk 8.6 the minimum, allow 8.7Mark Levedahl1-8/+9
gitk runs under wish so naturally has Tcl and Tk available and of the same version. gitk sets a requirement on Tk version >= 8.4: this is very outdated, and the earliest Tcl currently shipping on any supported OS is 8.6. As 8.7 is in alpha test and is generally compatible with 8.6, we should allow 8.7. Tcl 9.0 has planned compatibility breaking changes so is not yet supported. Let's change the requirements to 8.6-8.7, but not 9.0. Place this at the top of file so the requirements are obvious. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: remove code targeting git <= 1.7.2Mark Levedahl1-43/+14
gitk has a few code fragments that are used only for git versions <= 1.7.2 that do not support submodules, notes, word differences, or textconv filters. We just set the minimum git version higher than 1.7.2 so these code fragments have no effect. Delete them. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16gitk: require git >= 2.20Mark Levedahl1-2/+16
gitk has alternate code paths for early git up to 1.72, and has no defined minimum version. Setting any version > 1.72 as minimum will allow removing those code paths. The recent set of advisories published for git, gitk, and git-gui add updates for v2.43 and later, but Debian has buster withgit 2.20 still available. While Debian would be responsible for backporting any fixes to such an early version, we have no good reason preclude it. So, make 2.20 the minimum required git version. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-16config: set comment_line_str to "#" when core.commentChar=autoAyush Chandekar1-2/+4
If conflict comments already use a comment character that isn't "#", and core.commentChar is set "auto", Git will ignore these lines during the scan using ignored_log_message_bytes() and pick a new comment character based on the rest of the message. The newly chosen character may be different from the one used in the conflict comments and therefore, these are no longer treated as comments and end up in the final commit message. For example, during a rebase if the user previously set core.commentChar=% and then encounters a conflict, conflict comments like "% Conflicts:" are generated. If the user subsequently sets core.commentChar=auto before running `rebase --continue`, Git parses the "auto" setting and begins scanning. It first uses the existing 'comment_line_str' (which is '%') to detect and ignore conflict comments via ignored_log_message_bytes(). Then, Git scans the rest of the message (excluding conflict comments), sees that none of the remaining lines start with '#' and decides to set comment_line_str to '#'. Since the final commit character differs from the one used in the conflict comments, those lines are no longer considered comments and get included in the final commit message. Set 'comment_line_str' to '#' when core.commentChar is set to 'auto' to reset any previously set value. While this does not solve the issue of conflict comment inclusion and the user visible behaviour stays tha same, it standardizes the behaviour of the code by always resetting 'comment_line_str' to '#' when core.commentChar=auto is parsed. The patch text is based on Phillip Wood's message: https://lore.kernel.org/git/9e96aaab-79a2-4632-94cd-d016d4a63b30@gmail.com/ and the commit log message is wriiten by me. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com> Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16commit: avoid scanning trailing comments when 'core.commentChar' is "auto"Ayush Chandekar2-1/+18
When core.commentChar is set to "auto", Git selects a comment character by scanning the commit message contents and avoiding any character already present in the message. If the message still contains old conflict comments (starting with a comment character), Git assumes that character is in use and chooses a different one. As a result, those existing comment lines are no longer recognized as comments and end up being included in the final commit message. To avoid this, skip scanning the trailing comment block when selecting the comment character. This allows Git to safely reuse the original character when appropriate, keeping the commit message clean and free of leftover conflict information. Background: The "auto" value for core.commentchar was introduced in the commit 84c9dc2c5a (commit: allow core.commentChar=auto for character auto selection, 2014-05-17) but did not exhibit this issue at that time. The bug was introduced in commit a6c2654f83 (rebase -m: fix --signoff with conflicts, 2024-04-18) where Git started writing conflict comments to the file at 'rebase_path_message()'. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com> Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16strbuf: convert predicates to return boolPhillip Wood2-20/+20
Now that the string predicates defined in git-compat-util.h all return bool let's convert the return type of the string predicates in strbuf.{c,h} to match them. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16git-compat-util: convert string predicates to return boolPhillip Wood1-6/+6
Since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool, 2023-12-16) a number of our string predicates have been returning bool instead of int. Now that we've declared that experiment a success, let's convert the return type of the case-independent skip_iprefix() and skip_iprefix_mem() functions to match the return type of their case-dependent equivalents. Returning bool instead of int makes it clear that these functions are predicates. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16CodingGuidelines: allow the use of boolPhillip Wood1-0/+3
We have had a test balloon for C99's bool type since 8277dbe987 (git-compat-util: convert skip_{prefix,suffix}{,_mem} to bool, 2023-12-16). As we've had it over 18 months without any complaints let's declare it a success. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16SubmittingPatches: allow non-real name contributionsbrian m. carlson1-2/+9
Our submission guidelines require people to use their real name, but this is not always suitable for various reasons. For people who are transgender or non-binary and are transitioning or who think they might want to transition, it can be a major obstacle and cause major discomfort to require the use of their real name. This is made worse by the fact that Git provides no way to change names built into history, so the use of a deadname is forever. Our code of conduct states that we "pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community," and changing this policy is one way we can improve things for contributors. In addition, there are some developers who are so widely known pseudonymously that they have a Wikipedia page with their handle and no real name. It would seem silly to reject patches from people who are known and respected in their open-source community just because they don't wish to share a real name. There are also other good reasons why people might operate pseudonymously: because they or their family members are well known and they wish to protect their privacy, because of current or past harassment or retaliation or fear of that happening in the future, or because of concerns about unwanted attention from government officials or other authority figures. As much as possible, we want to welcome contributions from anyone who is willing to participate positively in our community without having them worry about their safety or privacy. In all of these cases, we should allow people to proceed using a preferred name or pseudonymously if, in their best judgment, that's the right thing to do. State that it is common to use a real name but explicitly mention that contributors who are not comfortable doing so or prefer to operate pseudonymously or under a preferred name can proceed otherwise, provided the name is distinctive, identifying, and not misleading. For instance, using U+2060 (WORD JOINER) as one's ID would likely be distinctive but not identifying, since most people would have trouble reading it due to its zero-width nature. We prohibit identities which are misleading, since our goal is to create a community which works together with a common goal, and misleading or deceiving others is not conducive to good community or compatible with our code of conduct, nor is it compatible with making a legal assertion about the provenance of one's code. Explicitly prohibit anonymous contributions to ensure that we have some line of provenance to a known (if pseudonymous) author who might be able to respond to questions about it. Explain that this is the reason we have this policy to help contributors understand the rationale better. Use "some form of your real name" since some current contributors use shortened forms of their name or use initials, which have always been considered acceptable. This helps guide people who would be fine using their real name but have misconfigured `user.name` thinking it is intended to be a username or is used for authentication (despite our documentation to the contrary), but also allows for a variety of circumstances where the contributor would feel more comfortable not doing so. Note that this policy is the same as that of the Linux kernel[0] and the CNCF[1], as well as many smaller projects. The Linux kernel patch was Acked-by one of the Linux Foundation's lawyers, Michael Dolan, so it appears these changes have had legal review. Additionally, retain the section header ID for ease of linking across versions. [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d4563201f33a022fc0353033d9dfeb1606a88330 [1] https://github.com/cncf/foundation/blob/659fd32c86dc/dco-guidelines.md Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16po/meson.build: add missing 'ga' language codeRamsay Jones1-0/+1
Commit bf5ce434db ("l10n: Add full Irish translation (ga.po)", 2025-05-16) added a new translation to git. In a make build, new 'po' files (ga.po in this case) are added to the build automatically using a wildcard pattern. In a meson build you have to add the language code ('ga') to a list explicitly to have it included in the build. In order to include the new translation in the meson build, add the 'ga' language code to the list of translations in the 'po/meson.build' file. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-16meson: fix installation when -Dlibexexdir is setRamsay Jones1-21/+21
commit 837f637cf5 ("meson.build: correct setting of GIT_EXEC_PATH", 2025-05-19) corrected the GIT_EXEC_PATH build setting, but then forgot to update the installation path for the library executables. This causes a regression when attempting to execute commands, after installing to a non-standard location (reported here[1]): $ meson -Dprefix=/tmp/git -Dlibexecdir=libexec-different build $ meson install $ /tmp/git/bin/git --exec-path /tmp/git/libexec-different $ /tmp/git/bin/git daemon git: 'daemon' is not a git command. See 'git --help' In order to fix the issue, use the 'git_exec_path' variable (calculated while processing -Dlibexecdir) as the 'install_dir' field during the installation of the library executables. [1]: <66fd343a-1351-4350-83eb-c797e47b7693@gmail.com> Reported-by: irecca.kun@gmail.com Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15The tenth batchJunio C Hamano1-0/+5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15Merge branch 'ly/load-bitmap-leakfix'Junio C Hamano4-24/+103
Leakfix with a new and a bit invasive test. * ly/load-bitmap-leakfix: pack-bitmap: add load corrupt bitmap test pack-bitmap: reword comments in test_bitmap_commits() pack-bitmap: fix memory leak if load_bitmap() failed
2025-07-15Merge branch 'ps/object-store'Junio C Hamano140-1297/+1453
Code clean-up around object access API. * ps/object-store: odb: rename `read_object_with_reference()` odb: rename `pretend_object_file()` odb: rename `has_object()` odb: rename `repo_read_object_file()` odb: rename `oid_object_info()` odb: trivial refactorings to get rid of `the_repository` odb: get rid of `the_repository` when handling submodule sources odb: get rid of `the_repository` when handling the primary source odb: get rid of `the_repository` in `for_each()` functions odb: get rid of `the_repository` when handling alternates odb: get rid of `the_repository` in `odb_mkstemp()` odb: get rid of `the_repository` in `assert_oid_type()` odb: get rid of `the_repository` in `find_odb()` odb: introduce parent pointers object-store: rename files to "odb.{c,h}" object-store: rename `object_directory` to `odb_source` object-store: rename `raw_object_store` to `object_database`
2025-07-15bswap.h: provide a built-in based version of bswap32/64 if possibleSebastian Andrzej Siewior1-0/+13
The compiler is in general able to recognize the endian shift and replace it with an optimized opcode if possible. On certain architectures such as RiscV or MIPS the situation can get complicated. They don't provide an optimized opcode and masking the "higher" bits may required loading a constant which needs shifting. This causes the compiler to emit a lot of instructions for the operation. The provided builtin directive on these architecture calls a function which does the operation instead of emitting the code for operation. Bring back the change from commit 6547d1c9 (bswap.h: add support for built-in bswap functions, 2025-04-23). The bswap32/64 macro can now be defined unconditionally so it won't regress on big endian architectures. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15bswap.h: remove optimized x86 version of bswap32/64Sebastian Andrzej Siewior1-40/+1
On x86 the bswap32/64 macro is implemented based on the x86 opcode which performs the required shifting in just one opcode. The other CPUs fallback to the generic shifting as implemented by default_swab32() and default_bswap64() if needed. I've been looking at how good a compiler is at recognizing the default shift and emitting an optimized operation: - x86, arm64 msvc v19.20 default_swab32() optimized default_bswap64() shifts _byteswap_uint64() optimized - x86, arm64 msvc v19.37 default_swab32() optimized default_bswap64() optimized _byteswap_uint64() optimized - arm64, gcc-4.9.4: optimized - x86-64, gcc-4.4.7: shifts - x86-64, gcc-4.5.3: optimized - x86-64, clang-3.0: optimized Given that gcc-4.5 and clang-3.0 are fairly old, any recent compiler should recognize the shift. Remove the optimized x86 version and rely on the compiler. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15bswap.h: always overwrite ntohl/ ntohll macrosSebastian Andrzej Siewior1-26/+24
The ntohl and htonl macros are redefined because the provided macros were not always optimal. Sometimes it was a function call, sometimes it was a macro which did the shifting. Using the 'bswap' opcode on x86 provides probably better performance than performing the shifting. These macros are only overwritten on x86 if the "optimized" version is available. The ntohll and htonll macros are not available on every platform (at least glibc does not provide them) which means they need to be defined once the endianness of the system is determined. In order to get a more symmetrical setup, redfine the macros once the endianness of the system has been determined. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15bswap.h: define GIT_LITTLE_ENDIAN on msvc as little endianSebastian Andrzej Siewior1-1/+5
The Microsoft Visual C++ (MSVC) compiler (as of Visual Studio 2022 version 17.13.6) does not define __BYTE_ORDER__ and its C-library does not define __BYTE_ORDER. The compiler is supported only on arm64 and x86 which are all little endian. Define GIT_BYTE_ORDER on msvc as little endian to avoid further checks. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15bswap.h: add support for __BYTE_ORDER__Sebastian Andrzej Siewior1-0/+6
The __BYTE_ORDER__ define is provided by gcc (since ~v4.6), clang (since ~v3.2) and icc (since ~16.0.3). The __BYTE_ORDER and BYTE_ORDER macros are libc specific and are not available on all supported platforms such as mingw. Add support for the __BYTE_ORDER__ macro as a fallback. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15test-lib: respect GIT_TEST_INSTALLED when querying default hashKyle Lippincott1-2/+3
$GIT_TEST_INSTALLED can be set to use an "installed" git instead of the one from $GIT_BUILD_DIR. This is used by my company's internal test infrastructure, and not using $GIT_TEST_INSTALLED when querying the default hash meant that the tests were failing because the hash was effectively set to the empty string (since git didn't execute). In the two places we attempt to detect/execute git itself prior to overriding everything and putting it in $PATH, use identical logic for identifying the git binary to execute. This also has the effect of including the $X suffix when querying the default hash, but that's not strictly necessary. You don't need to specify .exe when running a binary on Windows, just when testing whether it exists or not. Signed-off-by: Kyle Lippincott <spectral@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15Merge branch 'bc/use-sha256-by-default-in-3.0' into kl/test-installed-fixJunio C Hamano25-32/+62
2025-07-15config: remove unneeded struct fieldPhillip Wood2-17/+13
As well as receiving the config key and value, config callbacks also receive a "struct key_value_info" containing information about the source of the key-value pair. Accessing the "path" field of this struct from a callback passed to repo_config() results in a use-after-free. This happens because repo_config() first populates a configset by calling config_with_options() and then iterates over the configset with the callback passed by the caller. When the configset is constructed it takes a shallow copy of the "struct key_value_info" for each config setting. This leads to the use-after-free as the "path" member is freed before config_with_options() returns. We could fix this by interning the "path" field as we do for the "filename" field but the "path" field is not actually needed. It is populated with a copy of the "path" field from "struct config_source". That field was added in d14d42440d8 (config: disallow relative include paths from blobs, 2014-02-19) to distinguish between relative include directives in files and those in blobs. However, since 1b8132d99d8 (i18n: config: unfold error messages marked for translation, 2016-07-28) we can differentiate these by looking at the "origin_type" field in "struct key_value_info". So let's remove the "path" members from "struct config_source" and "struct key_value_info" and instead use a combination of the "filename" and "origin_type" fields to determine the absolute path of relative includes. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15midx: remove now-unused linked list of multi-pack indicesPatrick Steinhardt4-26/+2
In the preceding commits we have migrated all users of the linked list of multi-pack indices to instead use those stored in the object database sources. Remove those now-unused pointers. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15packfile: stop using linked MIDX list in `get_all_packs()`Patrick Steinhardt1-5/+6
Refactor `get_all_packs()` so that we stop using the linked list of multi-pack indices. Note that there is no need to explicitly prepare alternates, and neither do we have to use `get_multi_pack_index()`, because `prepare_packed_git()` already takes care of populating all data structures for us. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15packfile: stop using linked MIDX list in `find_pack_entry()`Patrick Steinhardt1-6/+5
Refactor `find_pack_entry()` so that we stop using the linked list of multi-pack indices. Note that there is no need to explicitly prepare alternates, and neither do we have to use `get_multi_pack_index()`, because `prepare_packed_git()` already takes care of populating all data structures for us. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15packfile: refactor `get_multi_pack_index()` to work on sourcesPatrick Steinhardt7-62/+57
The function `get_multi_pack_index()` loads multi-pack indices via `prepare_packed_git()` and then returns the linked list of multi-pack indices that is stored in `struct object_database`. That list is in the process of being removed though in favor of storing the MIDX as part of the object database source it belongs to. Refactor `get_multi_pack_index()` so that it returns the multi-pack index for a single object source. Callers are now expected to call this function for each source they are interested in. This requires them to iterate through alternates, so we have to prepare alternate object sources before doing so. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15midx: stop using linked list when closing MIDXPatrick Steinhardt2-10/+14
When calling `close_midx()` we not only close the multi-pack index for one object source, but instead we iterate through the whole linked list of MIDXs to close all of them. This linked list is about to go away in favor of using the new per-source pointer to its respective MIDX. Refactor the function to iterate through sources instead. Note that after this patch, there's a couple of callsites left that continue to use `close_midx()` without iterating through all sources. These are all cases where we don't care about the MIDX from other sources though, so it's fine to keep them as-is. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15packfile: refactor `prepare_packed_git_one()` to work on sourcesPatrick Steinhardt1-14/+9
In the preceding commit we refactored how we load multi-pack indices to take a corresponding "source" as input. As part of this refactoring we started to store a pointer to the MIDX in `struct odb_source` itself. Refactor loading of packfiles in the same way: instead of passing in the object directory, we now pass in the source from which we want to load packfiles. This allows us to simplify the code because we don't have to search for a corresponding MIDX anymore, but we can instead directly use the MIDX that we have already prepared beforehand. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15midx: start tracking per object database sourcePatrick Steinhardt4-11/+24
Multi-pack indices are tracked via `struct multi_pack_index`. This data structure is stored as a linked list inside `struct object_database`, which is the global database that spans across all of the object sources. This layout causes two problems: - Object databases consist of multiple object sources (e.g. one source per alternate object directory), where each multi-pack index is specific to one of those sources. Regardless of that though, the MIDX is not tracked per source, but tracked globally for the whole object database. This creates a mismatch between the on-disk layout and how things are organized in the object database subsystems and makes some parts, like figuring out whether a source has an MIDX, quite awkward. - Multi-pack indices are an implementation detail of how efficient access for packfiles work. As such, they are neither relevant in the context of loose objects, nor in a potential future where we have pluggable backends. Refactor `prepare_multi_pack_index_one()` so that it works on a specific source, which allows us to easily store a pointer to the multi-pack index inside of it. For now, this pointer exists next to the existing linked list we have in the object database. Users will be adjusted in subsequent patches to instead use the per-source pointers. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15Merge branch 'tb/midx-avoid-cruft-packs' into ps/object-store-midxJunio C Hamano6-89/+571
* tb/midx-avoid-cruft-packs: repack: exclude cruft pack(s) from the MIDX where possible pack-objects: introduce '--stdin-packs=follow' pack-objects: swap 'show_{object,commit}_pack_hint' pack-objects: fix typo in 'show_object_pack_hint()' pack-objects: perform name-hash traversal for unpacked objects pack-objects: declare 'rev_info' for '--stdin-packs' earlier pack-objects: factor out handling '--stdin-packs' pack-objects: limit scope in 'add_object_entry_from_pack()' pack-objects: use standard option incompatibility functions
2025-07-15for-each-ref: introduce a '--start-after' optionKarthik Nayak5-19/+272
The `git-for-each-ref(1)` command is used to iterate over references present in a repository. In large repositories with millions of references, it would be optimal to paginate this output such that we can start iteration from a given reference. This would avoid having to iterate over all references from the beginning each time when paginating through results. The previous commit added 'seek' functionality to the reference backends. Utilize this and expose a '--start-after' option in 'git-for-each-ref(1)'. When used, the reference iteration seeks to the lexicographically next reference and iterates from there onward. This enables efficient pagination workflows, where the calling script can remember the last provided reference and use that as the starting point for the next set of references: git for-each-ref --count=100 git for-each-ref --count=100 --start-after=refs/heads/branch-100 git for-each-ref --count=100 --start-after=refs/heads/branch-200 Since the reference iterators only allow seeking to a specified marker via the `ref_iterator_seek()`, we introduce a helper function `start_ref_iterator_after()`, which seeks to next reference by simply adding (char) 1 to the marker. We must note that pagination always continues from the provided marker, as such any concurrent reference updates lexicographically behind the marker will not be output. Document the same. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15ref-filter: remove unnecessary else clauseKarthik Nayak1-30/+30
In 'ref-filter.c', there is an 'else' clause within `do_filter_refs()`. This is unnecessary since the 'if' clause calls `die()`, which would exit the program. So let's remove the unnecessary 'else' clause. This improves readability since the indentation is also reduced and flow is simpler. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15refs: selectively set prefix in the seek functionsKarthik Nayak9-50/+152
The ref iterator exposes a `ref_iterator_seek()` function. The name suggests that this would seek the iterator to a specific reference in some ways similar to how `fseek()` works for the filesystem. However, the function actually sets the prefix for refs iteration. So further iteration would only yield references which match the particular prefix. This is a bit confusing. Let's add a 'flags' field to the function, which when set with the 'REF_ITERATOR_SEEK_SET_PREFIX' flag, will set the prefix for the iteration in-line with the existing behavior. Otherwise, the reference backends will simply seek to the specified reference and clears any previously set prefix. This allows users to start iteration from a specific reference. In the packed and reftable backend, since references are available in a sorted list, the changes are simply setting the prefix if needed. The changes on the files-backend are a little more involved, since the files backend uses the 'ref-cache' mechanism. We move out the existing logic within `cache_ref_iterator_seek()` to `cache_ref_iterator_set_prefix()` which is called when the 'REF_ITERATOR_SEEK_SET_PREFIX' flag is set. We then parse the provided seek string and set the required levels and their indexes to ensure that seeking is possible. Helped-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15ref-cache: remove unused function 'find_ref_entry()'Karthik Nayak2-21/+0
The 'find_ref_entry' function is no longer used, so remove it. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15refs: expose `ref_iterator` via 'refs.h'Karthik Nayak2-143/+149
The `ref_iterator` is an internal structure to the 'refs/' sub-directory, which allows iteration over refs. All reference iteration is built on top of these iterators. External clients of the 'refs' subsystem use the various 'refs_for_each...()' functions to iterate over refs. However since these are wrapper functions, each combination of functionality requires a new wrapper function. This is not feasible as the functions pile up with the increase in requirements. Expose the internal reference iterator, so advanced users can mix and match options as needed. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-15bloom: optimize multiple pathspec items in revisionLidong Yan2-19/+25
To enable optimize multiple pathspec items in revision traversal, return 0 if all pathspec item is literal in forbid_bloom_filters(). Add for loops to initialize and check each pathspec item's bloom_keyvec when optimization is possible. Add new test cases in t/t4216-log-bloom.sh to ensure - consistent results between the optimization for multiple pathspec items using bloom filter and the case without bloom filter optimization. - does not use bloom filter if any pathspec item is not literal. With these optimizations, we get some improvements for multi-pathspec runs of 'git log'. First, in the Git repository we see these modest results: Benchmark 1: old Time (mean ± σ): 73.1 ms ± 2.9 ms Range (min … max): 69.9 ms … 84.5 ms 42 runs Benchmark 2: new Time (mean ± σ): 55.1 ms ± 2.9 ms Range (min … max): 51.1 ms … 61.2 ms 52 runs Summary 'new' ran 1.33 ± 0.09 times faster than 'old' But in a larger repo, such as the LLVM project repo below, we get even better results: Benchmark 1: old Time (mean ± σ): 1.974 s ± 0.006 s Range (min … max): 1.960 s … 1.983 s 10 runs Benchmark 2: new Time (mean ± σ): 262.9 ms ± 2.4 ms Range (min … max): 257.7 ms … 266.2 ms 11 runs Summary 'new' ran 7.51 ± 0.07 times faster than 'old' Signed-off-by: Derrick Stolee <stolee@gmail.com> [ly: rename convert_pathspec_to_filter() to convert_pathspec_to_bloom_keyvec()] Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-14The ninth batchJunio C Hamano1-2/+49
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-14Merge branch 'rp/apply-intent-to-add-fix'Junio C Hamano3-7/+37
"git apply -N" should start from the current index and register only new files, but it instead started from an empty index, which has been corrected. * rp/apply-intent-to-add-fix: apply docs: clarify wording for --intent-to-add t4140: test apply --intent-to-add interactions apply: only write intents to add for new files apply: read in the index in --intent-to-add mode
2025-07-14Merge branch 'sj/string-list'Junio C Hamano6-267/+249
Code and test clean-up around string-list API. * sj/string-list: u-string-list: move "remove duplicates" test to "u-string-list.c" u-string-list: move "filter string" test to "u-string-list.c" u-string-list: move "test_split_in_place" to "u-string-list.c" u-string-list: move "test_split" into "u-string-list.c" string-list: enable sign compare warnings check string-list: return index directly when inserting an existing element string-list: remove unused "insert_at" parameter from add_entry string-list: fix sign compare warnings for loop iterator
2025-07-14Merge branch 'rj/freebsd-sysinfo-build-fix'Junio C Hamano2-30/+41
Build fix for FreeBSD. * rj/freebsd-sysinfo-build-fix: build: fix FreeBSD build when sysinfo compat library installed
2025-07-14Merge branch 'ts/merge-orig-head-doc-fix'Junio C Hamano1-5/+5
Doc fix. * ts/merge-orig-head-doc-fix: docs: correct ORIG_HEAD example in "git merge" documentation
2025-07-14Merge branch 'ps/perlless-test-fixes'Junio C Hamano2-3/+3
Test fixes. * ps/perlless-test-fixes: t5333: fix missing terminator for sed(1) 's' command t4150: fix warning printed by awk due to escaped '\@'
2025-07-14Merge branch 're/ssh-sign-buffer-fix'Junio C Hamano2-13/+21
Tempfile removal fix in the codepath to sign commits with SSH keys. * re/ssh-sign-buffer-fix: ssh signing: don't detach the filename strbuf from key_file tempfile
2025-07-14Merge branch 'hy/read-cache-lock-error-fix'Junio C Hamano2-13/+8
A failure to open the index file for writing due to conflicting access did not state what went wrong, which has been corrected. * hy/read-cache-lock-error-fix: read-cache: report lock error when refreshing index
2025-07-14Merge branch 'kn/clang-format-updates'Junio C Hamano3-29/+28
Update ".clang-format" and ".editorconfig" to match our style guide a bit better. * kn/clang-format-updates: meson: add rule to run 'git clang-format' clang-format: add 'RemoveBracesLLVM' to the main config clang-format: set 'ColumnLimit' to 0
2025-07-14Merge branch 'kh/doc-config-subcommands'Junio C Hamano2-13/+27
Documentation updates. * kh/doc-config-subcommands: config: mention --url in the synopsis config: use --value instead of value-pattern config: document --[no-]value config: use --value=<pattern> consistently config: document --[no-]show-names
2025-07-14Merge branch 'mc/netrc-service-names'Junio C Hamano5-7/+46
"netrc" credential helper has been improved to understand textual service names (like smtp) in addition to the numeric port numbers (like 25). * mc/netrc-service-names: contrib: better support symbolic port names in git-credential-netrc contrib: warn for invalid netrc file ports in git-credential-netrc contrib: use a more portable shebang for git-credential-netrc
2025-07-14Merge branch 'jc/coccicheck-fails-make-when-it-fails'Junio C Hamano1-2/+5
"make coccicheck" succeeds even when spatch made suggestions, which has been updated to fail in such a case. * jc/coccicheck-fails-make-when-it-fails: coccicheck: fail "make" when it fails
2025-07-14Merge branch 'ps/use-reftable-as-default-in-3.0'Junio C Hamano6-0/+120
The reftable ref backend has matured enough; Git 3.0 will make it the default format in a newly created repositories by default. * ps/use-reftable-as-default-in-3.0: setup: use "reftable" format when experimental features are enabled BreakingChanges: announce switch to "reftable" format
2025-07-14Merge branch 'jk/all-negative-diff-filter-fix'Junio C Hamano2-1/+7
A diff-filter with negative-only specification like "git log --diff-filter=d" did not trigger correctly, which has been fixed. * jk/all-negative-diff-filter-fix: setup_revisions(): turn on diffs for all-negative diff filter
2025-07-14Merge branch 'ac/prune-wo-the-repository'Junio C Hamano9-21/+27
Some code paths in the "git prune" used to ignore passed in repository object and used the_repository singleton instance instead, which has been corrected. * ac/prune-wo-the-repository: builtin/prune: stop depending on 'the_repository' repository: move 'repository_format_precious_objects' to repo scope
2025-07-14Merge branch 'bs/config-mak-freebsd'Junio C Hamano4-30/+3
Drop FreeBSD 4 support and assume we are at least at FreeBSD 6 with memmem() supported. * bs/config-mak-freebsd: build: retire NO_UINTMAX_T config.mak.uname: set NO_MEMMEM only for functional version
2025-07-14Merge branch 'cb/total-ram-bsd-fix'Junio C Hamano1-3/+10
Use of sysctl() system call to learn the total RAM size used on BSDs has been corrected. * cb/total-ram-bsd-fix: builtin/gc: correct total_ram calculation with HAVE_BSD_SYSCTL
2025-07-14Merge branch 'bs/remote-helpers-doc-markup-fix'Junio C Hamano1-1/+1
Docfix. * bs/remote-helpers-doc-markup-fix: gitremote-helpers.adoc: fix formatting
2025-07-14gpg-interface: expand gpg.program as a pathJonas Brandstötter2-2/+2
This allows using a custom gpg program under the user's home directory by specifying a path starting with '~' [gpg] program = "~/.local/bin/mygpg" Signed-off-by: Jonas Brandstötter <jonas.brandstoetter@gmx.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-14revision: make helper for pathspec to bloom keyvecLidong Yan1-16/+29
When preparing to use bloom filters in a revision walk, Git populates a boom_keyvec with an array of bloom keys for the components of a path. Before we create the ability to map multiple pathspecs to multiple bloom_keyvecs, extract the conversion from a pathspec to a bloom_keyvec into its own helper method. This simplifies the state that persists in prepare_to_use_bloom_filter() as well as makes the future change much simpler. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-14bloom: replace struct bloom_key * with struct bloom_keyvecLidong Yan4-49/+132
Previously, we stored bloom keys in a flat array and marked a commit as NOT TREESAME if any key reported "definitely not changed". To support multiple pathspec items, we now require that for each pathspec item, there exists a bloom key reporting "definitely not changed". This "for every" condition makes a flat array insufficient, so we introduce a new structure to group keys by a single pathspec item. `struct bloom_keyvec` is introduced to replace `struct bloom_key *` and `bloom_key_nr`. And because we want to support multiple pathspec items, we added a bloom_keyvec * and a bloom_keyvec_nr field to `struct rev_info` to represent an array of bloom_keyvecs. This commit still optimize only one pathspec item, thus bloom_keyvec_nr can only be 0 or 1. New bloom_keyvec_* functions are added to create and destroy a keyvec. bloom_filter_contains_vec() is added to check if all key in keyvec is contained in a bloom filter. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-14bloom: rename function operates on bloom_keyLidong Yan6-19/+16
git code style requires that functions operating on a struct S should be named in the form S_verb. However, the functions operating on struct bloom_key do not follow this convention. Therefore, fill_bloom_key() and clear_bloom_key() are renamed to bloom_key_fill() and bloom_key_clear(), respectively. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-14bloom: add test helper to return murmur3 hashLidong Yan3-12/+17
In bloom.h, murmur3_seeded_v2() is exported for the use of test murmur3 hash. To clarify that murmur3_seeded_v2() is exported solely for testing purposes, a new helper function test_murmur3_seeded() was added instead of exporting murmur3_seeded_v2() directly. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-14gitk: Add support of SHA256 repositoriesTakashi Iwai1-25/+58
This patch adds a basic support of SHA256 Git repository to Gitk, so that Gitk can show and operate on both SHA1 and SHA256 repos gracefully. Since SHA256 has a longer ID length (64 char) than SHA1 (40 char), many field widths are adjusted to fit with it. A caveat is that the configuration of auto selection length is shared between SHA1 and SHA256 repos. That is, once when this value is saved and read, it's applied to both repo types, which may result in shorter selection than the full SHA256 ID. We may introduce another individual config for sha256 (actually I did write in the first version), but for simplicity, the common config is used as of writing this. Many lines still refer "sha1" although they may point to both SHA1 and SHA256. They are left untouched for making the changes simpler. This patch is based on the early work by Rostislav Krasny: https://patchwork.kernel.org/project/git/patch/pull.979.git.1623687519832.gitgitgadget@gmail.com I refreshed, revised and extended to the latest state. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-11ci: use Meson's new `--slice` optionPatrick Steinhardt2-2/+2
As executing our test suite is notoriously slow on Windows we use matrix jobs in our CI systems to slice up tests and run them via multiple jobs. On Meson this is done with a comparatively complex PowerShell invocation as Meson didn't yet have a native way to slice tests like this. I have upstreamed a new `--slice` option [1] that addresses this use case though, which has been merged and released with Meson 1.8. Both GitLab and GitHub CI have Meson 1.8.2 available by now, so let's update the jobs to use that new option. [1]: https://github.com/mesonbuild/meson/pull/14092 Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-11meson: update subproject wrappersPatrick Steinhardt2-18/+18
Update subproject wrappers to newer versions by executing `meson wrap update` in the project's root directory Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-11doc: correct doc for glob pathspecRussell Hanneken1-3/+2
gitglossary documents Git pathspecs. One type of pathspec is the "glob" pathspec, prefixed with the magic word "glob". Regarding glob pathspecs, gitglossary says, '"**/foo" matches file or directory "foo" anywhere, the same as pattern "foo".' That last phrase ('the same as pattern "foo") is incorrect. "**/foo" and "foo" are not equivalent. "**/foo" matches foo anywhere, but "foo" does not. This change removes the incorrect phrase from the glob pathspec doc. Signed-off-by: Russell Hanneken <rhanneken@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-10daemon: use sigaction() to install child_handler()Carlo Marcelo Arenas Belón1-5/+7
Replace signal() with an equivalent invocation of sigaction(), but make sure to NOT set SA_RESTART so the original code that expects to be interrupted when children complete still works as designed. This change has the added benefit of using BSD signal semantics reliably and therefore not needing the rearming call in the signal handler. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>