aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2025-08-04Git 2.51-rc0v2.51.0-rc0Junio C Hamano1-0/+21
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-04Merge branch 'jc/test-hashmap-is-still-here'Junio C Hamano1-0/+5
Comment fix. * jc/test-hashmap-is-still-here: test-hashmap: document why it is no longer used but still there
2025-08-04Merge branch 'kh/doc-fast-import-historical'Junio C Hamano1-1/+1
Doc update. * kh/doc-fast-import-historical: doc: fast-import: contextualize the hardware cost
2025-08-04Merge branch 'ms/meson-with-ancient-git-wo-ls-files-dedup'Junio C Hamano1-3/+8
Build fix. * ms/meson-with-ancient-git-wo-ls-files-dedup: meson: tolerate errors from git ls-files --deduplicate
2025-08-04Merge branch 'jc/doc-release-vs-clear'Junio C Hamano1-2/+3
Doc update. * jc/doc-release-vs-clear: CodingGuidelines: clarify that S_release() does not reinitialize
2025-08-04Merge branch 'ch/t7450-recursive-clone-test-fix'Junio C Hamano1-1/+1
Test fix. * ch/t7450-recursive-clone-test-fix: t7450: inspect the correct path a broken code would write to
2025-08-04Merge branch 'js/prompt-crlf-fix'Junio C Hamano1-7/+1
Interactive prompt code did not correctly strip CRLF from the end of line on Windows. * js/prompt-crlf-fix: interactive: do strip trailing CRLF from input
2025-08-04Merge branch 'ps/meson-clar-decls-fix'Junio C Hamano2-1/+9
Build fix. * ps/meson-clar-decls-fix: meson: ensure correct "clar-decls.h" header is used
2025-08-04Merge branch 'js/mingw-fixes'Junio C Hamano2-76/+23
Windows fixes. * js/mingw-fixes: mingw: support Windows Server 2016 again mingw_rename: support ReFS on Windows 2022 mingw: drop Windows 7-specific work-around mingw_open_existing: handle directories better
2025-08-04Merge branch 'lm/add-p-context'Junio C Hamano20-83/+324
"git add/etc -p" now honor the diff.context configuration variable, and also they learn to honor the -U<n> command-line option. * lm/add-p-context: add-patch: add diff.context command line overrides add-patch: respect diff.context configuration t: use test_config in t4055 t: use test_grep in t3701 and t4055
2025-08-04Merge branch 'ps/config-wo-the-repository'Junio C Hamano161-1099/+1015
The config API had a set of convenience wrapper functions that implicitly use the_repository instance; they have been removed and inlined at the calling sites. * ps/config-wo-the-repository: (21 commits) config: fix sign comparison warnings config: move Git config parsing into "environment.c" config: remove unused `the_repository` wrappers config: drop `git_config_set_multivar()` wrapper config: drop `git_config_get_multivar_gently()` wrapper config: drop `git_config_set_multivar_in_file_gently()` wrapper config: drop `git_config_set_in_file_gently()` wrapper config: drop `git_config_set()` wrapper config: drop `git_config_set_gently()` wrapper config: drop `git_config_set_in_file()` wrapper config: drop `git_config_get_bool()` wrapper config: drop `git_config_get_ulong()` wrapper config: drop `git_config_get_int()` wrapper config: drop `git_config_get_string()` wrapper config: drop `git_config_get_string()` wrapper config: drop `git_config_get_string_multi()` wrapper config: drop `git_config_get_value()` wrapper config: drop `git_config_get_value()` wrapper config: drop `git_config_get()` wrapper config: drop `git_config_clear()` wrapper ...
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-04revert: initialize const valueJeff King1-1/+1
When building with clang-22 and DEVELOPER=1 mode, this warning causes us to fail compilation: builtin/revert.c:114:13: error: default initialization of an object of type 'const char' leaves the object uninitialized [-Werror,-Wdefault-const-init-var-unsafe] 114 | const char sentinel_value; | ^ The compiler is right that this code is a bit funny. We declare a const value without an initializer. It cannot be assigned to because of the const, but without an initializer it has no predictable value. So as a variable it can never have any useful function, and if we tried to look at it, we'd get undefined behavior. But it does have a function. We never use its value, but rather use its address as a sentinel value for some other variables: const char *gpg_sign = &sentinel_value; ...maybe set gpg_sign via parse_options... if (gpg_sign != &sentinel_value) ...we got a non-default value... Normally we'd use NULL as a sentinel value for a pointer, but it doesn't work here because we also want to detect --no-gpg-sign, which is marked by setting the pointer to NULL. We need a separate "this was not touched" value, which is what this sentinel variable gives us. So the code is correct as-is, but the sentinel variable itself is funny enough that it's understandable for a compiler warning to flag it. Let's try to appease the compiler. There are a few possible options: 1. Instead of a variable, we could just construct an artificial sentinel address like "1", "-1", etc. I think these technically fall afoul of the C standard (even if we do not access them, even constructing invalid pointers is not always allowed). But it's also something we do elsewhere, and even happens in some standard interfaces (e.g., mmap()'s MMAP_FAILED value). It does involve some annoying casts, though. 2. We can mark it as static. That gives it a definite value, but perhaps makes people wonder if the static-ness is important, when it's not. 3. We can just give it a value to shut the compiler up, even though nobody cares about that value. I went with (3) here as the smallest and most obvious change. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-03gitk: Mention globs in description of preference to hide custom refsIlya Grigoriev1-1/+1
This clarifies that one has to enter e.g. `jj/keep/*` and not just `jj/keep`. Follows up on 2441e19. Signed-off-by: Ilya Grigoriev <ilyagr@users.noreply.github.com>
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-03mingw: support Windows Server 2016 againJohannes Schindelin1-1/+3
It was reported to the Git for Windows project that a simple `git init` fails on Windows Server 2016: D:\Dev\test> git init error: could not write config file D:/Dev/test/.git/config: Function not implemented fatal: could not set 'core.repositoryformatversion' to '0' According to https://endoflife.date/windows-server, Windows Server 2016 is officially supported for another one-and-a-half years as of time of writing, so this is not good. The culprit is the `mingw_rename()` changes that try to use POSIX semantics when available, but fail to fall back properly on Windows Server 2016. This fixes https://github.com/git-for-windows/git/issues/5695. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-03mingw_rename: support ReFS on Windows 2022Johannes Schindelin1-1/+1
ReFS is an alternative filesystem to NTFS. On Windows 2022, it seems not to support the rename operation using POSIX semantics that Git uses on Windows as of 391bceae4350 (compat/mingw: support POSIX semantics for atomic renames, 2024-10-27). However, Windows 2022 reports `ERROR_NOT_SUPPORTED` in this instance. This is in contrast to `ERROR_INVALID_PARAMETER` (as previous Windows versions would report that do not support POSIX semantics in renames at all). Let's handle both errors the same: by falling back to the best-effort option, namely to rename without POSIX semantics. This fixes https://github.com/git-for-windows/git/issues/5427 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-03mingw: drop Windows 7-specific work-aroundJohannes Schindelin2-70/+4
In ac33519ddfa8 (mingw: restrict file handle inheritance only on Windows 7 and later, 2019-11-22), I introduced code to safe-guard the defense-in-depth handling that restricts handles' inheritance so that it would work with Windows 7, too. Let's revert this patch: Git for Windows dropped supporting Windows 7 (and Windows 8) directly after Git for Windows v2.46.2. For full details, see https://gitforwindows.org/requirements#windows-version. Actually, on second thought: revert only the part that makes this handle inheritance restriction logic optional and that suggests to open a bug report if it fails, but keep the fall-back to try again without said logic: There have been a few false positives over the past few years (where the warning was triggered e.g. because Defender was still accessing a file that Git wanted to overwrite), and the fall-back logic seems to have helped occasionally in such situations. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-03mingw_open_existing: handle directories betterMatthias Aßhauer1-5/+16
CreateFileW() requires FILE_FLAG_BACKUP_SEMANTICS to create a directory handle [1] and errors out with ERROR_ACCESS_DENIED without this flag. Fall back to accessing Directory handles this way. [1] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew#directories This fixes https://github.com/git-for-windows/git/issues/5068 Signed-off-by: Matthias Aßhauer <mha1993@live.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-03describe: use prio_queue_replace()René Scharfe1-16/+52
Optimize the sequence get+put to peek+replace to avoid one unnecessary heap rebalance. Do that by tracking partial get operations in a prio_queue wrapper, struct lazy_queue, and using wrapper functions that turn get into peek and put into replace as needed. This is simpler than tracking the state explicitly in the calling code. We get a nice speedup on top of the previous patch's conversion to prio_queue: Benchmark 1: ./git_2.50.1 describe $(git rev-list v2.41.0..v2.47.0) Time (mean ± σ): 1.559 s ± 0.002 s [User: 1.493 s, System: 0.051 s] Range (min … max): 1.556 s … 1.563 s 10 runs Benchmark 2: ./git_describe_pq describe $(git rev-list v2.41.0..v2.47.0) Time (mean ± σ): 1.204 s ± 0.001 s [User: 1.138 s, System: 0.051 s] Range (min … max): 1.202 s … 1.205 s 10 runs Benchmark 3: ./git describe $(git rev-list v2.41.0..v2.47.0) Time (mean ± σ): 850.9 ms ± 1.6 ms [User: 786.6 ms, System: 49.8 ms] Range (min … max): 849.1 ms … 854.1 ms 10 runs Summary ./git describe $(git rev-list v2.41.0..v2.47.0) ran 1.41 ± 0.00 times faster than ./git_describe_pq describe $(git rev-list v2.41.0..v2.47.0) 1.83 ± 0.00 times faster than ./git_2.50.1 describe $(git rev-list v2.41.0..v2.47.0) Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-03describe: use prio_queueRené Scharfe1-24/+27
Replace the use a list-based priority queue whose order is maintained by commit_list_insert_by_date() with a prio_queue. This avoids quadratic worst-case complexity. And in the somewhat contrived example of describing the 4751 commits from v2.41.0 to v2.47.0 in one go (to get a sizable chunk of describe work with minimal ref loading overhead) it's significantly faster: Benchmark 1: ./git_2.50.1 describe $(git rev-list v2.41.0..v2.47.0) Time (mean ± σ): 1.558 s ± 0.002 s [User: 1.492 s, System: 0.051 s] Range (min … max): 1.557 s … 1.562 s 10 runs Benchmark 2: ./git describe $(git rev-list v2.41.0..v2.47.0) Time (mean ± σ): 1.209 s ± 0.006 s [User: 1.143 s, System: 0.051 s] Range (min … max): 1.201 s … 1.219 s 10 runs Summary ./git describe $(git rev-list v2.41.0..v2.47.0) ran 1.29 ± 0.01 times faster than ./git_2.50.1 describe $(git rev-list v2.41.0..v2.47.0) Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02trace2: do not use strbuf_split*()Junio C Hamano1-51/+27
tr2_cfg_load_patterns() and tr2_load_env_vars() functions are functions with very similar structure that each reads an environment variable, splits its value at the ',' boundaries, and trims the resulting string pieces into an array of strbufs. But the code paths that later use these strbufs take no advantage of the strbuf-ness of the result (they do not benefit from <ptr,len> representation to avoid having to run strlen(<ptr>), for example). Simplify the code by teaching these functions to split into a string list instead; even the trimming comes for free ;-). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02trace2: trim_trailing_newline followed by trim is a no-opJunio C Hamano1-2/+0
strbuf_trim_trailing_newline() removes a LF or a CRLF from the tail of a string. If the code plans to call strbuf_trim() immediately after doing so, the code is better off skipping the EOL trimming in the first place. After all, LF/CRLF at the end is a mere special case of whitespaces at the end of the string, which will be removed by strbuf_rtrim() anyway. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02sub-process: do not use strbuf_split*()Junio C Hamano1-9/+6
The code to read status from subprocess reads one packet line and tries to find "status=<foo>". It is way overkill to split the line into an array of two strbufs to extract <foo>. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02environment: do not use strbuf_split*()Junio C Hamano1-7/+12
environment.c:get_git_namespace() learns the raw namespace from an environment variable, splits it at "/", and appends them after "refs/namespaces/"; the reason why it splits first is so that an empty string resulting from double slashes can be omitted. The split pieces do not need to be edited in any way, so an array of strbufs is a wrong data structure to use. Instead split into a string list and use the pieces from there. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02config: do not use strbuf_split()Junio C Hamano1-13/+10
When parsing an old-style GIT_CONFIG_PARAMETERS environment variable, the code parses key=value pairs by splitting them at '=' into an array of strbuf's. As strbuf_split() leaves the delimiter at the end of the split piece, the code has to manually trim it. If we split with string_list_split(), that becomes unnecessary. Retire the use of strbuf_split() from this code path. Note that the max parameter of string_list_split() is of an ergonomically iffy design---it specifies the maximum number of times the function is allowed to split, which means that in order to split a text into up to 2 pieces, you have to pass 1, not 2. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02notes: do not use strbuf_split*()Junio C Hamano1-11/+12
When reading copy instructions from the standard input, the program reads a line, splits it into tokens at whitespace, and trims each of the tokens before using. We no longer need to use strbuf just to be able to trim, as string_list_split*() family now can trim while splitting a string. Retire the use of strbuf_split() from this code path. Note that this loop is a bit sloppy in that it ensures at least there are two tokens on each line, but ignores if there are extra tokens on the line. Tightening it is outside the scope of this series. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02merge-tree: do not use strbuf_split*()Junio C Hamano1-14/+16
When reading merge instructions from the standard input, the program reads from the standard input, splits the line into tokens at whitespace, and trims each of them before using. We no longer need to use strbuf just for trimming, as string_list_split*() family can trim while splitting a string. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02clean: do not use strbuf_split*() [part 2]Junio C Hamano1-9/+11
builtin/clean.c:filter_by_patterns_cmd() interactively reads a line that has exclude patterns from the user and splits the line into a list of patterns. It uses the strbuf_split() so that each split piece can then trimmed. There is no need to use strbuf anymore, thanks to the recent enhancement to string_list_split*() family that allows us to trim the pieces split into a string_list. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02clean: do not pass the whole structure when it is not necessaryJunio C Hamano1-3/+3
The callee parse_choice() only needs to access a NUL-terminated string; instead of insisting to take a pointer to a strbuf, just take a pointer to a character array. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02clean: do not use strbuf_split*() [part 1]Junio C Hamano1-27/+23
builtin/clean.c:parse_choice() is fed a single line of input, which is space or comma separated list of tokens, and a list of menu items. It parses the tokens into number ranges (e.g. 1-3 that means the first three items) or string prefix (e.g. 's' to choose the menu item "(s)elect") that specify the elements in the menu item list, and tells the caller which ones are chosen. For parsing the input string, it uses strbuf_split() to split it into bunch of strbufs. Instead use string_list_split_in_place(), for a few reasons. * strbuf_split() is a bad API function to use, that yields an array of strbuf that is a bad data structure to use in general. * string_list_split_in_place() allows you to split with "comma or space"; the current code has to preprocess the input string to replace comma with space because strbuf_split() does not allow this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02clean: do not pass strbuf by valueJunio C Hamano1-5/+5
When you pass a structure by value, the callee can modify the contents of the structure that was passed in without having to worry about changing the structure the caller has. Passing structure by value sometimes (but not very often) can be a valid way to give callee a temporary variable it can freely modify. But not a structure with members that are pointers, like a strbuf. builtin/clean.c:list_and_choose() reads a line interactively from the user, and passes the line (in a strbuf) to parse_choice() by value, which then munges by replacing ',' with ' ' (to accept both comma and space separated list of choices). But because the strbuf passed by value still shares the underlying character array buf[], this ends up munging the caller's strbuf contents. This is a catastrophe waiting to happen. If the callee causes the strbuf to be reallocated, the buf[] the caller has will become dangling, and when the caller does strbuf_release(), it would result in double-free. Stop calling the function with misleading call-by-value with strbuf. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02wt-status: avoid strbuf_split*()Junio C Hamano1-21/+10
strbuf is a very good data structure to work with string data without having to worry about running past the end of the string, but strbuf_split() is a wrong API and an array of strbuf that the function produces is a wrong thing to use in general. You do not edit these N strings split out of a single strbuf simultaneously. Often it is much better off to split a string into string_list and work with the resulting strings. wt-status.c:abbrev_oid_in_line() takes one line of rebase todo list (like "pick e813a0200a7121b97fec535f0d0b460b0a33356c title"), and for instructions that has an object name as the second token on the line, replace the object name with its unique abbreviation. After splitting these tokens out of a single line, no simultaneous edit on any of these pieces of string that takes advantage of strbuf API takes place. The final string is composed with strbuf API, but these split pieces are merely used as pieces of strings and there is no need for them to be stored in individual strbuf. Instead, split the line into a string_list, and compose the final string using these pieces. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02Merge branch 'jc/string-list-split' into jc/strbuf-splitJunio C Hamano21-90/+225
* jc/string-list-split: string-list: split-then-remove-empty can be done while splitting string-list: optionally omit empty string pieces in string_list_split*() diff: simplify parsing of diff.colormovedws string-list: optionally trim string pieces split by string_list_split*() string-list: unify string_list_split* functions string-list: align string_list_split() with its _in_place() counterpart string-list: report programming error with BUG
2025-08-02string-list: split-then-remove-empty can be done while splittingJunio C Hamano4-8/+7
Thanks to the new STRING_LIST_SPLIT_NONEMPTY flag, a common pattern to split a string into a string list and then remove empty items in the resulting list is no longer needed. Instead, just tell the string_list_split*() to omit empty ones while splitting. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02string-list: optionally omit empty string pieces in string_list_split*()Junio C Hamano3-0/+20
Teach the unified split_string() machinery a new flag bit, STRING_LIST_SPLIT_NONEMPTY, to cause empty split pieces to be omitted from the resulting string list. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02diff: simplify parsing of diff.colormovedwsJunio C Hamano1-13/+7
The code to parse this configuration variable, whose value is a comma-separated list of known tokens like "ignore-space-change" and "ignore-all-space", uses string_list_split() to split the value into pieces, and then places each piece of string in a strbuf to trim, before comparing the result with the list of known tokens. Thanks to the previous steps, now string_list_split() can trim the resulting pieces before it places them in the string list. Use it to simplify the code. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02string-list: optionally trim string pieces split by string_list_split*()Junio C Hamano3-5/+109
Teach the unified split_string() to take an optional "flags" word, and define the first flag STRING_LIST_SPLIT_TRIM to cause the split pieces to be trimmed before they are placed in the string list. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02string-list: unify string_list_split* functionsJunio C Hamano1-40/+56
Thanks to the previous step, the only difference between these two related functions is that string_list_split() works on a string without modifying its contents (i.e. taking "const char *") and the resulting pieces of strings are their own copies in a string list, while string_list_split_in_place() works on a mutable string and the resulting pieces of strings come from the original string. Consolidate their implementations into a single helper function, and make them a thin wrapper around it. We can later add an extra flags parameter to extend both of these functions by updating only the internal helper function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02string-list: align string_list_split() with its _in_place() counterpartJunio C Hamano19-35/+37
The string_list_split_in_place() function was updated by 52acddf3 (string-list: multi-delimiter `string_list_split_in_place()`, 2023-04-24) to take more than one delimiter characters, hoping that we can later use it to replace our uses of strtok(). We however did not make a matching change to the string_list_split() function, which is very similar. Before giving both functions more features in future commits, allow string_list_split() to also take more than one delimiter characters to make them closer to each other. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-02Merge branch 'strip-post-hooks' of github.com:orgads/git-guiJohannes Sixt1-22/+45
* 'strip-post-hooks' of github.com:orgads/git-gui: git-gui: strip the commit message after running commit-msg hook Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-08-02Merge branch 'ml/tcl90'Johannes Sixt13-45/+58
* ml/tcl90: git-gui: Allow Tcl 9.0 git-gui: use -profile tcl8 on encoding conversions git-gui: use -profile tcl8 for file input with Tcl 9 git-gui: themed.tcl: use full namespace for color git-gui: remove EOL translation for gets git-gui: do not mix -translation binary and -encoding git-gui: replace encoding binary with iso8859-1 git-gui: translation binary defines iso8859-1 git-gui: assure -eofchar {} on all channels Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-08-02Merge branch 'master' of https://github.com/alshopov/git-guiJohannes Sixt1-701/+13
* 'master' of https://github.com/alshopov/git-gui: git-gui i18n: Remove the locations within the Bulgarian translation git-gui i18n: Update Bulgarian translation (557t) Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-08-01string-list: report programming error with BUGJunio C Hamano1-2/+2
Passing a string list that has .strdup_strings bit unset to string_list_split(), or one that has .strdup_strings bit set to string_list_split_in_place(), is a programmer error. Do not use die() to abort the execution. Use BUG() instead. As a developer-facing message, the message string itself should be a lot more concise, but let's keep the original one for now. Signed-off-by: Junio C Hamano <gitster@pobox.com>
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-08-01meson: tolerate errors from git ls-files --deduplicateMartin Storsjö1-3/+8
When using the Meson build system with versions of Git before 2.31, that does not yet know the `git ls-files --deduplicate` option, one can observe the following error: ../meson.build:697:19: ERROR: Command `/usr/bin/git -C /home/martin/code/git ls-files --deduplicate '*.h' ':!contrib' ':!compat/inet_ntop.c' ':!compat/inet_pton.c' ':!compat/nedmalloc' ':!compat/obstack.*' ':!compat/poll' ':!compat/regex' ':!sha1collisiondetection' ':!sha1dc' ':!t/unit-tests/clar' ':!t/t[0-9][0-9][0-9][0-9]*' ':!xdiff'` failed with status 129. The failing command is used to find all header files in our code base, which is required for static analysis. Static analysis is an entirely optional feature that distributors typically don't care about, and we already know to skip running the command when we are not in a Git repository. But we do not handle the above failure gracefully, even though we could. Fix this by passing `check: false` to `run_command`, which makes it tolerate failures. Then check `returncode()` manually to decide whether to inspect the output. Signed-off-by: Martin Storsjö <martin@martin.st> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-01doc: fast-import: contextualize the hardware costKristoffer Haugsbakk1-1/+1
6e411d20440 (Initial draft of fast-import documentation., 2007-02-05) pointed out how much time a fast-import took on some hardware with a specific cost. Let’s further point out that this experiment was done in 2007. So modern hardware should have no issues with such a repo. Also move the parenthetical to the end now that it contains four words. Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-01CodingGuidelines: clarify that S_release() does not reinitializeJunio C Hamano1-2/+3
In the section for naming various API functions, the fact that S_release() only releases the resources without preparing the structure for immediate reuse becomes only apparent when you readentries for S_release() and S_clear(). Clarify the description of S_release() a bit to make the entry self sufficient. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-01Merge branch 'ml/tcltk-9'Johannes Sixt1-22/+52
* ml/tcltk-9: gitk: allow Tcl/Tk 9.0+ gitk: use -profile tcl8 on encoding conversions gitk: use -profile tcl8 for file input with Tcl 9 gitk: Tcl9 doesn't expand ~, use $env(HOME) gitk: switch to -translation binary gitk: update scrolling for TclTk 8.7+ / TIP 474 Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-08-01Merge branch 'oa/hide-more-refs'Johannes Sixt1-3/+31
* oa/hide-more-refs: gitk: Add user preference to hide specific references Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-08-01Merge branch 'ml/abandon-old-version'Johannes Sixt1-25/+48
* ml/abandon-old-version: gitk: restore ui colors after cancelling config dialog gitk: set config dialog color swatches in one place Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-08-01Merge branch 'master' of github.com:alshopov/gitkJohannes Sixt1-362/+13
* 'master' of github.com:alshopov/gitk: gitk i18n: Remove the locations within the Bulgarian translation gitk i18n: Update Bulgarian translation (322t) Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-08-01Merge branch 'mr/sort-refs-by-type'Johannes Sixt1-2/+2
* mr/sort-refs-by-type: gitk: filter invisible upstream refs from reference list gitk: avoid duplicated upstream refs Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-31interactive: do strip trailing CRLF from inputJohannes Sixt1-7/+1
`git reset -p file` on a Windows CMD refuses to do anything useful with this error message: (1/5) Unstage this hunk [y,n,q,a,d,j,J,g,/,e,p,?]? n 'nly one letter is expected, got 'n The letter 'O' at the beginning of the line is overwritten by an apostrophe, so, clearly the parser sees the string "n\r". strbuf_trim_trailing_newline() removes trailing CRLF from the string. In particular, it first removes LF if present, and if that was the case, it also removes CR if present. git_read_line_interactively() clearly intends to remove CRLF as it calls strbuf_trim_trailing_newline(). However, input is gathered using strbuf_getline_lf(), which already removes the trailing LF. Now strbuf_trim_trailing_newline() does not see LF, so that it does not remove CR, either, and leaves it for the caller to process. Call strbuf_getline() instead, which removes both LF and CR. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-31Merge branch 'ps/config-wo-the-repository' into ↵Junio C Hamano161-1099/+1017
pw/3.0-commentchar-auto-deprecation * ps/config-wo-the-repository: (21 commits) config: fix sign comparison warnings config: move Git config parsing into "environment.c" config: remove unused `the_repository` wrappers config: drop `git_config_set_multivar()` wrapper config: drop `git_config_get_multivar_gently()` wrapper config: drop `git_config_set_multivar_in_file_gently()` wrapper config: drop `git_config_set_in_file_gently()` wrapper config: drop `git_config_set()` wrapper config: drop `git_config_set_gently()` wrapper config: drop `git_config_set_in_file()` wrapper config: drop `git_config_get_bool()` wrapper config: drop `git_config_get_ulong()` wrapper config: drop `git_config_get_int()` wrapper config: drop `git_config_get_string()` wrapper config: drop `git_config_get_string()` wrapper config: drop `git_config_get_string_multi()` wrapper config: drop `git_config_get_value()` wrapper config: drop `git_config_get_value()` wrapper config: drop `git_config_get()` wrapper config: drop `git_config_clear()` wrapper ...
2025-07-31t7450: inspect the correct path a broken code would write tochenjianhu1-1/+1
Prior to 05e9cd64 (config: quote values containing CR character, 2025-05-19), a repository can trick "clone --recurse-submodules" into running a post-checkout hook shipped with the project. The test was written to make sure the trick would no longer run the hook with the fix in the commit. However, the test did not check for the path the hook would create; correct the path to the expected one if the bug were still with us. Signed-off-by: chenjianhu <chenjianhu@kylinos.cn> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-31git-gui: Allow Tcl 9.0Mark Levedahl1-1/+1
TclTk 9.0 is now shipping, and git-gui is now patched to support use of this newer version. Adjust required versions to allow Tcl/Tk >= 8.6, including 9.x. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-31git-gui: use -profile tcl8 on encoding conversionsMark Levedahl3-7/+14
git-gui in the prior commit learned to apply -profile tcl8 when reading files, avoiding errors on non-binary data streams whose encoding is not utf-8. But, git-gui also consumes binary data streams (generally blobs from commits) as the output of commands, and internally decodes this to support various displays. With Tcl9, errors occur in this decoding for the same reasons described in the previous commit: basically, the underlying data may contain extended ascii characters violating the assumption of utf-8 encoding. This problem has a similar fix to the prior issue: we must use the tlc8 profile when converting this data to the internal unicode format. Do so, again only on Tcl9 as Tcl8.6 does not recognize -profile, and only Tcl 9.0 makes strict the default. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-31git-gui: use -profile tcl8 for file input with Tcl 9Mark Levedahl1-0/+13
git-gui invokes many git commands expecting output in utf-8 encoding, but git accepts extended ascii (code page unknown) as utf-8 without validating, so cannot guarantee valid utf-8 on output. In particular, using any extended ascii code page has long been acceptable on git given that everyone on a project is aware of and uses that same code page to view all data. utf-8 accepts only 7-bit ascii characters in single bytes, and any characters outside of that base set require at least two bytes for representation in unicode. Tcl is a string based language, and transcodes all input data to an internal unicode format, and to whatever format is requested on output: "pure" binary is recoded byte by byte using iso8859-1. Tcl8.x silently recodes invalid utf-8 as binary data, so extended ascii characters maintain their binary value on output but may not display correctly. Tcl 8.7 added three profiles to control this behaviour: strict (raises exceptions), replace (replaces each invalid byte with ?), and the default tcl8 maintaining the old behavior. Tcl 9 changes the default profile to strict, meaning any invalid utf-8 raises an exception that git-gui does not handle. An example of this in the git repository is commit 7eb93c8965 ("[PATCH] Simplify git script", 2005-09-07). This includes extended ascii characters in the author name and commit message. The tcl8 profile used so far has acceptable behavior given git-gui's acceptance: this allows git-gui to accept extended ascii though it may display incorrectly. Let's continue that behavior by overriding open to use the tcl8 profile on Tcl9 and later: Tcl 8.6 does not understand fconfigure -profile, and Tcl 8.7 maintains the tcl8 profile. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-31git-gui: themed.tcl: use full namespace for colorMark Levedahl1-4/+4
Tcl 9 imposes strict requirements on namespaces for variables, while Tcl 8 does not. lib/themed.tcl does not use the fully qualified name for the "color" namespace, with result that variables are not found with Tcl 9.0. Fix this. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-31git-gui: remove EOL translation for getsMark Levedahl5-7/+7
git-gui configures '-translation lf' on a number of channels. The default configuration is 'auto', which on input changes any occurrence of \n, \r, or \r\n to \n, and on output changes any such EOL sequence to a platform dependent value (\n on Unix, \r\n on Windows). Such translation can be necessary, but much of what is configured now is redundant. In particular, many of the channels configured this way are then consumed by gets, which already recognizes any of \n, \r, or \r\n as terminators. Configuring a channel to first change these line endings, then give the result to gets, is redundant. The valid uses of -translation lf are for output where we do not want \r\n on Windows, and for consuming entire files without going through gets, assuring that \n will be used internally. Let's remove all the others that only serve to confuse. lib/diff.tcl must have -translation lf because \r\n might be stored in the repository (e.g., on Windows, with no crlf translation enabled), and git will treat \n as the line ending, while the preceding \r is just whitespace, and these may be split by ANSI color coding. git-gui's read_diff handles this correctly as-is. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-31Merge branch 'ml/windows-tie-loose-ends'Johannes Sixt3-37/+35
* ml/windows-tie-loose-ends: git-gui: use /cmd/git-gui.exe for shortcut git-gui: Windows tk_getSaveFile is not useful for shortcuts git-gui: let nice work on Windows git-gui: do not add directories to PATH on Windows Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-31git-gui: honor TCLTK_PATH in git-gui--askpassCarlo Marcelo Arenas Belón5-10/+42
Since its introduction in 8c76212 (git-gui: Add a simple implementation of SSH_ASKPASS., 2008-10-15), git-gui--askpass has been calling whatever wish interpreter is in the path, unlike git-gui. Correct that by turning it into a script that would be processed at build time. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-31git-gui: retire Git Gui.appCarlo Marcelo Arenas Belón9-234/+0
In a recent commit, the minimum version of Tcl/Tk was raised to 8.6, but the "app" relies on the system provided Framework that is based on 8.5. Remove it, and let git-gui use a third party version of Wish if available. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-31git-gui: fix dependency of GITGUI_MAIN on generatorCarlo Marcelo Arenas Belón1-1/+1
Since 854e883 (git-gui: extract script to generate "git-gui", 2025-03-11), the logic to generate the main script was pulled out of the Makefile, but adding the resulting generator as a dependency was missed. If the logic changes, the main script should be regenerated, so add it as a dependency. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-31git-gui: remove uname_O in MakefileCarlo Marcelo Arenas Belón1-1/+0
Last used in ae49066 (git gui Makefile - remove Cygwin modifications, 2023-06-26), and unused since. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-31gitk: filter invisible upstream refs from reference listMichael Rappazzo1-1/+1
In refill_reflist, upstream refs are now only included if their commits are visible in the current view. This prevents display issues like multiple highlighted branches when clicking entries. Signed-off-by: Michael Rappazzo <michael.rappazzo@infor.com>
2025-07-30test-hashmap: document why it is no longer used but still thereJunio C Hamano1-0/+5
As I ended up wasting a few dozen minutes looking for the reason why this is still here, help future developers by saving them from wasting their time by documenting why this code that apparently is not used by anybody is still here. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-30gitk: avoid duplicated upstream refsJohannes Sixt1-1/+1
It is possible that multiple local branches track the same upstream. In this case, the refs dialog lists the tracked upstream branch multiple times. This is undesirable. Make them unique. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2025-07-29Merge branch 'ps/object-store-midx' into ps/object-store-midx-dedup-infoJunio C Hamano10-124/+107
* 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-07-29git-gui i18n: Remove the locations within the Bulgarian translationAlexander Shopov1-573/+0
This makes sending diffs via mail list easier and brings the po-file in line with git po-file. Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2025-07-29git-gui i18n: Update Bulgarian translation (557t)Alexander Shopov1-514/+399
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2025-07-29gitk i18n: Remove the locations within the Bulgarian translationAlexander Shopov1-325/+0
This makes sending diffs via mail list easier and brings the po-file in line with git po-file. Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2025-07-29gitk i18n: Update Bulgarian translation (322t)Alexander Shopov1-362/+338
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2025-07-29add-patch: add diff.context command line overridesLeon Michalak19-35/+241
This patch compliments the previous commit, where builtins that use add-patch infrastructure now respect diff.context and diff.interHunkContext file configurations. In particular, this patch helps users who don't want to set persistent context configurations or just want a way to override them on a one-time basis, by allowing the relevant builtins to accept corresponding command line options that override the file configurations. This mimics commands such as diff and log, which allow for both context file configuration and command line overrides. Signed-off-by: Leon Michalak <leonmichalak6@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-29add-patch: respect diff.context configurationLeon Michalak4-3/+38
Various builtins that use add-patch infrastructure do not respect the user's diff.context and diff.interHunkContext file configurations. The user may be used to seeing their diffs with customized context size, but not in the patches "git add -p" shows them to pick from. Teach add-patch infrastructure to read these configuration variables and pass their values when spawning the underlying plumbing commands as their command line option. Signed-off-by: Leon Michalak <leonmichalak6@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-29t: use test_config in t4055Leon Michalak1-7/+7
Use the modern "test_config" test utility instead of manual"git config" as the former provides clean up on test completion. This is a prerequisite to the commits that follow which add to this test file. Signed-off-by: Leon Michalak <leonmichalak6@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-29t: use test_grep in t3701 and t4055Leon Michalak2-38/+38
As a preparatory clean-up, use the "test_grep" test utility instead of regular "grep" which provides better debug information if tests fail. Signed-off-by: Leon Michalak <leonmichalak6@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-29meson: ensure correct "clar-decls.h" header is usedPatrick Steinhardt2-1/+9
The "clar-decls.h" header gets generated by us to extract prototypes of unit test functions from our clar-based tests. This generated file is then written into "t/unit-tests/" and included via "unit-test.h". The intent of all this is that we can keep "-Wmissing-prototype" warnings enabled. If we had that warning disabled, it would be easy to miss in case any of the non-static functions had a typo in its name and thus wasn't picked up by our test case extractor. Including the file directly has a big downside though: if a source tree was built both with our Makefile and with Meson, then the Meson build would include the "clar-decls.h" file from our Makefile. And if those are out of sync we get compiler errors. We already fixed a similar issue in 4771501c0a (meson: ensure correct version-def.h is used, 2025-01-14). Let's do the same and pass the absolute path to "clar-decls.h" via a preprocessor define. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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-28xdiff: refactor xdl_hash_record()Phillip Wood2-6/+11
Inline the check for whitespace flags so that the compiler can hoist it out of the loop in xdl_prepare_ctx(). This improves the performance by 8%. $ hyperfine --warmup=1 -L rev HEAD,HEAD^ --setup='git checkout {rev} -- :/ && make git' ': {rev}; GIT_CONFIG_GLOBAL=/dev/null ./git log --oneline --shortstat v2.0.0..v2.5.0' Benchmark 1: : HEAD; GIT_CONFIG_GLOBAL=/dev/null ./git log --oneline --shortstat v2.0.0..v2.5.0 Time (mean ± σ): 1.670 s ± 0.044 s [User: 1.473 s, System: 0.196 s] Range (min … max): 1.619 s … 1.754 s 10 runs Benchmark 2: : HEAD^; GIT_CONFIG_GLOBAL=/dev/null ./git log --oneline --shortstat v2.0.0..v2.5.0 Time (mean ± σ): 1.801 s ± 0.021 s [User: 1.605 s, System: 0.192 s] Range (min … max): 1.766 s … 1.831 s 10 runs Summary ': HEAD^; GIT_CONFIG_GLOBAL=/dev/null ./git log --oneline --shortstat v2.0.0..v2.5.0' ran 1.08 ± 0.03 times faster than ': HEAD^^; GIT_CONFIG_GLOBAL=/dev/null ./git log --oneline --shortstat v2.0.0..v2.5.0' Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> 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-25git: show alias info only with lone -hRené Scharfe1-1/+1
Builtin commands show usage information on stdout if called with -h as their only option, usage.c::show_usage_if_asked() makes sure of that. Aliases show alias information on stderr if called with -h as the first option since a9a60b94cc (git.c: handle_alias: prepend alias info when first argument is -h, 2018-10-09). This is surprising when using aliases for commands that take -h as a normal argument among others, like git grep. Tighten the condition and show the alias information only if -h is the only option given, to be consistent with builtins. It's probably still is a good idea to write to stderr, as an alias command doesn't have to be a builtin and could instead produce output with just -h that might be spoiled by an extra alias info line. Reported-by: Kevin Brodsky <kevin.brodsky@arm.com> Signed-off-by: René Scharfe <l.s.r@web.de> 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-24fixup! submodule: skip redundant active entries when pattern covers pathJunio C Hamano1-3/+2
2025-07-24fixup! submodule: prevent overwriting .gitmodules on path reuseJunio C Hamano2-4/+4
2025-07-24submodule: skip redundant active entries when pattern covers pathK Jayatheerth2-6/+34
configure_added_submodule always writes an explicit submodule.<name>.active entry, even when the new path is already matched by submodule.active patterns. This leads to unnecessary and cluttered configuration. change the logic to centralize wildmatch-based pattern lookup, in configure_added_submodule. Wrap the active-entry write in a conditional that only fires when that helper reports no existing pattern covers the submodule’s path. Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-24submodule: prevent overwriting .gitmodules on path reuseK Jayatheerth3-0/+56
Adding a submodule at a path that previously hosted another submodule (e.g., 'child') reuses the submodule name derived from the path. If the original submodule was only moved (e.g., to 'child_old') and not renamed, this silently overwrites its configuration in .gitmodules. This behavior loses user configuration and causes confusion when the original submodule is expected to remain intact. It assumes that the path-derived name is always safe to reuse, even though the name might still be in use elsewhere in the repository. Teach module_add() to check if the computed submodule name already exists in the repository's submodule config, and if so, refuse the operation unless the user explicitly renames the submodule or uses the --force option, which will automatically generate a unique name by appending a number (e.g., child1). Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@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-23config: fix sign comparison warningsPatrick Steinhardt1-19/+21
There are a couple of -Wsign-compare warnings in "config.c": - `prepare_include_condition_pattern()` is returns a signed integer, where it either returns a negative error code or the index of the last dir separator in a path. That index will always be a non-negative number, but we cannot just change the return type to a `size_t` due to it being re-used as error code. This is fixed by splitting up concerns: the return value is only used as error code, and the prefix is now returned via an out-pointer. This fixes a sign comparison warning when comparing `text.len < prefix`, - We treat `struct config_store_data::seen` as signed integer in several places even though it's unsigned. - There are multiple trivial sign comparison warnings where we use a signed loop index to iterate through an unsigned number of items. Fix all of these issues and drop the `DISABLE_SIGN_COMPARE_WARNINGS` macro. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: move Git config parsing into "environment.c"Patrick Steinhardt55-514/+566
In "config.c" we host both the business logic to read and write config files as well as the logic to parse specific Git-related variables. On the one hand this is mixing concerns, but even more importantly it means that we cannot easily remove the dependency on `the_repository` in our config parsing logic. Move the logic into "environment.c". This file is a grab bag of all kinds of global state already, so it is quite a good fit. Furthermore, it also hosts most of the global variables that we're parsing the config values into, making this an even better fit. Note that there is one hidden change: in `parse_fsync_components()` we use an `int` to iterate through `ARRAY_SIZE(fsync_component_names)`. But as -Wsign-compare warnings are enabled in this file this causes a compiler warning. The issue is fixed by using a `size_t` instead. This change allows us to drop the `USE_THE_REPOSITORY_VARIABLE` declaration. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: remove unused `the_repository` wrappersPatrick Steinhardt1-28/+0
Remove the last couple of wrapper functions that implicitly depend on `the_repository`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_set_multivar()` wrapperPatrick Steinhardt4-20/+13
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_set_multivar()`. All callsites are adjusted so that they use `repo_config_set_multivar(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_multivar_gently()` wrapperPatrick Steinhardt5-17/+10
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_multivar_gently()`. All callsites are adjusted so that they use `repo_config_get_multivar_gently(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_set_multivar_in_file_gently()` wrapperPatrick Steinhardt5-38/+26
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_set_multivar_in_file_gently()`. All callsites are adjusted so that they use `repo_config_set_multivar_in_file_gently(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_set_in_file_gently()` wrapperPatrick Steinhardt8-38/+28
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_set_in_file_gently()`. All callsites are adjusted so that they use `repo_config_set_in_file_gently(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_set()` wrapperPatrick Steinhardt9-41/+36
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_set()`. All callsites are adjusted so that they use `repo_config_set(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_set_gently()` wrapperPatrick Steinhardt8-26/+21
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_set_gently()`. All callsites are adjusted so that they use `repo_config_set_gently(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_set_in_file()` wrapperPatrick Steinhardt3-13/+7
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_set_in_file()`. All callsites are adjusted so that they use `repo_config_set_in_file(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_bool()` wrapperPatrick Steinhardt21-39/+34
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_bool()`. All callsites are adjusted so that they use `repo_config_get_bool(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_ulong()` wrapperPatrick Steinhardt4-13/+8
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_ulong()`. All callsites are adjusted so that they use `repo_config_get_ulong(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_int()` wrapperPatrick Steinhardt13-36/+31
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_int()`. All callsites are adjusted so that they use `repo_config_get_int(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_string()` wrapperPatrick Steinhardt14-24/+19
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_string()`. All callsites are adjusted so that they use `repo_config_get_string(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_string()` wrapperPatrick Steinhardt12-30/+25
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_string()`. All callsites are adjusted so that they use `repo_config_get_string(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_string_multi()` wrapperPatrick Steinhardt5-12/+6
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_string_multi()`. All callsites are adjusted so that they use `repo_config_get_string_multi(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_value()` wrapperPatrick Steinhardt2-6/+1
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_value()`. All callsites are adjusted so that they use `repo_config_get_value(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get_value()` wrapperPatrick Steinhardt5-12/+7
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get_value()`. All callsites are adjusted so that they use `repo_config_get_value(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_get()` wrapperPatrick Steinhardt4-10/+5
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_get()`. All callsites are adjusted so that they use `repo_config_get(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config_clear()` wrapperPatrick Steinhardt3-8/+3
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config_clear()`. All callsites are adjusted so that they use `repo_config_clear(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-07-23config: drop `git_config()` wrapperPatrick Steinhardt118-153/+148
In 036876a1067 (config: hide functions using `the_repository` by default, 2024-08-13) we have moved around a bunch of functions in the config subsystem that depend on `the_repository`. Those function have been converted into mere wrappers around their equivalent function that takes in a repository as parameter, and the intent was that we'll eventually remove those wrappers to make the dependency on the global repository variable explicit at the callsite. Follow through with that intent and remove `git_config()`. All callsites are adjusted so that they use `repo_config(the_repository, ...)` instead. While some callsites might already have a repository available, this mechanical conversion is the exact same as the current situation and thus cannot cause any regression. Those sites should eventually be cleaned up in a later patch series. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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-22git-gui: do not mix -translation binary and -encodingMark Levedahl4-6/+6
git-gui has many instances of '-translation binary' and '-encoding $SOMETHING' on the same channel. As eofchar is always null given a prior commit, the net effect of having '-translation binary' in such configuration is only to change how text line endings are handled. For cases where the channel is opened to be consumed via gets, the eol translation is irrelevant because Tcl's gets is documented to recognize any of \n, \r, and \r\n as a line ending. So, keep only the '-encoding $SOMETHING' configuration in these cases, making the configuration more clear. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-22git-gui: replace encoding binary with iso8859-1Mark Levedahl2-3/+3
git-gui currently configures some channels as '-encoding binary' when the channel is not really binary (e.g, the channel is consumed as lines of text). In 8.6, '-encoding binary' is an alias for '-encoding iso8859), but TIP 699 removes this alias for Tcl 9.0. Let's switch to '-encoding iso8859-1' to be compatible across Tcl versions. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-22git-gui: translation binary defines iso8859-1Mark Levedahl4-9/+5
git-gui has many cases where -translation binary and -encoding binary are configured on the same channel. But, -translation binary defines a binary channel, which sets up -encoding iso8859-1 as part of its work. Tcl 8.x defines -encoding binary as an alias of -encoding iso8859-1, and this alias is deleted in Tcl 9.0. Let's delete the redundant encoding definition now. Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
2025-07-22git-gui: assure -eofchar {} on all channelsMark Levedahl6-11/+8
Per 6eb420ef61 ("git-gui: Always disable the Tcl EOF character when reading", 2007-07-17), git-gui should disable Tcl's EOF character detection on all files when on Windows: the default is disabled on all other platforms (and with Tcl 9.0, is disabled on Windows too). This EOF character is for compatibility with files / applications written for file systems that know only the disc sectors allocated, and not the number of bytes used. This has nothing to do with git. But, git-gui does not set -eofchar {} on all channels. To avoid any further leakage, let's just add this to the Windows specific override of open. This override is needed only as long as Tcl 8.x is in use (Tcl 9.0 makes -eofchar {} default on all platforms). Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
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-22git-gui: use /cmd/git-gui.exe for shortcutMark Levedahl1-1/+4
git-gui on Windows creates a shortcut that presumes the git-gui script will run on the basic Windows environment as configured. But, Git for Windows uses wrapper scripts to launch executables, assuring the environment is correct (see [1] for details). The launcher for git-gui is /cmd/git-gui.exe, is not on PATH, and is not detected or used by the current shortcut code. Let's look for this before trying the existing approaches. [1] https://gitforwindows.org/git-wrapper.html Signed-off-by: Mark Levedahl <mlevedahl@gmail.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