]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 days agoThe eleventh batch main master
Junio C Hamano [Wed, 16 Jul 2025 16:42:12 +0000 (09:42 -0700)] 
The eleventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 days agoMerge branch 'ag/doc-send-email'
Junio C Hamano [Wed, 16 Jul 2025 16:42:28 +0000 (09:42 -0700)] 
Merge branch 'ag/doc-send-email'

Documentation updates for "git send-email".

* ag/doc-send-email:
  docs: mention possible options for Proton Mail users
  docs: add a paragraph explaining the `sendmailCmd` option of sendemail
  docs: add an OAuth2.0 credential helper for AOL accounts
  docs: add outlookidfix config option to sendemail documentation
  docs: link OpenSSL's verify(1) manual page to know about -CAfile and -CApath options

2 days agoMerge branch 'rs/parse-options-precision'
Junio C Hamano [Wed, 16 Jul 2025 16:42:28 +0000 (09:42 -0700)] 
Merge branch 'rs/parse-options-precision'

Define .precision to more canned parse-options type to avoid bugs
coming from using a variable with a wrong type to capture the
parsed values.

* rs/parse-options-precision:
  parse-options: add precision handling for OPTION_COUNTUP
  parse-options: add precision handling for OPTION_BITOP
  parse-options: add precision handling for OPTION_NEGBIT
  parse-options: add precision handling for OPTION_BIT
  parse-options: add precision handling for OPTION_SET_INT
  parse-options: add precision handling for PARSE_OPT_CMDMODE
  parse-options: require PARSE_OPT_NOARG for OPTION_BITOP

2 days agoMerge branch 'ps/doc-pack-refs-auto-with-files-backend-fix'
Junio C Hamano [Wed, 16 Jul 2025 16:42:28 +0000 (09:42 -0700)] 
Merge branch 'ps/doc-pack-refs-auto-with-files-backend-fix'

Doc update.

* ps/doc-pack-refs-auto-with-files-backend-fix:
  docs/git-pack-refs: document heuristic used for packing loose refs

2 days agoMerge branch 'ps/refs-files-remove-empty-parent'
Junio C Hamano [Wed, 16 Jul 2025 16:42:27 +0000 (09:42 -0700)] 
Merge branch 'ps/refs-files-remove-empty-parent'

When a ref creation at refs/heads/foo/bar fails, the files backend
now removes refs/heads/foo/ if the directory is otherwise not used.

* ps/refs-files-remove-empty-parent:
  refs/files: remove empty parent dirs when ref creation fails

2 days agoMerge branch 'ps/t1006-tap-fix'
Junio C Hamano [Wed, 16 Jul 2025 16:42:27 +0000 (09:42 -0700)] 
Merge branch 'ps/t1006-tap-fix'

Test fix.

* ps/t1006-tap-fix:
  t1006: fix broken TAP format

2 days agoMerge branch 'ph/fetch-prune-optim'
Junio C Hamano [Wed, 16 Jul 2025 16:42:26 +0000 (09:42 -0700)] 
Merge branch 'ph/fetch-prune-optim'

"git fetch --prune" used to be O(n^2) expensive when there are many
refs, which has been corrected.

* ph/fetch-prune-optim:
  clean up interface for refs_warn_dangling_symrefs
  refs: remove old refs_warn_dangling_symref
  fetch-prune: optimize dangling-ref reporting

3 days agoThe tenth batch
Junio C Hamano [Tue, 15 Jul 2025 22:17:58 +0000 (15:17 -0700)] 
The tenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 days agoMerge branch 'ly/load-bitmap-leakfix'
Junio C Hamano [Tue, 15 Jul 2025 22:18:18 +0000 (15:18 -0700)] 
Merge branch 'ly/load-bitmap-leakfix'

Leakfix with a new and a bit invasive test.

* ly/load-bitmap-leakfix:
  pack-bitmap: add load corrupt bitmap test
  pack-bitmap: reword comments in test_bitmap_commits()
  pack-bitmap: fix memory leak if load_bitmap() failed

3 days agoMerge branch 'ps/object-store'
Junio C Hamano [Tue, 15 Jul 2025 22:18:17 +0000 (15:18 -0700)] 
Merge branch 'ps/object-store'

Code clean-up around object access API.

* ps/object-store:
  odb: rename `read_object_with_reference()`
  odb: rename `pretend_object_file()`
  odb: rename `has_object()`
  odb: rename `repo_read_object_file()`
  odb: rename `oid_object_info()`
  odb: trivial refactorings to get rid of `the_repository`
  odb: get rid of `the_repository` when handling submodule sources
  odb: get rid of `the_repository` when handling the primary source
  odb: get rid of `the_repository` in `for_each()` functions
  odb: get rid of `the_repository` when handling alternates
  odb: get rid of `the_repository` in `odb_mkstemp()`
  odb: get rid of `the_repository` in `assert_oid_type()`
  odb: get rid of `the_repository` in `find_odb()`
  odb: introduce parent pointers
  object-store: rename files to "odb.{c,h}"
  object-store: rename `object_directory` to `odb_source`
  object-store: rename `raw_object_store` to `object_database`

4 days agoThe ninth batch
Junio C Hamano [Mon, 14 Jul 2025 18:18:42 +0000 (11:18 -0700)] 
The ninth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 days agoMerge branch 'rp/apply-intent-to-add-fix'
Junio C Hamano [Mon, 14 Jul 2025 18:19:29 +0000 (11:19 -0700)] 
Merge branch 'rp/apply-intent-to-add-fix'

"git apply -N" should start from the current index and register
only new files, but it instead started from an empty index, which
has been corrected.

* rp/apply-intent-to-add-fix:
  apply docs: clarify wording for --intent-to-add
  t4140: test apply --intent-to-add interactions
  apply: only write intents to add for new files
  apply: read in the index in --intent-to-add mode

4 days agoMerge branch 'sj/string-list'
Junio C Hamano [Mon, 14 Jul 2025 18:19:28 +0000 (11:19 -0700)] 
Merge branch 'sj/string-list'

Code and test clean-up around string-list API.

* sj/string-list:
  u-string-list: move "remove duplicates" test to "u-string-list.c"
  u-string-list: move "filter string" test to "u-string-list.c"
  u-string-list: move "test_split_in_place" to "u-string-list.c"
  u-string-list: move "test_split" into "u-string-list.c"
  string-list: enable sign compare warnings check
  string-list: return index directly when inserting an existing element
  string-list: remove unused "insert_at" parameter from add_entry
  string-list: fix sign compare warnings for loop iterator

4 days agoMerge branch 'rj/freebsd-sysinfo-build-fix'
Junio C Hamano [Mon, 14 Jul 2025 18:19:28 +0000 (11:19 -0700)] 
Merge branch 'rj/freebsd-sysinfo-build-fix'

Build fix for FreeBSD.

* rj/freebsd-sysinfo-build-fix:
  build: fix FreeBSD build when sysinfo compat library installed

4 days agoMerge branch 'ts/merge-orig-head-doc-fix'
Junio C Hamano [Mon, 14 Jul 2025 18:19:27 +0000 (11:19 -0700)] 
Merge branch 'ts/merge-orig-head-doc-fix'

Doc fix.

* ts/merge-orig-head-doc-fix:
  docs: correct ORIG_HEAD example in "git merge" documentation

