Commit Graph

77950 Commits (v2.51.0-rc0)

Author SHA1 Message Date
Junio C Hamano 721c9e5ce7 Git 2.51-rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-04 08:10:36 -07:00
Junio C Hamano f67496534c Merge branch 'jc/test-hashmap-is-still-here'
Comment fix.

* jc/test-hashmap-is-still-here:
  test-hashmap: document why it is no longer used but still there
2025-08-04 08:10:36 -07:00
Junio C Hamano 67fd2554bd Merge branch 'kh/doc-fast-import-historical'
Doc update.

* kh/doc-fast-import-historical:
  doc: fast-import: contextualize the hardware cost
2025-08-04 08:10:36 -07:00
Junio C Hamano dc87d078b4 Merge branch 'ms/meson-with-ancient-git-wo-ls-files-dedup'
Build fix.

* ms/meson-with-ancient-git-wo-ls-files-dedup:
  meson: tolerate errors from git ls-files --deduplicate
2025-08-04 08:10:35 -07:00
Junio C Hamano 67424f5bca Merge branch 'jc/doc-release-vs-clear'
Doc update.

* jc/doc-release-vs-clear:
  CodingGuidelines: clarify that S_release() does not reinitialize
2025-08-04 08:10:35 -07:00
Junio C Hamano d8f795e08a Merge branch 'ch/t7450-recursive-clone-test-fix'
Test fix.

* ch/t7450-recursive-clone-test-fix:
  t7450: inspect the correct path a broken code would write to
2025-08-04 08:10:35 -07:00
Junio C Hamano ea58adaeb9 Merge branch 'js/prompt-crlf-fix'
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-04 08:10:34 -07:00
Junio C Hamano c4c628f661 Merge branch 'ps/meson-clar-decls-fix'
Build fix.

* ps/meson-clar-decls-fix:
  meson: ensure correct "clar-decls.h" header is used
2025-08-04 08:10:34 -07:00
Junio C Hamano 817d661ce9 Merge branch 'js/mingw-fixes'
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-04 08:10:34 -07:00
Junio C Hamano d63f334a82 Merge branch 'lm/add-p-context'
"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-04 08:10:33 -07:00
Junio C Hamano 540aaa607c Merge branch 'ps/config-wo-the-repository'
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-04 08:10:33 -07:00
Junio C Hamano 10be1c41bc Merge branch 'kn/for-each-ref-skip-updates'
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-04 08:10:32 -07:00
Junio C Hamano 0dc39a6e83 Merge branch 'jt/switch-restore-no-longer-experimental'
"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-04 08:10:31 -07:00
Junio C Hamano fab596878c Merge branch 'jb/t7510-gpg-program-path'
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-04 08:10:31 -07:00
Junio C Hamano 8e75941b4f Merge branch 'cc/t9350-cleanup'
Test clean-up.

* cc/t9350-cleanup:
  t9350: redirect input to only fast-import
2025-08-04 08:10:31 -07:00
Junio C Hamano 41ca6a9533 Merge branch 'hy/blame-simplify-get-commit-info'
Code simplification.

* hy/blame-simplify-get-commit-info:
  blame: remove parameter detailed in get_commit_info()