4 days agoMerge branch 'ps/perlless-test-fixes'
Junio C Hamano [Mon, 14 Jul 2025 18:19:27 +0000 (11:19 -0700)] 
Merge branch 'ps/perlless-test-fixes'

Test fixes.

* ps/perlless-test-fixes:
  t5333: fix missing terminator for sed(1) 's' command
  t4150: fix warning printed by awk due to escaped '\@'

4 days agoMerge branch 're/ssh-sign-buffer-fix'
Junio C Hamano [Mon, 14 Jul 2025 18:19:26 +0000 (11:19 -0700)] 
Merge branch 're/ssh-sign-buffer-fix'

Tempfile removal fix in the codepath to sign commits with SSH keys.

* re/ssh-sign-buffer-fix:
  ssh signing: don't detach the filename strbuf from key_file tempfile

4 days agoMerge branch 'hy/read-cache-lock-error-fix'
Junio C Hamano [Mon, 14 Jul 2025 18:19:26 +0000 (11:19 -0700)] 
Merge branch 'hy/read-cache-lock-error-fix'

A failure to open the index file for writing due to conflicting
access did not state what went wrong, which has been corrected.

* hy/read-cache-lock-error-fix:
  read-cache: report lock error when refreshing index

4 days agoMerge branch 'kn/clang-format-updates'
Junio C Hamano [Mon, 14 Jul 2025 18:19:26 +0000 (11:19 -0700)] 
Merge branch 'kn/clang-format-updates'

Update ".clang-format" and ".editorconfig" to match our style guide
a bit better.

* kn/clang-format-updates:
  meson: add rule to run 'git clang-format'
  clang-format: add 'RemoveBracesLLVM' to the main config
  clang-format: set 'ColumnLimit' to 0

4 days agoMerge branch 'kh/doc-config-subcommands'
Junio C Hamano [Mon, 14 Jul 2025 18:19:25 +0000 (11:19 -0700)] 
Merge branch 'kh/doc-config-subcommands'

Documentation updates.

* kh/doc-config-subcommands:
  config: mention --url in the synopsis
  config: use --value instead of value-pattern
  config: document --[no-]value
  config: use --value=<pattern> consistently
  config: document --[no-]show-names

4 days agoMerge branch 'mc/netrc-service-names'
Junio C Hamano [Mon, 14 Jul 2025 18:19:25 +0000 (11:19 -0700)] 
Merge branch 'mc/netrc-service-names'

"netrc" credential helper has been improved to understand textual
service names (like smtp) in addition to the numeric port numbers
(like 25).

* mc/netrc-service-names:
  contrib: better support symbolic port names in git-credential-netrc
  contrib: warn for invalid netrc file ports in git-credential-netrc
  contrib: use a more portable shebang for git-credential-netrc

4 days agoMerge branch 'jc/coccicheck-fails-make-when-it-fails'
Junio C Hamano [Mon, 14 Jul 2025 18:19:24 +0000 (11:19 -0700)] 
Merge branch 'jc/coccicheck-fails-make-when-it-fails'

"make coccicheck" succeeds even when spatch made suggestions, which
has been updated to fail in such a case.

* jc/coccicheck-fails-make-when-it-fails:
  coccicheck: fail "make" when it fails

4 days agoMerge branch 'ps/use-reftable-as-default-in-3.0'
Junio C Hamano [Mon, 14 Jul 2025 18:19:24 +0000 (11:19 -0700)] 
Merge branch 'ps/use-reftable-as-default-in-3.0'

The reftable ref backend has matured enough; Git 3.0 will make it
the default format in a newly created repositories by default.

* ps/use-reftable-as-default-in-3.0:
  setup: use "reftable" format when experimental features are enabled
  BreakingChanges: announce switch to "reftable" format

4 days agoMerge branch 'jk/all-negative-diff-filter-fix'
Junio C Hamano [Mon, 14 Jul 2025 18:19:24 +0000 (11:19 -0700)] 
Merge branch 'jk/all-negative-diff-filter-fix'

A diff-filter with negative-only specification like "git log
--diff-filter=d" did not trigger correctly, which has been fixed.

* jk/all-negative-diff-filter-fix:
  setup_revisions(): turn on diffs for all-negative diff filter

4 days agoMerge branch 'ac/prune-wo-the-repository'
Junio C Hamano [Mon, 14 Jul 2025 18:19:23 +0000 (11:19 -0700)] 
Merge branch 'ac/prune-wo-the-repository'

Some code paths in the "git prune" used to ignore passed in
repository object and used the_repository singleton instance
instead, which has been corrected.

* ac/prune-wo-the-repository:
  builtin/prune: stop depending on 'the_repository'
  repository: move 'repository_format_precious_objects' to repo scope

4 days agoMerge branch 'bs/config-mak-freebsd'
Junio C Hamano [Mon, 14 Jul 2025 18:19:23 +0000 (11:19 -0700)] 
Merge branch 'bs/config-mak-freebsd'

Drop FreeBSD 4 support and assume we are at least at FreeBSD 6 with
memmem() supported.

* bs/config-mak-freebsd:
  build: retire NO_UINTMAX_T
  config.mak.uname: set NO_MEMMEM only for functional version

4 days agoMerge branch 'cb/total-ram-bsd-fix'
Junio C Hamano [Mon, 14 Jul 2025 18:19:22 +0000 (11:19 -0700)] 
Merge branch 'cb/total-ram-bsd-fix'

Use of sysctl() system call to learn the total RAM size used on
BSDs has been corrected.

* cb/total-ram-bsd-fix:
  builtin/gc: correct total_ram calculation with HAVE_BSD_SYSCTL

4 days agoMerge branch 'bs/remote-helpers-doc-markup-fix'
Junio C Hamano [Mon, 14 Jul 2025 18:19:22 +0000 (11:19 -0700)] 
Merge branch 'bs/remote-helpers-doc-markup-fix'

Docfix.

* bs/remote-helpers-doc-markup-fix:
  gitremote-helpers.adoc: fix formatting

9 days agoparse-options: add precision handling for OPTION_COUNTUP
René Scharfe [Wed, 9 Jul 2025 09:46:28 +0000 (11:46 +0200)] 
parse-options: add precision handling for OPTION_COUNTUP

Similar to 09705696f7 (parse-options: introduce precision handling for
`OPTION_INTEGER`, 2025-04-17) support value variables of different sizes
for OPTION_COUNTUP.  Do that by requiring their "precision" to be set,
casting their "value" pointer accordingly and checking whether the value
fits.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 days agoparse-options: add precision handling for OPTION_BITOP
René Scharfe [Wed, 9 Jul 2025 09:46:20 +0000 (11:46 +0200)] 
parse-options: add precision handling for OPTION_BITOP

Similar to 09705696f7 (parse-options: introduce precision handling for
`OPTION_INTEGER`, 2025-04-17) support value variables of different sizes
for OPTION_BITOP.  Do that by requiring their "precision" to be set,
casting their "value" pointer accordingly and checking whether the value
fits.

Check if "devfal" fits into an integer variable with the given
"precision", but don't check "extra", as its value is only used to clear
bits, so cannot lead to an overflow.  Not checking continues to allow
e.g., using -1 to clear all bits even if the value variable has a
narrower type than intptr_t.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 days agoparse-options: add precision handling for OPTION_NEGBIT
René Scharfe [Wed, 9 Jul 2025 09:45:53 +0000 (11:45 +0200)] 
parse-options: add precision handling for OPTION_NEGBIT

Similar to 09705696f7 (parse-options: introduce precision handling for
`OPTION_INTEGER`, 2025-04-17) support value variables of different sizes
for OPTION_NEGBIT.  Do that by requiring their "precision" to be set,
casting their "value" pointer accordingly and checking whether the value
fits.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 days agoparse-options: add precision handling for OPTION_BIT
René Scharfe [Wed, 9 Jul 2025 09:45:33 +0000 (11:45 +0200)] 
parse-options: add precision handling for OPTION_BIT

Similar to 09705696f7 (parse-options: introduce precision handling for
`OPTION_INTEGER`, 2025-04-17) support value variables of different sizes
for OPTION_BIT.  Do that by requiring their "precision" to be set,
casting their "value" pointer accordingly and checking whether the value
fits.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 days agoparse-options: add precision handling for OPTION_SET_INT
René Scharfe [Wed, 9 Jul 2025 09:45:24 +0000 (11:45 +0200)] 
parse-options: add precision handling for OPTION_SET_INT

Similar to 09705696f7 (parse-options: introduce precision handling for
`OPTION_INTEGER`, 2025-04-17) support value variables of different sizes
for OPTION_SET_INT.  Do that by requiring their "precision" to be set,
casting their "value" pointer accordingly and checking whether the value
fits.

Factor out the casting code from the part of do_get_value() that handles
OPTION_INTEGER to avoid code duplication.  We're going to use it in the
next patches as well.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 days agoparse-options: add precision handling for PARSE_OPT_CMDMODE
René Scharfe [Wed, 9 Jul 2025 09:45:14 +0000 (11:45 +0200)] 
parse-options: add precision handling for PARSE_OPT_CMDMODE

Build on 09705696f7 (parse-options: introduce precision handling for
`OPTION_INTEGER`, 2025-04-17) to support value variables of different
sizes for PARSE_OPT_CMDMODE options.  Do that by requiring their
"precision" to be set and casting their "value" pointer accordingly.

Call the function that does the raw casting do_get_int_value() to
reserve the name get_int_value() for a more friendly wrapper we're
going to introduce in one of the next patches.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 days agoparse-options: require PARSE_OPT_NOARG for OPTION_BITOP
René Scharfe [Wed, 9 Jul 2025 09:44:09 +0000 (11:44 +0200)] 
parse-options: require PARSE_OPT_NOARG for OPTION_BITOP

OPTION_BITOP options don't take arguments.  Make sure they are declared
that way using the flag PARSE_OPT_NOARG.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 days agoThe eighth batch
Junio C Hamano [Tue, 8 Jul 2025 22:51:23 +0000 (15:51 -0700)] 
The eighth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 days agoMerge branch 'kn/fetch-push-bulk-ref-update'
Junio C Hamano [Tue, 8 Jul 2025 22:49:19 +0000 (15:49 -0700)] 
Merge branch 'kn/fetch-push-bulk-ref-update'

"git push" and "git fetch" are taught to update refs in batches to
gain performance.

* kn/fetch-push-bulk-ref-update:
  receive-pack: handle reference deletions separately
  refs/files: skip updates with errors in batched updates
  receive-pack: use batched reference updates
  send-pack: fix memory leak around duplicate refs
  fetch: use batched reference updates
  refs: add function to translate errors to strings

10 days agoMerge branch 'maint-2.50'
Junio C Hamano [Tue, 8 Jul 2025 22:43:31 +0000 (15:43 -0700)] 
Merge branch 'maint-2.50'

* maint-2.50:
  t: avoid git config syntax from newer releases
  Documentation/RelNotes: use .adoc extension for new security releases

10 days agoMerge branch 'maint-2.49' into maint-2.50 maint
Junio C Hamano [Tue, 8 Jul 2025 22:42:33 +0000 (15:42 -0700)] 
Merge branch 'maint-2.49' into maint-2.50

* maint-2.49:
  t: avoid git config syntax from newer releases

10 days agoMerge branch 'maint-2.48' into maint-2.49
Junio C Hamano [Tue, 8 Jul 2025 22:42:14 +0000 (15:42 -0700)] 
Merge branch 'maint-2.48' into maint-2.49

* maint-2.48:
  t: avoid git config syntax from newer releases

10 days agoMerge branch 'maint-2.47' into maint-2.48
Junio C Hamano [Tue, 8 Jul 2025 22:42:02 +0000 (15:42 -0700)] 
Merge branch 'maint-2.47' into maint-2.48

* maint-2.47:
  t: avoid git config syntax from newer releases

10 days agoMerge branch 'maint-2.46' into maint-2.47
Junio C Hamano [Tue, 8 Jul 2025 22:41:51 +0000 (15:41 -0700)] 
Merge branch 'maint-2.46' into maint-2.47

* maint-2.46:
  t: avoid git config syntax from newer releases

10 days agoMerge branch 'maint-2.45' into maint-2.46
Junio C Hamano [Tue, 8 Jul 2025 22:40:52 +0000 (15:40 -0700)] 
Merge branch 'maint-2.45' into maint-2.46

This turns into a no-op merge, since more recent versions of Git
newer than 2.46 track do support the newer "git config" syntax.

* maint-2.45:
  t: avoid git config syntax from newer releases

10 days agoMerge branch 'maint-2.44' into maint-2.45
Junio C Hamano [Tue, 8 Jul 2025 22:35:35 +0000 (15:35 -0700)] 
Merge branch 'maint-2.44' into maint-2.45

* maint-2.44:
  t: avoid git config syntax from newer releases

10 days agoMerge branch 'maint-2.43' into maint-2.44
Junio C Hamano [Tue, 8 Jul 2025 22:33:02 +0000 (15:33 -0700)] 
Merge branch 'maint-2.43' into maint-2.44

* maint-2.43:
  t: avoid git config syntax from newer releases

10 days agoMerge branch 'tz/avoid-newer-config-syntax-in-older-maint-tracks' into maint-2.43
Junio C Hamano [Tue, 8 Jul 2025 22:31:56 +0000 (15:31 -0700)] 
Merge branch 'tz/avoid-newer-config-syntax-in-older-maint-tracks' into maint-2.43

* tz/avoid-newer-config-syntax-in-older-maint-tracks:
  t: avoid git config syntax from newer releases

10 days agot: avoid git config syntax from newer releases
Todd Zullinger [Tue, 8 Jul 2025 21:05:27 +0000 (17:05 -0400)] 
t: avoid git config syntax from newer releases

In a recent security release, 05e9cd64ee (config: quote values
containing CR character, 2025-05-19) added calls to `git config get`,
`git config set`, and `git config unset` which are not present on the
maint-2.43 branch.

These subcommands were added in the following commits, released in
git-2.46.0:

  4e51389000 (builtin/config: introduce "get" subcommand, 2024-05-06),
  00bbdde141 (builtin/config: introduce "set" subcommand, 2024-05-06),
  95ea69c67b (builtin/config: introduce "unset" subcommand, 2024-05-06)

Revert to the previous `git config` syntax for older maintenance
branches.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 days agot1006: fix broken TAP format
Patrick Steinhardt [Tue, 8 Jul 2025 10:18:58 +0000 (12:18 +0200)] 
t1006: fix broken TAP format