2025-08-04 08:10:30 -07:00
Junio C Hamano e075325927 The seventeenth batch, just before -rc0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-03 18:44:28 -07:00
Junio C Hamano 750a95ba3f Merge branch 'hl/test-helper-fd-close'
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-03 18:44:27 -07:00
Junio C Hamano f61d8ce526 Merge branch 'ow/rebase-verify-insn-fmt-before-initializing-state'
"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-03 18:44:27 -07:00
Junio C Hamano 733b640d50 Merge branch 'ps/object-store-midx'
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-03 18:44:27 -07:00
Junio C Hamano 8d9f536a51 Merge branch 'kn/for-each-ref-skip'
"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-03 18:44:26 -07:00
Johannes Schindelin f559d42273 mingw: support Windows Server 2016 again
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-03 18:30:39 -07:00
Johannes Schindelin 51f9b623f2 mingw_rename: support ReFS on Windows 2022
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 391bceae43 (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-03 18:30:39 -07:00
Johannes Schindelin ce6ccbaf92 mingw: drop Windows 7-specific work-around
In ac33519ddf (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-03 18:30:38 -07:00
Matthias Aßhauer 5f277fc5f2 mingw_open_existing: handle directories better
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-03 18:30:38 -07:00
Junio C Hamano 866e6a391f The sixteenth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-08-01 11:27:14 -07:00
Junio C Hamano 80b80162fd Merge branch 'sk/reftable-clarify-tests'
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-01 11:27:14 -07:00
Junio C Hamano 6fe666b2ce Merge branch 'ly/pull-autostash'
"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-01 11:27:14 -07:00
Junio C Hamano cbcde15e73 Merge branch 'jc/document-test-balloons-in-flight'
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-01 11:27:13 -07:00
Junio C Hamano 8ad370f668 Merge branch 'ag/imap-send-list-folders-doc'
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-01 11:27:13 -07:00
Junio C Hamano 557c494c49 Merge branch 'cb/meson-avoid-broken-macos-pcre2'
Build fix for macOS.

* cb/meson-avoid-broken-macos-pcre2:
  meson: work around broken system PCRE2 dependency in macOS
2025-08-01 11:27:12 -07:00
Junio C Hamano 4f5b1616f2 Merge branch 'jc/ci-print-test-failures-fix'
CI fix.

* jc/ci-print-test-failures-fix:
  ci: allow github-actions print test failures again
2025-08-01 11:27:12 -07:00
Junio C Hamano a2384a76e7 Merge branch 'jk/unleak-reflog-expire-entry'
Leakfix.

* jk/unleak-reflog-expire-entry:
  reflog: close leak of reflog expire entry
2025-08-01 11:27:11 -07:00
Junio C Hamano 152871b88b Merge branch 'jc/do-not-scan-argv-without-parsing'
Update a hard-to-read in-code NEEDSWORK comment.

* jc/do-not-scan-argv-without-parsing:
  rev-list: update a NEEDSWORK comment
2025-08-01 11:27:11 -07:00
Junio C Hamano 2346617382 Merge branch 'jk/revision-no-early-output'
Remove unsupported, unused, and unsupportable old option from "git
log".

* jk/revision-no-early-output:
  revision: drop early output option
2025-08-01 11:27:11 -07:00
Junio C Hamano 6741b9b7c6 Merge branch 'jc/rev-list-info-cleanup'
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-01 11:27:10 -07:00
Martin Storsjö 3bdd897413 meson: tolerate errors from git ls-files --deduplicate
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-01 11:06:59 -07:00
Kristoffer Haugsbakk cca758d324 doc: fast-import: contextualize the hardware cost
6e411d2044 (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-01 10:40:26 -07:00
Junio C Hamano 4ac3302a1a CodingGuidelines: clarify that S_release() does not reinitialize
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-01 10:08:17 -07:00
Johannes Sixt 711a20827b interactive: do strip trailing CRLF from input
`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-31 14:17:54 -07:00
chenjianhu f3ef347bb2 t7450: inspect the correct path a broken code would write to
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-31 11:51:32 -07:00
Junio C Hamano 9b0781196a test-hashmap: document why it is no longer used but still there
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-30 16:19:36 -07:00
Leon Michalak 2b3ae04011 add-patch: add diff.context command line overrides
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-29 08:52:45 -07:00
Leon Michalak 2b0a2db2c0 add-patch: respect diff.context configuration
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-29 08:52:45 -07:00
Leon Michalak 97b99a9eb6 t: use test_config in t4055
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-29 08:52:45 -07:00
Leon Michalak 671b28394d t: use test_grep in t3701 and t4055
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-29 08:52:44 -07:00
Patrick Steinhardt 5247da07b8 meson: ensure correct "clar-decls.h" header is used
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-29 08:50:35 -07:00
Jeff King c26ecaf069 t7510: use $PWD instead of $(pwd) inside PATH
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-29 08:07:42 -07:00
Han Young 7e2943128e blame: remove parameter detailed in get_commit_info()
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-28 22:02:17 -07:00
Justin Tobler f609dc4f7a builtin: unmark git-switch and git-restore as experimental
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-28 14:24:03 -07:00