When running t1006 via Meson we receive an error about invalid TAP
format:

    $ meson test t1006-cat-file
    1/1 t1006-cat-file        OK              3.86s   420 subtests passed

    stdout: 147: UNKNOWN: c308ae01840d8e620ad554ee5d77fe114dc2d912:path with spaces
    stdout: 159: UNKNOWN: 3625298bf5e7c464a7d0e38ea80c2a5b5904d9a3e5b2b025b67f360e09b68dc7:path with spaces
    ERROR: Unknown TAP output lines for a supported TAP version.
    This is probably a bug in the test; if they are not TAP syntax, prefix them with a #

    Ok:                1
    Fail:              0

While Meson copes with it alright, it's still annoying to see these
errors on every test run.

The root cause of the broken format is a call to grep(1) that gets
executed outside of a test case, which has been added recently via
9fd38038b9c (t1006: update 'run_tests' to test generic object
specifiers, 2025-06-02). This call is done to determine whether a
subsequent test case is expected to succeed or fail, so it makes sense
to have it execute outside of a test case. But whenever we do that, we
must be extra careful to not generate any output that breaks the TAP
format.

Fix the issue by adding '-q' to the command so that it doesn't print
any matching lines.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 days agorefs/files: remove empty parent dirs when ref creation fails
Patrick Steinhardt [Tue, 8 Jul 2025 10:19:54 +0000 (12:19 +0200)] 
refs/files: remove empty parent dirs when ref creation fails

When creating a new reference in the "files" backend we first create the
directory hierarchy for that reference, then create the lockfile for
that reference, and finally rename the lockfile into place. When the
transaction gets aborted we prune the lockfile, but we don't clean up
the directory hierarchy that we may have created for the lockfile.

In some egde cases this can lead to lots of empty directories being
cluttered in the ".git/refs" directory that really serve no purpose at
all. We know to prune such empty directories when packing refs, but that
only patches over the issue.

Improve this by removing empty parents when cleaning up still-locked
references in `files_transaction_cleanup()`. This function is also
called when preparing or committing the transaction, so this change also
helps when not explicitly aborting the transaction.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 days agodocs/git-pack-refs: document heuristic used for packing loose refs
Patrick Steinhardt [Tue, 8 Jul 2025 11:23:56 +0000 (13:23 +0200)] 
docs/git-pack-refs: document heuristic used for packing loose refs

The `git pack-refs --auto` flag asks the ref backend to decide for
itself whether or not references need to be repacked. This is done to
ensure that we don't repack in cases where the backend is already in a
good-enough state, which is typically the case for the "reftable"
backend that performs auto-compaction on writes.

As such, we initially only had heuristics in place for the "reftable"
backend. The "files" backend didn't have any heuristics, so we'd repack
loose references every time `git pack-refs --auto` was executed. This
caused excessive repacking with that backend though, which is why we
eventually implemented a heuristic via c3459ae9ef2 (refs/files: use
heuristic to decide whether to repack with `--auto`, 2024-09-04).

The documentation for the `--auto` flag hasn't been updated accordingly
and still claims that we don't have any metrics for the "files" backend.
Update it to reflect the new reality.

Reported-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 days agoMerge branch 'maint-2.49' into maint-2.50
Junio C Hamano [Tue, 8 Jul 2025 20:04:39 +0000 (13:04 -0700)] 
Merge branch 'maint-2.49' into maint-2.50

* maint-2.49:
  Documentation/RelNotes: use .adoc extension for new security releases

10 days agoDocumentation/RelNotes: use .adoc extension for new security releases
Taylor Blau [Tue, 8 Jul 2025 18:47:50 +0000 (14:47 -0400)] 
Documentation/RelNotes: use .adoc extension for new security releases

When preparing the latest round of security fixes, we wrote release
notes in v2.43.7, and then successively merged those up through to the
various 'maint' branches.

However, the 2.49 release series is the first to have commit 1f010d6bdf
(doc: use .adoc extension for AsciiDoc files, 2025-01-20). This means
that we should have renamed the new-but-historical release notes from
*.txt to *.adoc during the merge into the 'maint-2.49' branch, but
neglected to do so.

Rename them accordingly to match the convention introduced by
1f010d6bdf. Since the release materials in question here were prepared
before v2.50.0 was tagged, the 'maint' track for that release series is
OK as is.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoSync with Git 2.50.1
Junio C Hamano [Mon, 7 Jul 2025 22:08:10 +0000 (15:08 -0700)] 
Sync with Git 2.50.1

11 days agoThe seventh batch
Junio C Hamano [Mon, 7 Jul 2025 21:12:41 +0000 (14:12 -0700)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoMerge branch 'cb/ci-freebsd-update-to-14.3'
Junio C Hamano [Mon, 7 Jul 2025 21:12:57 +0000 (14:12 -0700)] 
Merge branch 'cb/ci-freebsd-update-to-14.3'

CI updates.

* cb/ci-freebsd-update-to-14.3:
  ci: update FreeBSD image to 14.3

11 days agoMerge branch 'jj/doc-branch-markup-fix'
Junio C Hamano [Mon, 7 Jul 2025 21:12:57 +0000 (14:12 -0700)] 
Merge branch 'jj/doc-branch-markup-fix'

Doc markup fix.

* jj/doc-branch-markup-fix:
  doc: improve formatting in branch section

11 days agoMerge branch 'cb/daemon-retry-interrupted-accept'
Junio C Hamano [Mon, 7 Jul 2025 21:12:57 +0000 (14:12 -0700)] 
Merge branch 'cb/daemon-retry-interrupted-accept'

When "git daemon" sees a signal while attempting to accept() a new
client, instead of retrying, it skipped it by mistake, which has
been corrected.

* cb/daemon-retry-interrupted-accept:
  daemon: correctly handle soft accept() errors in service_loop

11 days agoMerge branch 'jk/fix-leak-send-pack'
Junio C Hamano [Mon, 7 Jul 2025 21:12:56 +0000 (14:12 -0700)] 
Merge branch 'jk/fix-leak-send-pack'

Leakfix.

* jk/fix-leak-send-pack:
  send-pack: clean-up even when taking an early exit
  send-pack: clean up extra_have oid array

11 days agoMerge branch 'cb/daemon-fd-check-fix'
Junio C Hamano [Mon, 7 Jul 2025 21:12:56 +0000 (14:12 -0700)] 
Merge branch 'cb/daemon-fd-check-fix'

Remove unnecessary check from "git daemon" code.

* cb/daemon-fd-check-fix:
  daemon: remove unnecesary restriction for listener fd

11 days agoMerge branch 'jk/submodule-remote-lookup-cleanup'
Junio C Hamano [Mon, 7 Jul 2025 21:12:55 +0000 (14:12 -0700)] 
Merge branch 'jk/submodule-remote-lookup-cleanup'

Updating submodules from the upstream did not work well when
submodule's HEAD is detached, which has been improved.

* jk/submodule-remote-lookup-cleanup:
  submodule: look up remotes by URL first
  submodule: move get_default_remote_submodule()
  submodule--helper: improve logic for fallback remote name
  remote: remove the_repository from some functions
  dir: move starts_with_dot(_dot)_slash to dir.h
  remote: fix tear down of struct remote
  remote: remove branch->merge_name and fix branch_release()

11 days agossh signing: don't detach the filename strbuf from key_file tempfile
redoste [Mon, 7 Jul 2025 18:48:51 +0000 (20:48 +0200)] 
ssh signing: don't detach the filename strbuf from key_file tempfile

Detaching the filename string from the tempfile structure used to cause
delete_tempfile() to fail and the temporary file was not cleaned up.

While it's possible to get rid of the allocation and copy from
xstrdup(), it keeps the code symetric with the other branch since
interpolate_path() also allocates and ssh_signing_key_file is freed
in both cases.

The exisiting test was updated to check if the temporary files are
properly deleted. To prevent TMPDIR from leaking into the other tests, a
new subshell is created, however this prevents test_config from working.
The cleanup of the config changed in the subshell is done by
test_unconfig in a call to test_when_finished outside of it.

Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: redoste <redoste@redoste.xyz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agobuiltin/gc: correct total_ram calculation with HAVE_BSD_SYSCTL
Carlo Marcelo Arenas Belón [Mon, 7 Jul 2025 16:45:18 +0000 (09:45 -0700)] 
builtin/gc: correct total_ram calculation with HAVE_BSD_SYSCTL

The calls to sysctl() assume a 64-bit memory size for the variable
holding the value, but the actual size depends on the key name and
platform, at least for HW_PHYSMEM.

Detect any mismatched reads, and retry with a shorter variable
when needed.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agot5333: fix missing terminator for sed(1) 's' command
Patrick Steinhardt [Mon, 7 Jul 2025 11:08:34 +0000 (13:08 +0200)] 
t5333: fix missing terminator for sed(1) 's' command

In 6aec8d38fdd (t: refactor tests depending on Perl to print data,
2025-04-03) we have changed some of the tests in t4150 to use sed(1)
instead of Perl. One of the conversions is broken though:

    sed: -e expression #1, char 41: unterminated `s' command

Curiously enough, the test itself still passes. This is caused by a
sequence of failures:

  1. The output of sed(1) is piped into git-update-ref(1), and because
     sed(1) is the upstream command we don't notice that it fails.

  2. git-update-ref(1) does not receive any input and thus won't create
     any references.

  3. We then repack the repository with the configured pseudo merges
     pattern, but as we didn't create any references the pattern doesn't
     match anything.

  4. We use `test_pseudo_merges()` to compute the list of pseudo-merges
     and write it into a file. This file is empty as there are none.

  5. The loop over the pseudo-merges becomes a no-op.

  6. The final test succeeds as well because the number of lines in an
     empty file is obviously the same as the number of unique lines,
     namely zero.

Fix the issue by adding the terminating '|' to the sed(1) command.
Furthermore, make the test a tiny bit more robust by not using it as
part of a pipe.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agot4150: fix warning printed by awk due to escaped '\@'
Patrick Steinhardt [Mon, 7 Jul 2025 11:08:33 +0000 (13:08 +0200)] 
t4150: fix warning printed by awk due to escaped '\@'

In 6aec8d38fdd (t: refactor tests depending on Perl to print data,
2025-04-03) we have changed one of the tests in t4150 to use awk(1)
instead of Perl. The test works, but at least gawk(1) prints a warning
now:

    awk: cmd. line:3: warning: escape sequence `\@' treated as plain `@'

Fix this by removing the backslash.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agodocs: correct ORIG_HEAD example in "git merge" documentation
Timur Sultanaev [Sat, 5 Jul 2025 17:39:18 +0000 (17:39 +0000)] 
docs: correct ORIG_HEAD example in "git merge" documentation

Documentation for git-merge incorrectly notes that
tip of the current branch on ascii diagram is C,
while it is actually G (current branch is master,
HEAD on diagram is G).

Additionally diagrams on the page are adjusted
to use spaces instead of tabs, so that they align
regardless of tab size. This is in line with
diagrams on other git documentation pages.

Signed-off-by: Timur Sultanaev <str.write@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agobuild: fix FreeBSD build when sysinfo compat library installed
Ramsay Jones [Fri, 4 Jul 2025 22:23:11 +0000 (23:23 +0100)] 
build: fix FreeBSD build when sysinfo compat library installed

Commit 50dec7c566 ("config.mak.uname: add sysinfo() configuration for
cygwin", 2025-04-17) and later commit 187ce0222f ("configure.ac: upgrade
to a compilation check for sysinfo", 2025-05-19) added a 'sysinfo()'
check to the autoconf build.

The FreeBSD system has an optional sysinfo compatibility library, used
to assist in porting software, which causes the build to fail when it
is installed. The reason for the failure is the lack of '-lsysinfo'
during the linking step.

Several solutions were considered:

  - add a 'linking' check to configure.ac in order to determine the
    need to link a separate library (-lsysinfo). (This would require
    a similar change to meson.build).

  - change the order of the preprocessor conditionals in the total_ram()
    function in 'builtin/gc.c', so that the *BSD sysctl() function
    (in the HAVE_BSD_SYSCTL block) takes priority over the sysinfo()
    function (in the HAVE_SYSINFO block).

  - suppress the setting of HAVE_SYSINFO when HAVE_BSD_SYSCTL has been
    defined (in both configure.ac and meson.build).

The first solution above, while simple, adds unnecessary code (the
sysinfo compat function is likely implemented using sysctl() anyway)
when git is happy to use sysctl() on *BSD systems.

The second solution would only be required by the autoconf and meson
build systems, the Makefile already sets the build variables to the
required values (since they are not 'auto-detected').

Here we opt for the final solution above, since it only requires that
we prioritise the 'auto-detected' build variables in the autoconf and
meson builds.

In order to fix the FreeBSD build, move the sysinfo() check after the
determination of the HAVE_BSD_SYSCTL build variable, suppressing the
setting of HAVE_SYSINFO if HAVE_BSD_SYSCTL is defined. Apply this logic
to both the configure.ac and meson.build file.

[Thanks go to Renato Botelho <garga@FreeBSD.org> for testing this patch
on FreeBSD.]

Tested-by: Renato Botelho <garga@FreeBSD.org>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agobuiltin/prune: stop depending on 'the_repository'
Ayush Chandekar [Fri, 4 Jul 2025 14:12:35 +0000 (19:42 +0530)] 
builtin/prune: stop depending on 'the_repository'

Refactor builtin/prune.c to remove the dependency on the global
'the_repository'. Replace all the occurrences of 'the_repository' with
repo and thus remove the definition '#define
USE_THE_REPOSITORY_VARIABLE'. Also, add a test to make sure that 'git
prune -h' can be called when the repository is `NULL`.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agorepository: move 'repository_format_precious_objects' to repo scope
Ayush Chandekar [Fri, 4 Jul 2025 14:12:34 +0000 (19:42 +0530)] 
repository: move 'repository_format_precious_objects' to repo scope

The 'extensions.preciousObjects' setting when set true, prevents
operations that might drop objects from the object storage. This setting
is populated in the global variable
'repository_format_precious_objects'.

Move this global variable to repo scope by adding it to 'struct
repository and also refactor all the occurences accordingly.

This change is part of an ongoing effort to eliminate global variables,
improve modularity and help libify the codebase.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agou-string-list: move "remove duplicates" test to "u-string-list.c"
shejialuo [Sun, 29 Jun 2025 04:28:41 +0000 (12:28 +0800)] 
u-string-list: move "remove duplicates" test to "u-string-list.c"

We use "test-tool string-list remove_duplicates" to test the
"string_list_remove_duplicates" function. As we have introduced the unit
test, we'd better remove the logic from shell script to C program to
improve test speed and readability.

As all the tests in shell script are removed, let's just delete the
"t0063-string-list.sh" and update the "meson.build" file to align with
this change.

Also we could simply remove "DISABLE_SIGN_COMPARE_WARNINGS" due to we
have already deleted related code.

Unfortunately, we cannot totally remove "test-string-list.c" due to that
we would test the performance of sorting about string list by executing
"test-tool string-list sort" in "p0071-sort.sh".

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agou-string-list: move "filter string" test to "u-string-list.c"
shejialuo [Sun, 29 Jun 2025 04:28:32 +0000 (12:28 +0800)] 
u-string-list: move "filter string" test to "u-string-list.c"

We use "test-tool string-list filter" to test the "filter_string_list"
function. As we have introduced the unit test, we'd better remove the
logic from shell script to C program to improve test speed and
readability.

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agou-string-list: move "test_split_in_place" to "u-string-list.c"
shejialuo [Sun, 29 Jun 2025 04:28:23 +0000 (12:28 +0800)] 
u-string-list: move "test_split_in_place" to "u-string-list.c"

We use "test-tool string-list split_in_place" to test the
"string_list_split_in_place" function. As we have introduced the unit
test, we'd better remove the logic from shell script to C program to
improve test speed and readability.

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agou-string-list: move "test_split" into "u-string-list.c"
shejialuo [Sun, 29 Jun 2025 04:28:14 +0000 (12:28 +0800)] 
u-string-list: move "test_split" into "u-string-list.c"

We rely on "test-tool string-list" command to test the functionality of
the "string-list". However, as we have introduced clar test framework,
we'd better move the shell script into C program to improve speed and
readability.

Create a new file "u-string-list.c" under "t/unit-tests", then update
the Makefile and "meson.build" to build the file. And let's first move
"test_split" into unit test and gradually convert the shell script into
C program.

In order to create `string_list` easily by simply specifying strings in
the function call, create "t_vcreate_string_list_dup" function to do
this.

Then port the shell script tests to C program and remove unused
"test-tool" code and tests.

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agostring-list: enable sign compare warnings check
shejialuo [Sun, 29 Jun 2025 04:28:06 +0000 (12:28 +0800)] 
string-list: enable sign compare warnings check

In "add_entry", we call "get_entry_index" function to get the inserted
position. However, as the return type of "get_entry_index" function is
`int`, there is a sign compare warning when comparing the `index` with
the `list-nr` of unsigned type.

"get_entry_index" would always return unsigned index. However, the
current binary search algorithm initializes "left" to be "-1", which
necessitates the use of signed `int` return type.

The reason why we need to assign "left" to be "-1" is that in the
`while` loop, we increment "left" by 1 to determine whether the loop
should end. This design choice, while functional, forces us to use
signed arithmetic throughout the function.

To resolve this sign comparison issue, let's modify the binary search
algorithm with the following approach:

1. Initialize "left" to 0 instead of -1
2. Use `left < right` as the loop termination condition instead of
   `left + 1 < right`
3. When searching the right part, set `left = middle + 1` instead of
   `middle`

Then, we could delete "#define DISABLE_SIGN_COMPARE_WARNING" to enable
sign warnings check for "string-list".

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agostring-list: return index directly when inserting an existing element
shejialuo [Sun, 29 Jun 2025 04:27:57 +0000 (12:27 +0800)] 
string-list: return index directly when inserting an existing element

When inserting an existing element, "add_entry" would convert "index"
value to "-1-index" to indicate the caller that this element is in the
list already. However, in "string_list_insert", we would simply convert
this to the original positive index without any further action.

In 8fd2cb4069 (Extract helper bits from c-merge-recursive work,
2006-07-25), we create "path-list.c" and then introduce above code path.

Let's directly return the index as we don't care about whether the
element is in the list by using "add_entry". In the future, if we want
to let "add_entry" tell the caller, we may add "int *exact_match"
parameter to "add_entry" instead of converting the index to negative to
indicate.

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agostring-list: remove unused "insert_at" parameter from add_entry
shejialuo [Sun, 29 Jun 2025 04:27:49 +0000 (12:27 +0800)] 
string-list: remove unused "insert_at" parameter from add_entry

In "add_entry", we accept "insert_at" parameter which must be either -1
(auto) or between 0 and `list->nr` inclusive. Any other value is
invalid. When caller specify any invalid "insert_at" value, we won't
check the range and move the element, which would definitely cause the
trouble.

However, we only use "add_entry" in "string_list_insert" function and we
always pass the "-1" for "insert_at" parameter. So, we never use this
parameter to insert element in a user specified position.

And we should know why there is such code path in the first place. We
used to have another function "string_list_insert_at_index()", which
uses the extra "insert_at" parameter. And in f8c4ab611a (string_list:
remove string_list_insert_at_index() from its API, 2014-11-24), we
remove this function but we don't clean all the code path.

Let's simply delete this parameter as we'd better use "strmap" for such
functionality.

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agostring-list: fix sign compare warnings for loop iterator
shejialuo [Sun, 29 Jun 2025 04:27:41 +0000 (12:27 +0800)] 
string-list: fix sign compare warnings for loop iterator

There are a couple of "-Wsign-compare" warnings in "string-list.c". Fix
trivial ones that result from a mismatched loop iterator type.

There is a single warning left after these fixes. This warning needs
a bit more care and is thus handled in subsequent commits.

Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoread-cache: report lock error when refreshing index
Han Young [Thu, 3 Jul 2025 07:45:02 +0000 (15:45 +0800)] 
read-cache: report lock error when refreshing index

In the repo_refresh_and_write_index of read-cache.c, we return -1 to
indicate that writing the index to disk failed.
However, callers do not use this information. Commands such as stash print
  "could not write index"
and then exit, which does not help to discover the exact problem.

We can let repo_hold_locked_index print the error message if the locking
failed.

Signed-off-by: Han Young <hanyang.tony@bytedance.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoapply docs: clarify wording for --intent-to-add
Raymond E. Pasco [Mon, 7 Jul 2025 12:12:33 +0000 (08:12 -0400)] 
apply docs: clarify wording for --intent-to-add

Avoid using a double negative, and keep in mind that --index and
--cached are distinct modes of operation.

Signed-off-by: Raymond E. Pasco <ray@ameretat.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agot4140: test apply --intent-to-add interactions
Raymond E. Pasco [Mon, 7 Jul 2025 12:12:32 +0000 (08:12 -0400)] 
t4140: test apply --intent-to-add interactions

Test that applying a new file creation patch with --intent-to-add to
an existing index does not modify the index outside adding the correct
intents-to-add, and that applying a patch with both modifications
and new file creations with --intent-to-add correctly only adds
intents-to-add to the index.

Signed-off-by: Raymond E. Pasco <ray@ameretat.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoapply: only write intents to add for new files
Raymond E. Pasco [Mon, 7 Jul 2025 12:12:31 +0000 (08:12 -0400)] 
apply: only write intents to add for new files

In the "apply only to files" mode (i.e., neither --index nor --cached
mode), the index should not be touched except to record intents to
add when --intent-to-add is on. Because having --intent-to-add on sets
update_index, to indicate that we may touch the index, we can't rely
only on that flag in create_file() (which is called to write both new
files and updated files) to decide whether to write an index entry;
if we did, we would write an index entry for every file being patched
(which would moreover be an intent-to-add entry despite not being a
new file, because we are going to turn on the CE_INTENT_TO_ADD flag
in add_index_entry() if we enter it here and ita_only is true).

To decide whether to touch the index, we need to check the
specific reason the index would be updated, rather than merely
their aggregate in the update_index flag. Because we have already
entered write_out_results() and are performing writes, we know that
state->apply is true. If state->check_index is additionally true, we
are in --index or --cached mode, which updates the index and should
always write, whereas if we are merely in ita_only mode we must only
write if the patch is a new file creation patch.

Signed-off-by: Raymond E. Pasco <ray@ameretat.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoapply: read in the index in --intent-to-add mode
Raymond E. Pasco [Mon, 7 Jul 2025 12:12:30 +0000 (08:12 -0400)] 
apply: read in the index in --intent-to-add mode

There are three main modes of operation for apply: applying only to the
worktree, applying to the worktree and index (--index), and applying
only to the index (--cached).

The --intent-to-add flag modifies the first of these modes, applying
only to the worktree, in a way which touches the index, because intents
to add are special index entries. However, since its introduction
in cff5dc09ed (apply: add --intent-to-add, 2018-05-26), it has not
worked correctly in any but the most trivial (empty repository)
cases, because the index is never read in (in apply, this is done in
read_apply_cache()) before writing to it.

This causes the operation to clobber the old, correct index with a
new empty-tree index before writing intent-to-add entries to this
empty index; the final result is that the index now records every
existing file in the repository as deleted, which is incorrect.

This error can be corrected by first reading the index. The
update_index flag is correctly set if ita_only is true, because this
flag causes the index to be updated. However, if we merely gate the
call to read_apply_cache() behind update_index, then it will not be
read when state->apply is false, even if it must be checked due to
being in --index or --cached mode. Therefore, we instead read the
index if it will be either checked or updated, because reading the
index is a prerequisite to either.

Reported-by: Ryan Hodges <rhodges@cisco.com>
Original-patch-by: Johannes Altmanninger <aclopte@gmail.com>
Signed-off-by: Raymond E. Pasco <ray@ameretat.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agosetup_revisions(): turn on diffs for all-negative diff filter
Jeff King [Thu, 3 Jul 2025 22:44:28 +0000 (18:44 -0400)] 
setup_revisions(): turn on diffs for all-negative diff filter

When the user gives us a diff filter like --diff-filter=D, we need to do
a tree diff even if we're not planning to show the diff result itself,
in order to decide whether to show the commit at all. So there's an
explicit check of revs->diffopt.filter in setup_revisions(), and we set
revs->diff if any bits are set.

Originally that "filter" field covered both positive capital-letter
filters (like "D") and also negative lowercase filters (like "d"), so it
was sufficient for both cases. But later, 75408ca949 (diff-filter: be
more careful when looking for negative bits, 2022-01-28) split the
negative bits out into a "filter_not" field.

We eventually fold those into "filter", but not until diff_setup_done()
is called, which happens after our explicit check. As a result, a purely
negative filter like:

  git log --diff-filter=d

failed to turn on diffs at all. But rather than fail to filter by diff,
because the filter variable is eventually set, we mistakenly show no
commits at all, thinking that the empty diffs were cases where nothing
passed through the filter.

The smallest fix here is to just have our check look for any bits in
either "filter" or "filter_not". I suspect it would also be OK to
reorder the function a bit to call diff_setup_done() earlier, but that
risks violating some other subtle ordering dependency. So I went with
the simple and safe solution here.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agosetup: use "reftable" format when experimental features are enabled
Patrick Steinhardt [Fri, 4 Jul 2025 09:42:57 +0000 (11:42 +0200)] 
setup: use "reftable" format when experimental features are enabled

With the preceding commit we have announced the switch to the "reftable"
format in Git 3.0 for newly created repositories. The format is being
battle tested by GitLab and a couple of other developers, and except for
a small handful of issues exposed early after it has been merged it has
been rock solid. Regardless of that though the test user base is still
comparatively small, which increases the risk that we miss critical
bugs.

Address this by enabling the reftable format when experimental features
are enabled. This should increase the test user base by some margin and
thus give us more input before making the format the default.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 days agoBreakingChanges: announce switch to "reftable" format
Patrick Steinhardt [Fri, 4 Jul 2025 09:42:56 +0000 (11:42 +0200)] 
BreakingChanges: announce switch to "reftable" format

The "reftable" format has come a long way and has matured nicely since
it has been merged into git via 57db2a094d5 (refs: introduce reftable
backend, 2024-02-07). It fixes longstanding issues that cannot be fixed
with the "files" format in a backwards-compatible way and performs
significantly better in many use cases.

Announce that we will switch to the "reftable" format in Git 3.0 for
newly created repositories and wire up the change, hidden behind the
WITH_BREAKING_CHANGES preprocessor define.

This switch is dependent on support in the larger Git ecosystem. Most
importantly, libraries like JGit, libgit2 and Gitoxide should support
the reftable backend so that we don't break all applications and tools
built on top of those libraries.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoThe sixth batch
Junio C Hamano [Wed, 2 Jul 2025 19:07:52 +0000 (12:07 -0700)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoMerge branch 'jt/imap-send-message-fix'
Junio C Hamano [Wed, 2 Jul 2025 19:08:05 +0000 (12:08 -0700)] 
Merge branch 'jt/imap-send-message-fix'

Update some error messages from "git imap-send".

* jt/imap-send-message-fix:
  imap-send: improve error messages with configuration hints
  imap-send: fix confusing 'store' terminology in error message

2 weeks agoMerge branch 'ps/contrib-sweep'
Junio C Hamano [Wed, 2 Jul 2025 19:08:05 +0000 (12:08 -0700)] 
Merge branch 'ps/contrib-sweep'

Remove bunch of stuff from contrib/ hierarchy.

* ps/contrib-sweep:
  contrib: remove some scripts in "stats" directory
  contrib: remove "git-new-workdir"
  contrib: remove "emacs" directory
  contrib: remove "git-resurrect.sh"
  contrib: remove "persistent-https" remote helper
  contrib: remove "mw-to-git"
  contrib: remove "hooks" directory
  contrib: remove "thunderbird-patch-inline"
  contrib: remove remote-helper stubs
  contrib: remove "examples" directory
  contrib: remove "remotes2config.sh"

2 weeks agoMerge branch 'ag/imap-send-resurrection'
Junio C Hamano [Wed, 2 Jul 2025 19:08:04 +0000 (12:08 -0700)] 
Merge branch 'ag/imap-send-resurrection'

"git imap-send" has been broken for a long time, which has been
resurrected and then taught to talk OAuth2.0 etc.

* ag/imap-send-resurrection:
  imap-send: fix minor mistakes in the logs
  imap-send: display the destination mailbox when sending a message
  imap-send: display port alongwith host when git credential is invoked
  imap-send: add ability to list the available folders
  imap-send: enable specifying the folder using the command line
  imap-send: add PLAIN authentication method to OpenSSL
  imap-send: add support for OAuth2.0 authentication
  imap-send: gracefully fail if CRAM-MD5 authentication is requested without OpenSSL
  imap-send: fix memory leak in case auth_cram_md5 fails
  imap-send: fix bug causing cfg->folder being set to NULL

2 weeks agogitremote-helpers.adoc: fix formatting
Brett A C Sheffield [Wed, 2 Jul 2025 16:19:52 +0000 (18:19 +0200)] 
gitremote-helpers.adoc: fix formatting

Add missing colon to fix formatting.

Signed-off-by: Brett A C Sheffield <bacs@librecast.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agobuild: retire NO_UINTMAX_T
Carlo Marcelo Arenas Belón [Wed, 2 Jul 2025 09:37:36 +0000 (02:37 -0700)] 
build: retire NO_UINTMAX_T

A previous commit removed the last user of it, and it is no
longer useful with the codebase moving towards C99, which
specifies its definition.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoconfig.mak.uname: set NO_MEMMEM only for functional version
Carlo Marcelo Arenas Belón [Wed, 2 Jul 2025 09:37:35 +0000 (02:37 -0700)] 
config.mak.uname: set NO_MEMMEM only for functional version

FreeBSD 6 introduced memmem(), but the implementation diverged
from what was standard everywhere else (including our "compat"
fallback).

FreeBSD 10.4 (went EOL in 2018) corrected the functionality bugs
but kept a suboptimal implementation until FreeBSD 11.4 (the last
version of FreeBSD 11, that went EOL in September 2021).

Let's draw the line to require FreeBSD 12 or newer, which allows us
to drop the special casing of FreeBSD 4.x and rely on the platform
implementation of memmem() unconditionally for all versions that are
still being supported.

Suggested-by: Brad Smith <brad@comstyle.com>
Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agomeson: add rule to run 'git clang-format'
Karthik Nayak [Wed, 2 Jul 2025 09:23:20 +0000 (11:23 +0200)] 
meson: add rule to run 'git clang-format'

The Makefile has a 'style' rule to run 'git clang-format'. While Meson
intrinsically supports a 'clang-format' target, which can be run when
using the ninja backend by running 'ninja clang-format', this runs the
formatting on all existing files.

Our Meson build doesn't yet support a way to run 'git clang-format',
which runs the formatter between the working directory and commit
provided. Add a new 'style' target to Meson to mimic the target in the
Makefile.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoclang-format: add 'RemoveBracesLLVM' to the main config
Karthik Nayak [Wed, 2 Jul 2025 09:23:19 +0000 (11:23 +0200)] 
clang-format: add 'RemoveBracesLLVM' to the main config

In 1b8f306612 (ci/style-check: add `RemoveBracesLLVM` in CI job,
2024-07-23) we added 'RemoveBracesLLVM' to the CI job of running the
clang formatter.

This rule checks and warns against using braces on simple
single-statement bodies of statements. Since we haven't had any issues
regarding this rule, we can now move it into the main clang-format
config and remove it from being CI exclusive.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoclang-format: set 'ColumnLimit' to 0
Karthik Nayak [Wed, 2 Jul 2025 09:23:18 +0000 (11:23 +0200)] 
clang-format: set 'ColumnLimit' to 0

When clang-format was introduced to the Git project in
6134de6ac1 (clang-format: outline the git project's coding style,
2017-08-14), the 'ColumnLimit' was set to 80. This is inline with our
recommendation in 'Documentation/CodingGuidelines', which states:

  We try to keep to at most 80 characters per line.

However while this is recommended limit, this is not the enforced
limit. In some cases in we do overflow this limit to prioritize
readability. Setting the 'ColumnLimit' also means that shorter lines are
concatenated to simply as the result would still be below 80 characters,
which is undesirable.

In the past, we tried to adjust the penalties around line wrapping, once
in 42efde4c29 (clang-format: adjust line break penalties, 2017-09-29)
and another time in 5e9fa0f9fa (clang-format: re-adjust line break
penalties, 2024-10-18). While these settings help tweak the line break
penalties to be more in-line with the requirements of the Git project,
using 'clang-format' still produces a lot of false positives.

So to make 'clang-format' more usable, set the 'ColumnLimit' to 0. This
means that line-wrapping is no-longer a concern of the formatter and
something that the user needs to take care of. The previous commit also
added a more flexible guideline to the '.editorconfig' setting a
'max_line_length' of 120 characters. This should provide some guidance
to users.

In the future, it would be nice to re-instate this limit with adequate
penalties which would follow our guidelines, but currently, it makes
more sense to have a working formatter which we can rely on and which
doesn't create too many false positives.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoclean up interface for refs_warn_dangling_symrefs
Phil Hord [Wed, 2 Jul 2025 01:12:15 +0000 (18:12 -0700)] 
clean up interface for refs_warn_dangling_symrefs

The refs_warn_dangling_symrefs interface is a bit fragile as it passes
in printf-formatting strings with expectations about the number of
arguments. This patch series made it worse by adding a 2nd positional
argument. But there are only two call sites, and they both use almost
identical display options.

Make this safer by moving the format strings into the function that uses
them to make it easier to see when the arguments don't match. Pass a
prefix string and a dry_run flag so the decision logic can be handled
where needed.

Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agorefs: remove old refs_warn_dangling_symref
Phil Hord [Wed, 2 Jul 2025 01:12:14 +0000 (18:12 -0700)] 
refs: remove old refs_warn_dangling_symref

The dangling warning function that takes a single ref to search for
is no longer used.  Remove it.

Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agofetch-prune: optimize dangling-ref reporting
Phil Hord [Wed, 2 Jul 2025 01:12:13 +0000 (18:12 -0700)] 
fetch-prune: optimize dangling-ref reporting

When pruning during `git fetch` we check each pruned ref against the
ref_store one at a time to decide whether to report it as dangling.
This causes every local ref to be scanned for each ref being pruned.

If there are N refs in the repo and M refs being pruned, this code is
O(M*N). However, `git remote prune` uses a very similar function that
is only O(N*log(M)).

Remove the wasteful ref scanning for each pruned ref and use the faster
version already available in refs_warn_dangling_symrefs. Change the
message to include the original refname since the message is no longer
printed immediately after the line that did just print the refname.

In a repo with 126,000 refs, where I was pruning 28,000 refs, this
code made about 3.6 billion calls to strcmp and consumed 410 seconds
of CPU. (Invariably in that time, my remote would timeout and the
fetch would fail anyway.)

After this change, the same operation completes in under a second.

Signed-off-by: Phil Hord <phil.hord@gmail.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoodb: rename `read_object_with_reference()`
Patrick Steinhardt [Tue, 1 Jul 2025 12:22:29 +0000 (14:22 +0200)] 
odb: rename `read_object_with_reference()`

Rename `read_object_with_reference()` to `odb_read_object_peeled()` to
match other functions related to the object database and our modern
coding guidelines. Furthermore though, the old name didn't really
describe very well what this function actually does, which is to walk
down any commit and tag objects until an object of the required type has
been found. This is generally referred to as "peeling", so the new name
should be way more descriptive.

No compatibility wrapper is introduced as the function is not used a lot
throughout our codebase.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoodb: rename `pretend_object_file()`
Patrick Steinhardt [Tue, 1 Jul 2025 12:22:28 +0000 (14:22 +0200)] 
odb: rename `pretend_object_file()`

Rename `pretend_object_file()` to `odb_pretend_object()` to match other
functions related to the object database and our modern coding
guidelines.

No compatibility wrapper is introduced as the function is not used a lot
throughout our codebase.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 weeks agoodb: rename `has_object()`
Patrick Steinhardt [Tue, 1 Jul 2025 12:22:27 +0000 (14:22 +0200)] 
odb: rename `has_object()`

Rename `has_object()` to `odb_has_object()` to match other functions
related to the object database and our modern coding guidelines.

Introduce a compatibility wrapper so that any in-flight topics will
continue to compile.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>