]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 months agodoc: convert merge options to new synopsis format
Jean-Noël Avila [Sun, 25 May 2025 20:27:03 +0000 (20:27 +0000)] 
doc: convert merge options to new synopsis format

- Use _<placeholder>_ instead of <placeholder> in the description
- Use `backticks` for keywords and more complex option
descriptions. The new rendering engine will apply synopsis rules to
these spans.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: convert git-merge manpage to new style
Jean-Noël Avila [Sun, 25 May 2025 20:27:02 +0000 (20:27 +0000)] 
doc: convert git-merge manpage to new style

- Switch the synopsis to a synopsis block which will automatically
  format placeholders in italics and keywords in monospace
- Use _<placeholder>_ instead of <placeholder> in the description
- Use `backticks` for keywords and more complex option
descriptions. The new rendering engine will apply synopsis rules to
these spans.

In order to avoid breaking the format on '<<<<<<' and '>>>>>' lines
by applying the synopsis rules to these spans, they are formatted using '+'
signs instead of '`' signs.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agodoc: convert git-checkout manpage to new style
Jean-Noël Avila [Sun, 25 May 2025 20:27:01 +0000 (20:27 +0000)] 
doc: convert git-checkout manpage to new style

- Switch the synopsis to a synopsis block which will automatically
  format placeholders in italics and keywords in monospace
- Use _<placeholder>_ instead of <placeholder> in the description
- Use `backticks` for keywords and more complex option
descriptions. The new rendering engine will apply synopsis rules to
these spans.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoThe seventeenth batch
Junio C Hamano [Fri, 23 May 2025 22:33:39 +0000 (15:33 -0700)] 
The seventeenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'lo/json-writer-docs'
Junio C Hamano [Fri, 23 May 2025 22:34:09 +0000 (15:34 -0700)] 
Merge branch 'lo/json-writer-docs'

In-code docstring updates.

* lo/json-writer-docs:
  json-writer: describe the usage of jw_* functions
  json-writer: add docstrings to jw_* functions

2 months agoMerge branch 'en/replay-wo-the-repository'
Junio C Hamano [Fri, 23 May 2025 22:34:08 +0000 (15:34 -0700)] 
Merge branch 'en/replay-wo-the-repository'

The dependency on the_repository variable has been reduced from the
code paths in "git replay".

* en/replay-wo-the-repository:
  replay: replace the_repository with repo parameter passed to cmd_replay ()

2 months agoMerge branch 'ag/send-email-hostname-f'
Junio C Hamano [Fri, 23 May 2025 22:34:08 +0000 (15:34 -0700)] 
Merge branch 'ag/send-email-hostname-f'

Teach "git send-email" to also consult `hostname -f` for mail
domain to compute the identity given to SMTP servers.

* ag/send-email-hostname-f:
  send-email: try to get fqdn by running hostname -f on Linux and macOS

2 months agoMerge branch 'ps/ci-gitlab-enable-msvc-meson-job'
Junio C Hamano [Fri, 23 May 2025 22:34:07 +0000 (15:34 -0700)] 
Merge branch 'ps/ci-gitlab-enable-msvc-meson-job'

CI settings at GitLab has been updated to run MSVC based Meson job
automatically (as opposed to be done only upon manual request).

* ps/ci-gitlab-enable-msvc-meson-job:
  gitlab-ci: always run MSVC-based Meson job

2 months agoMerge branch 'ds/scalar-no-maintenance'
Junio C Hamano [Fri, 23 May 2025 22:34:07 +0000 (15:34 -0700)] 
Merge branch 'ds/scalar-no-maintenance'

Two "scalar" subcommands that adds a repository that hasn't been
under "scalar"'s control are taught an option not to enable the
scheduled maintenance on it.

* ds/scalar-no-maintenance:
  scalar reconfigure: improve --maintenance docs
  scalar reconfigure: add --maintenance=<mode> option
  scalar clone: add --no-maintenance option
  scalar register: add --no-maintenance option
  scalar: customize register_dir()'s behavior

2 months agoMerge branch 'ly/pack-bitmap-load-leakfix'
Junio C Hamano [Fri, 23 May 2025 22:34:07 +0000 (15:34 -0700)] 
Merge branch 'ly/pack-bitmap-load-leakfix'

Leakfix.

* ly/pack-bitmap-load-leakfix:
  pack-bitmap: fix memory leak if `load_bitmap_entries_v1` failed

2 months agoMerge branch 'js/ci-build-win-in-release-mode'
Junio C Hamano [Fri, 23 May 2025 22:34:06 +0000 (15:34 -0700)] 
Merge branch 'js/ci-build-win-in-release-mode'

win+Meson CI pipeline, unlike other pipelines for Windows,
used to build artifacts in develper mode, which has been changed to
build them in release mode for consistency.

* js/ci-build-win-in-release-mode:
  ci(win+Meson): build in Release mode

2 months agoThe sixteenth batch
Junio C Hamano [Mon, 19 May 2025 22:32:53 +0000 (15:32 -0700)] 
The sixteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'ps/reftable-read-block-perffix'
Junio C Hamano [Mon, 19 May 2025 23:02:48 +0000 (16:02 -0700)] 
Merge branch 'ps/reftable-read-block-perffix'

Performance regression in not-yet-released code has been corrected.

* ps/reftable-read-block-perffix:
  reftable: fix perf regression when reading blocks of unwanted type

2 months agoMerge branch 'ly/reftable-writer-leakfix'
Junio C Hamano [Mon, 19 May 2025 23:02:47 +0000 (16:02 -0700)] 
Merge branch 'ly/reftable-writer-leakfix'

Leakfix.

* ly/reftable-writer-leakfix:
  reftable/writer: fix memory leak when `writer_index_hash()` fails
  reftable/writer: fix memory leak when `padded_write()` fails

2 months agoMerge branch 'jk/oidmap-cleanup'
Junio C Hamano [Mon, 19 May 2025 23:02:47 +0000 (16:02 -0700)] 
Merge branch 'jk/oidmap-cleanup'

Code cleanup.

* jk/oidmap-cleanup:
  raw_object_store: drop extra pointer to replace_map
  oidmap: add size function
  oidmap: rename oidmap_free() to oidmap_clear()

2 months agoMerge branch 'rc/t1001-test-path-is-file'
Junio C Hamano [Mon, 19 May 2025 23:02:46 +0000 (16:02 -0700)] 
Merge branch 'rc/t1001-test-path-is-file'

Test update.

* rc/t1001-test-path-is-file:
  t1001: replace 'test -f' with 'test_path_is_file'

2 months agoMerge branch 'ly/am-split-stgit-leakfix'
Junio C Hamano [Mon, 19 May 2025 23:02:46 +0000 (16:02 -0700)] 
Merge branch 'ly/am-split-stgit-leakfix'

Leakfix.

* ly/am-split-stgit-leakfix:
  builtin/am: fix memory leak in `split_mail_stgit_series`

2 months agoMerge branch 'bc/make-avoid-unneeded-rebuild-with-compdb-dir'
Junio C Hamano [Mon, 19 May 2025 23:02:45 +0000 (16:02 -0700)] 
Merge branch 'bc/make-avoid-unneeded-rebuild-with-compdb-dir'

Build performance fix.

* bc/make-avoid-unneeded-rebuild-with-compdb-dir:
  Makefile: avoid constant rebuilds with compilation database

2 months agoMerge branch 'ag/doc-send-email'
Junio C Hamano [Mon, 19 May 2025 23:02:45 +0000 (16:02 -0700)] 
Merge branch 'ag/doc-send-email'

The `send-email` documentation has been updated with OAuth2.0
related examples.

* ag/doc-send-email:
  docs: add credential helper for outlook and gmail in OAuth list of helpers
  docs: improve send-email documentation
  send-mail: improve checks for valid_fqdn

2 months agoMerge branch 'sc/bundle-uri-use-all-refs-in-bundle'
Junio C Hamano [Mon, 19 May 2025 23:02:45 +0000 (16:02 -0700)] 
Merge branch 'sc/bundle-uri-use-all-refs-in-bundle'

Bundle-URI feature did not use refs recorded in the bundle other
than normal branches as anchoring points to optimize the follow-up
fetch during "git clone"; now it is told to utilize all.

* sc/bundle-uri-use-all-refs-in-bundle:
  bundle-uri: add test for bundle-uri clones with tags
  bundle-uri: copy all bundle references ino the refs/bundle space

2 months agoMerge branch 'pw/sequencer-reflog-use-after-free'
Junio C Hamano [Mon, 19 May 2025 23:02:44 +0000 (16:02 -0700)] 
Merge branch 'pw/sequencer-reflog-use-after-free'

Use-after-free fix in the sequencer.

* pw/sequencer-reflog-use-after-free:
  sequencer: rework reflog message handling
  sequencer: move reflog message functions

2 months agojson-writer: describe the usage of jw_* functions
Lucas Seiki Oshiro [Fri, 16 May 2025 01:01:59 +0000 (22:01 -0300)] 
json-writer: describe the usage of jw_* functions

Provide an overview of the set of functions used for manipulating
`json_writer`s, by describing what functions should be used for
each JSON-related task.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Acked-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agojson-writer: add docstrings to jw_* functions
Lucas Seiki Oshiro [Fri, 16 May 2025 01:01:58 +0000 (22:01 -0300)] 
json-writer: add docstrings to jw_* functions

Add a docstring for each function that manipulates json_writers.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Acked-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoThe fifteenth batch
Junio C Hamano [Fri, 16 May 2025 00:27:23 +0000 (17:27 -0700)] 
The fifteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'tb/macos-false-but-the-compiler-does-not-know-it-fix'
Junio C Hamano [Fri, 16 May 2025 00:24:57 +0000 (17:24 -0700)] 
Merge branch 'tb/macos-false-but-the-compiler-does-not-know-it-fix'

Workaround for older macOS ld.

* tb/macos-false-but-the-compiler-does-not-know-it-fix:
  intialize false_but_the_compiler_does_not_know_it_

2 months agoMerge branch 'jc/t6011-mv-ro-fix'
Junio C Hamano [Fri, 16 May 2025 00:24:56 +0000 (17:24 -0700)] 
Merge branch 'jc/t6011-mv-ro-fix'

Test fix.

* jc/t6011-mv-ro-fix:
  t6011: fix misconversion from perl to sed

2 months agoMerge branch 'dd/meson-perl-custom-path'
Junio C Hamano [Fri, 16 May 2025 00:24:56 +0000 (17:24 -0700)] 
Merge branch 'dd/meson-perl-custom-path'

Meson-based build framework update.

* dd/meson-perl-custom-path:
  meson: allow customize perl installation path

2 months agoMerge branch 'ps/maintenance-missing-tasks'
Junio C Hamano [Fri, 16 May 2025 00:24:55 +0000 (17:24 -0700)] 
Merge branch 'ps/maintenance-missing-tasks'

Make repository clean-up tasks "gc" can do available to "git
maintenance" front-end.

* ps/maintenance-missing-tasks:
  builtin/maintenance: introduce "rerere-gc" task
  builtin/gc: move rerere garbage collection into separate function
  builtin/maintenance: introduce "worktree-prune" task
  builtin/gc: move pruning of worktrees into a separate function
  builtin/gc: remove global variables where it is trivial to do
  builtin/gc: fix indentation of `cmd_gc()` parameters

2 months agoMerge branch 'cf/wrapper-bsd-eloop'
Junio C Hamano [Fri, 16 May 2025 00:24:55 +0000 (17:24 -0700)] 
Merge branch 'cf/wrapper-bsd-eloop'

The fallback implementation of open_nofollow() depended on
open("symlink", O_NOFOLLOW) to set errno to ELOOP, but a few BSD
derived systems use different errno, which has been worked around.

* cf/wrapper-bsd-eloop:
  wrapper: NetBSD gives EFTYPE and FreeBSD gives EMFILE where POSIX uses ELOOP

2 months agoreplay: replace the_repository with repo parameter passed to cmd_replay ()
Elijah Newren [Wed, 14 May 2025 20:33:25 +0000 (20:33 +0000)] 
replay: replace the_repository with repo parameter passed to cmd_replay ()

Replace the_repository everywhere with repo, feed repo from cmd_replay()
to all the other functions in the file that need it, and remove the
UNUSED annotation on repo.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoscalar reconfigure: improve --maintenance docs
Derrick Stolee [Wed, 14 May 2025 13:52:44 +0000 (09:52 -0400)] 
scalar reconfigure: improve --maintenance docs

The --maintenance option for 'scalar reconfigure' has three possible
values. Improve the documentation by specifying the option in the -h
help menu and usage information.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agosend-email: try to get fqdn by running hostname -f on Linux and macOS
Aditya Garg [Mon, 12 May 2025 08:11:19 +0000 (08:11 +0000)] 
send-email: try to get fqdn by running hostname -f on Linux and macOS

`hostname` is a popular command available on both Linux and macOS. As
per the man-page[1], `hostname -f` command returns the fully qualified
domain name (FQDN) of the system. The current Net::Domain perl module
being used in the script for the same has been quite unrealiable in many
cases. Thankfully, we now have a better check for valid_fqdn, which does
reject the invalid FQDNs given by this module properly, but at the same
time, it will result in a fallback to 'localhost.localdomain' being
used. `hostname -f` has been quite reliable (probably even more reliable
than the Net::Domain module) and before falling back to
'localhost.localdomain', we should try to use it. Interestingly, the
`hostname` command is actually used by perl modules like Net::Domain[2]
and Sys::Hostname[3] to get the hostname. So, lets give `hostname -f` a
chance as well!

[1]: https://man7.org/linux/man-pages/man1/hostname.1.html
[2]: https://github.com/Perl/perl5/blob/blead/cpan/libnet/lib/Net/Domain.pm#L88
[3]: https://github.com/Perl/perl5/blob/blead/ext/Sys-Hostname/Hostname.pm#L93

Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoThe fourteenth batch
Junio C Hamano [Tue, 13 May 2025 21:05:18 +0000 (14:05 -0700)] 
The fourteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoMerge branch 'kj/glob-path-with-special-char'
Junio C Hamano [Tue, 13 May 2025 21:05:07 +0000 (14:05 -0700)] 
Merge branch 'kj/glob-path-with-special-char'

"git add 'f?o'" did not add 'foo' if 'f?o', an unusual pathname,
also existed on the working tree, which has been corrected.

* kj/glob-path-with-special-char:
  dir.c: literal match with wildcard in pathspec should still glob

2 months agoMerge branch 'kh/docfixes'
Junio C Hamano [Tue, 13 May 2025 21:05:07 +0000 (14:05 -0700)] 
Merge branch 'kh/docfixes'

Docfixes.

* kh/docfixes:
  doc: branch: fix inline-verbatim
  doc: reflog: fix `drop` subheading

2 months agoMerge branch 'js/ci-buildsystems-cleanup'
Junio C Hamano [Tue, 13 May 2025 21:05:06 +0000 (14:05 -0700)] 
Merge branch 'js/ci-buildsystems-cleanup'

Code clean-up around stale CI elements and building with Visual Studio.

* js/ci-buildsystems-cleanup:
  config.mak.uname: drop the `vcxproj` target
  contrib/buildsystems: drop support for building . vcproj/.vcxproj files
  ci: stop linking the `prove` cache

2 months agoMerge branch 'ps/ci-test-aggreg-fix-for-meson'
Junio C Hamano [Tue, 13 May 2025 21:05:06 +0000 (14:05 -0700)] 
Merge branch 'ps/ci-test-aggreg-fix-for-meson'

Test result aggregation did not work in Meson based CI jobs.

* ps/ci-test-aggreg-fix-for-meson:
  ci: fix aggregation of test results with Meson

2 months agoMerge branch 'en/get-tree-entry-doc'
Junio C Hamano [Tue, 13 May 2025 21:05:05 +0000 (14:05 -0700)] 
Merge branch 'en/get-tree-entry-doc'

Doc update.

* en/get-tree-entry-doc:
  tree-walk.h: fix incorrect API comment

2 months agogitlab-ci: always run MSVC-based Meson job
Patrick Steinhardt [Mon, 28 Apr 2025 09:32:12 +0000 (11:32 +0200)] 
gitlab-ci: always run MSVC-based Meson job

With 7304bd2bc39 (ci: wire up Visual Studio build with Meson,
2025-01-22) we have introduced a CI job that builds and tests Git with
Microsoft Visual Studio via Meson. This job is only being executed by
default on GitHub Workflows though -- on GitLab CI it is marked as a
"manual" job, so the developer has to actively trigger these jobs.

The consequence of this split is that any breakage specific to this job
is only noticed by developers who mainly work with GitHub. Let's improve
this situation by also running the job by default on GitLab CI.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe thirteenth batch
Junio C Hamano [Mon, 12 May 2025 21:22:59 +0000 (14:22 -0700)] 
The thirteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'ps/meson-bin-sh'
Junio C Hamano [Mon, 12 May 2025 21:22:50 +0000 (14:22 -0700)] 
Merge branch 'ps/meson-bin-sh'

Meson-based build framework update.

* ps/meson-bin-sh:
  meson: prefer shell at "/bin/sh"
  meson: report detected runtime executable paths

3 months agoMerge branch 'ng/xdiff-truly-minimal'
Junio C Hamano [Mon, 12 May 2025 21:22:50 +0000 (14:22 -0700)] 
Merge branch 'ng/xdiff-truly-minimal'

"git diff --minimal" used to give non-minimal output when its
optimization kicked in, which has been disabled.

* ng/xdiff-truly-minimal:
  xdiff: disable cleanup_records heuristic with --minimal

3 months agoMerge branch 'ds/fix-thin-fix'
Junio C Hamano [Mon, 12 May 2025 21:22:49 +0000 (14:22 -0700)] 
Merge branch 'ds/fix-thin-fix'

"git index-pack --fix-thin" used to abort to prevent a cycle in
delta chains from forming in a corner case even when there is no
such cycle.

* ds/fix-thin-fix:
  index-pack: allow revisiting REF_DELTA chains
  t5309: create failing test for 'git index-pack'
  test-tool: add pack-deltas helper

3 months agoMerge branch 'jc/ci-skip-unavailable-external-software'
Junio C Hamano [Mon, 12 May 2025 21:22:49 +0000 (14:22 -0700)] 
Merge branch 'jc/ci-skip-unavailable-external-software'

Further refinement on CI messages when an optional external
software is unavailable (e.g. due to third-party service outage).

* jc/ci-skip-unavailable-external-software:
  ci: download JGit from maven, not eclipse.org
  ci: update the message for unavailble third-party software

3 months agoMerge branch 'ps/object-store-cleanup'
Junio C Hamano [Mon, 12 May 2025 21:22:48 +0000 (14:22 -0700)] 
Merge branch 'ps/object-store-cleanup'

Further code clean-up in the object-store layer.

* ps/object-store-cleanup:
  object-store: drop `repo_has_object_file()`
  treewide: convert users of `repo_has_object_file()` to `has_object()`
  object-store: allow fetching objects via `has_object()`
  object-store: move function declarations to their respective subsystems
  object-store: move and rename `odb_pack_keep()`
  object-store: drop `loose_object_path()`
  object-store: move `struct packed_git` into "packfile.h"

3 months agoMerge branch 'ag/send-email-outlook'
Junio C Hamano [Mon, 12 May 2025 21:22:47 +0000 (14:22 -0700)] 
Merge branch 'ag/send-email-outlook'

Update send-email to work better with Outlook's smtp server.

* ag/send-email-outlook:
  send-email: add --[no-]outlook-id-fix option
  send-email: retrieve Message-ID from outlook SMTP server

3 months agoraw_object_store: drop extra pointer to replace_map
Jeff King [Mon, 12 May 2025 18:52:33 +0000 (14:52 -0400)] 
raw_object_store: drop extra pointer to replace_map

We store the replacement data in an oidmap, which is itself a pointer in
the raw_object_store struct. But there's no need for an extra pointer
indirection here. It is always allocated and initialized along with the
containing struct, and we never check it for NULL-ness.

Let's embed the map directly in the struct, which is simpler and avoids
extra pointer chasing.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agooidmap: add size function
Jeff King [Mon, 12 May 2025 18:51:30 +0000 (14:51 -0400)] 
oidmap: add size function

Callers which want to know how many items are in an oidmap have to look
at the underlying hashmap struct, leaking an implementation detail.
Let's provide a type-appropriate wrapper and use it.

Note in the call from lookup_replace_object(), the caller was actually
looking at the hashmap's tablesize parameter (the allocated size of the
table) rather than hashmap_get_size(), the number of items in the table.
This probably should have been checking the number of items all along,
but the two are functionally equivalent here since we only add to the
map and never remove anything. Thus if there was any allocation, it was
because there is at least one item.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agooidmap: rename oidmap_free() to oidmap_clear()
Jeff King [Mon, 12 May 2025 18:50:28 +0000 (14:50 -0400)] 
oidmap: rename oidmap_free() to oidmap_clear()

This function does not free the oidmap struct itself; it just drops all
items from the map (using hashmap_clear_() internally). It should be
called oidmap_clear(), per CodingGuidelines.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agopack-bitmap: fix memory leak if `load_bitmap_entries_v1` failed
Lidong Yan [Mon, 12 May 2025 12:22:10 +0000 (12:22 +0000)] 
pack-bitmap: fix memory leak if `load_bitmap_entries_v1` failed

In pack-bitmap.c:load_bitmap_entries_v1, the function `read_bitmap_1`
allocates a bitmap and reads index data into it. However, if any of
the validation checks following the allocation fail, the allocated bitmap
is not freed, resulting in a memory leak. To avoid this, the validation
checks should be performed before the bitmap is allocated.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoreftable: fix perf regression when reading blocks of unwanted type
Patrick Steinhardt [Mon, 12 May 2025 15:15:56 +0000 (17:15 +0200)] 
reftable: fix perf regression when reading blocks of unwanted type

In fd888311fbc (reftable/table: move reading block into block reader,
2025-04-07), we have refactored how reftable blocks are read so that
most of the logic is contained in the "block.c" subsystem itself. Most
importantly, the whole logic to read the data itself is now contained in
that subsystem.

This change caused a significant performance regression though when
reading blocks that aren't of the specific type one is searching for:

    Benchmark 1: update-ref: create 100k refs (revision = fd888311fbc~)
      Time (mean ± σ):      2.171 s ±  0.028 s    [User: 1.189 s, System: 0.977 s]
      Range (min … max):    2.117 s …  2.206 s    10 runs

    Benchmark 2: update-ref: create 100k refs (revision = fd888311fbc)
      Time (mean ± σ):      3.418 s ±  0.030 s    [User: 2.371 s, System: 1.037 s]
      Range (min … max):    3.377 s …  3.473 s    10 runs

    Summary
      update-ref: create 100k refs (revision = fd888311fbc~) ran
        1.57 ± 0.02 times faster than update-ref: create 100k refs (revision = fd888311fbc)

The root caute of the performance regression is that we changed when
exactly blocks of an uninteresting type are being discarded. Previous to
the refactoring in the mentioned commit we'd load the block data, read
its type, notice that it's not the wanted type and discard the block.
After the commit though we don't discard the block immediately, but we
fully decode it only to realize that it's not the desired type. We then
discard the block again, but have already performed a bunch of pointless
work.

Fix the regression by making `reftable_block_init()` return early in
case the block is not of the desired type. This fixes the performance
hit:

    Benchmark 1: update-ref: create 100k refs (revision = HEAD~)
      Time (mean ± σ):      2.712 s ±  0.018 s    [User: 1.990 s, System: 0.716 s]
      Range (min … max):    2.682 s …  2.741 s    10 runs

    Benchmark 2: update-ref: create 100k refs (revision = HEAD)
      Time (mean ± σ):      1.670 s ±  0.012 s    [User: 0.991 s, System: 0.676 s]
      Range (min … max):    1.652 s …  1.693 s    10 runs

    Summary
      update-ref: create 100k refs (revision = HEAD) ran
        1.62 ± 0.02 times faster than update-ref: create 100k refs (revision = HEAD~)

Note that the baseline performance is lower than in the original due to
a couple of unrelated performance improvements that have landed since
the original commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/am: fix memory leak in `split_mail_stgit_series`
Lidong Yan [Mon, 12 May 2025 02:07:27 +0000 (02:07 +0000)] 
builtin/am: fix memory leak in `split_mail_stgit_series`

In builtin/am.c:split_mail_stgit_series, if `fopen` failed,
`series_dir_buf` allocated by `xstrdup` will leak. Add `free` in
`!fp` if branch will prevent the leak.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot1001: replace 'test -f' with 'test_path_is_file'
Rodrigo Carvalho [Sat, 10 May 2025 23:09:09 +0000 (20:09 -0300)] 
t1001: replace 'test -f' with 'test_path_is_file'

'test_path_is_file' is a modern path checking method in Git's development.
 Replace the basic shell command 'test -f' with this approach.

Signed-off-by: Rodrigo Carvalho <rodrigorsdc@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoreftable/writer: fix memory leak when `writer_index_hash()` fails
Lidong Yan [Mon, 12 May 2025 12:49:04 +0000 (12:49 +0000)] 
reftable/writer: fix memory leak when `writer_index_hash()` fails

In reftable/writer.c:writer_index_hash(), if `reftable_buf_add` failed,
key allocated by `reftable_malloc` will not be insert into `obj_index_tree`
thus leaks. Simple add reftable_free(key) will solve this problem.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoreftable/writer: fix memory leak when `padded_write()` fails
Lidong Yan [Mon, 12 May 2025 12:49:03 +0000 (12:49 +0000)] 
reftable/writer: fix memory leak when `padded_write()` fails

In reftable/writer.c:padded_write(), if w->writer failed, zeroed
allocated in `reftable_calloc` will leak. w->writer could be
`reftable_write_data` in reftable/stack.c, and could fail due to
some write error. Simply add reftable_free(zeroed) will solve this
problem.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMakefile: avoid constant rebuilds with compilation database
brian m. carlson [Fri, 9 May 2025 21:12:02 +0000 (21:12 +0000)] 
Makefile: avoid constant rebuilds with compilation database

Many contributors to software use a Language Server Protocol
implementation to allow their editor to learn structural information
about the code they write and provide additional features, such as
jumping to the declaration or definition of a function or type.  In C,
the usual implementation is clangd, which requires compiling with clang.

Because C and C++ projects lack a standard file system layout and build
system, unlike languages such as Rust and Go, clangd requires a
compilation database to be generated by the clang compiler in order to
pass the proper compilation flags and discover all of the files
necessary to make the LSP work.  This is done by setting
GENERATE_COMPILATION_DATABASE to "yes".

However, when that's enabled and the user runs "make" a second time,
all of the files are re-compiled, which is inconvenient for contributors
to Git, since it makes small changes or rebases recompile the entirety
of the codebase.  This happens because the directory holding the
compilation database is updated anytime an object is built, so its
modification date will always be newer than the first object built.

To solve this, use the same trick we do just above for the .depend
directory and filter the compilation database directory out if it
already exists, which avoids making it a target to be built.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Helped-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agosequencer: rework reflog message handling
Phillip Wood [Fri, 9 May 2025 16:22:27 +0000 (16:22 +0000)] 
sequencer: rework reflog message handling

It has been reported that "git rebase --rebase-merges" can create
corrupted reflog entries like

    e9c962f2ea0 HEAD@{8}: <binary>�: Merged in <branch> (pull request #4441)

This is due to a use-after-free bug that happens because
reflog_message() uses a static `struct strbuf` and is not called to
update the current reflog message stored in `ctx->reflog_message` when
creating the merge. This means `ctx->reflog_message` points to a stale
reflog message that has been freed by subsequent call to
reflog_message() by a command such as `reset` that used the return value
directly rather than storing the result in `ctx->reflog_message`.

Fix this by creating the reflog message nearer to where the commit is
created and storing it in a local variable which is passed as an
additional parameter to run_git_commit() rather than storing the message
in `struct replay_ctx`. This makes it harder to forget to call
`reflog_message()` before creating a commit and using a variable with a
narrower scope means that a stale value cannot carried across a from one
iteration of the loop to the next which should prevent any similar
use-after-free bugs in the future.

A existing test is modified to demonstrate that merges are now created
with the correct reflog message.

Reported-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agosequencer: move reflog message functions
Phillip Wood [Fri, 9 May 2025 16:22:26 +0000 (16:22 +0000)] 
sequencer: move reflog message functions

In the next commit these functions will be called from pick_one_commit()
so move them above that function to avoid a forward declaration.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'master' of https://github.com/j6t/gitk
Junio C Hamano [Fri, 9 May 2025 20:16:51 +0000 (13:16 -0700)] 
Merge branch 'master' of https://github.com/j6t/gitk

* 'master' of https://github.com/j6t/gitk:
  gitk: add Tamil translation
  gitk: limit PATH search to bare executable names
  gitk: _search_exe is no longer needed
  gitk: override $PATH search only on Windows
  gitk: adjust indentation to match the style used in this script

3 months agoMerge branch 'master' of https://github.com/j6t/git-gui
Junio C Hamano [Fri, 9 May 2025 20:14:36 +0000 (13:14 -0700)] 
Merge branch 'master' of https://github.com/j6t/git-gui

* 'master' of https://github.com/j6t/git-gui:
  git-gui: treat the message template file as a built file
  git-gui: heed core.commentChar/commentString
  git-gui: po/README: update repository location and maintainer

3 months agoMerge branch 'js/po-update-workflow'
Johannes Sixt [Fri, 9 May 2025 17:16:41 +0000 (19:16 +0200)] 
Merge branch 'js/po-update-workflow'

* js/po-update-workflow:
  git-gui: treat the message template file as a built file
  git-gui: po/README: update repository location and maintainer

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
3 months agoMerge branch 'at/translation-tamil'
Johannes Sixt [Fri, 9 May 2025 16:01:02 +0000 (18:01 +0200)] 
Merge branch 'at/translation-tamil'

* at/translation-tamil:
  gitk: add Tamil translation

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
3 months agoThe twelfth batch
Junio C Hamano [Thu, 8 May 2025 18:12:02 +0000 (11:12 -0700)] 
The twelfth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'js/diff-codeql-false-positive-workaround'
Junio C Hamano [Thu, 8 May 2025 19:36:32 +0000 (12:36 -0700)] 
Merge branch 'js/diff-codeql-false-positive-workaround'

Work around false positive given by CodeQL.

* js/diff-codeql-false-positive-workaround:
  diff: check range before dereferencing an array element

3 months agoMerge branch 'ps/mv-contradiction-fix'
Junio C Hamano [Thu, 8 May 2025 19:36:31 +0000 (12:36 -0700)] 
Merge branch 'ps/mv-contradiction-fix'

"git mv a a/b dst" would ask to move the directory 'a' itself, as
well as its contents, in a single destination directory, which is
a contradicting request that is impossible to satisfy. This case is
now detected and the command errors out.

* ps/mv-contradiction-fix:
  builtin/mv: convert assert(3p) into `BUG()`
  builtin/mv: bail out when trying to move child and its parent

3 months agoMerge branch 'en/hashmap-clear-fix'
Junio C Hamano [Thu, 8 May 2025 19:36:31 +0000 (12:36 -0700)] 
Merge branch 'en/hashmap-clear-fix'

hashmap API clean-up to ensure hashmap_clear() leaves a cleared map
in a reusable state.

* en/hashmap-clear-fix:
  hashmap: ensure hashmaps are reusable after hashmap_clear()

3 months agodocs: add credential helper for outlook and gmail in OAuth list of helpers
Aditya Garg [Thu, 8 May 2025 17:14:29 +0000 (17:14 +0000)] 
docs: add credential helper for outlook and gmail in OAuth list of helpers

This commit adds the `git-credential-outlook` and `git-credential-gmail`
helpers to the list of OAuth helpers.

Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodocs: improve send-email documentation
Aditya Garg [Thu, 8 May 2025 17:14:28 +0000 (17:14 +0000)] 
docs: improve send-email documentation

OAuth2.0 is a new authentication method that is being used by many email
providers, including Outlook and Gmail. Recently, the Authen::SASL perl
module has been updated to support OAuth2.0 authentication, thus making
the git-send-email script be able to use this authentication method as
well. So lets improve the documentation to reflect this change.

I also had a hard time finding a reliable OAuth2.0 access token
generator for Outlook and Gmail. So I added a link to the such
generators which I developed myself after seaching through lots of code
and API documentation to make things easier for others.

Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agosend-mail: improve checks for valid_fqdn
Aditya Garg [Thu, 8 May 2025 17:14:27 +0000 (17:14 +0000)] 
send-mail: improve checks for valid_fqdn

The current implementation of a valid Fully Qualified Domain Name
is not that strict. It just checks whether it has a dot (.) and
if using macOS, it should not end with .local. As per RFC1035[1],
from what I understood, the following checks need to be done:

- The domain must contain atleast one dot
- Each label (separated by dots) must be 1-63 characters long
- Labels must start and end with an alphanumeric character
- Labels can contain alphanumeric characters and hyphens

Here are some examples of valid and invalid labels:

'example.com',          # Valid
'sub.example.com',      # Valid
'my-domain.org',        # Valid
'localhost',            # Invalid (no dot)
'MacBook..',            # Invalid (double dots)
'-example.com',         # Invalid (starts with a hyphen)
'example-.com',         # Invalid (ends with a hyphen)
'example..com',         # Invalid (double dots)
'example',              # Invalid (no TLD)
'example.local',        # Invalid on macOS
'valid-domain.co.uk',   # Valid
'123.example.com',      # Valid
'example.com.',         # Invalid (trailing dot)
'toolonglabeltoolonglabeltoolonglabeltoolonglabeltoolonglabeltoolonglabel.com', # Invalid (label > 63 chars)

Due to current implementation, I was not able to send emails from
Ubuntu. Upon debugging, I found that the SMTP domain being passed
to Outlook's servers was not valid.

Net::SMTP=GLOB(0x5db4351225f8)>>> EHLO MacBook..
Net::SMTP=GLOB(0x5db4351225f8)<<< 501 5.5.4 Invalid domain name
Net::SMTP=GLOB(0x5db4351225f8)>>> HELO MacBook..

Notice that an invalid domain name "MacBook.." is sent by git-send-email.
We have a fallback code that checks output from Net::Domain::domainname()
or asking domain method of an Net::SMTP instance to detect a misconfigured
hostname and replace it with fallback "localhost.localdomain", but the
valid_fqdn apparently is failing to say "MacBook.." is not a valid fqdn.

With this patch, the rule used in valid_fqdn is tightened, the beginning
part of the SMTP exchange looked like this:

Net::SMTP=GLOB(0x58c8af71e930)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x58c8af71e930)<<< 250-PN4P287CA0064.outlook.office365.com Hello

[1]: https://datatracker.ietf.org/doc/html/rfc1035

Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: allow customize perl installation path
Đoàn Trần Công Danh [Thu, 8 May 2025 08:24:40 +0000 (15:24 +0700)] 
meson: allow customize perl installation path

Some distros, notably Fedora, want to install non-core Perl libraries
into specific directory, namely /usr/share/perl5/vendor_perl.

The Makefile build system allows this by overriding perllibdir variable,
let's make meson works on par with our Makefile.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoscalar reconfigure: add --maintenance=<mode> option
Derrick Stolee [Wed, 7 May 2025 01:50:37 +0000 (01:50 +0000)] 
scalar reconfigure: add --maintenance=<mode> option

When users want to enable the latest and greatest configuration options
recommended by Scalar after a Git upgrade, 'scalar reconfigure --all' is
a great option that iterates over all repos in the multi-valued
'scalar.repos' config key.

However, this feature previously forced users to enable background
maintenance. In some environments this is not preferred.

Add a new --maintenance=<mode> option to 'scalar reconfigure' that
provides options for enabling (default), disabling, or leaving
background maintenance config as-is.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoscalar clone: add --no-maintenance option
Derrick Stolee [Wed, 7 May 2025 01:50:36 +0000 (01:50 +0000)] 
scalar clone: add --no-maintenance option

When creating a new enlistment via 'scalar clone', the default is to set
up situations that work for most user scenarios. Background maintenance
is one of those highly-recommended options for most users.

However, when using 'scalar clone' to create an enlistment in a
different situation, such as prepping a VM image, it may be valuable to
disable background maintenance so the manual maintenance steps do not
get blocked by concurrent background maintenance activities.

Add a new --no-maintenance option to 'scalar clone'.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoscalar register: add --no-maintenance option
Derrick Stolee [Wed, 7 May 2025 01:50:35 +0000 (01:50 +0000)] 
scalar register: add --no-maintenance option

When registering a repository with Scalar to get the latest opinionated
configuration, the 'scalar register' command will also set up background
maintenance. This is a recommended feature for most user scenarios.

However, this is not always recommended in some scenarios where
background modifications may interfere with foreground activities.
Specifically, setting up a clone for use in automation may require doing
certain maintenance steps in the foreground that could become blocked by
concurrent background maintenance operations.

Allow the user to specify --no-maintenance to 'scalar register'. This
requires updating the method prototype for register_dir(), so use the
default of enabling this value when otherwise specified.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoscalar: customize register_dir()'s behavior
Derrick Stolee [Wed, 7 May 2025 01:50:34 +0000 (01:50 +0000)] 
scalar: customize register_dir()'s behavior

In advance of adding a --[no-]maintenance option to several 'scalar'
subcommands, extend the register_dir() method to include an option for
how it should handle background maintenance.

It's important that we understand the context of toggle_maintenance()
that will enable _or disable_ maintenance depending on its input value.
Add a doc comment with this information.

Similarly, update register_dir() to either enable maintenance or leave
it alone.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agogit-gui: treat the message template file as a built file
Johannes Sixt [Tue, 24 Dec 2024 13:47:08 +0000 (14:47 +0100)] 
git-gui: treat the message template file as a built file

Follow the lead of 5377abc0c9d5 ("po/git.pot: don't check in result
of "make pot"", 2022-05-26) in the Git repository and do not track
git-gui.pot anymore.

Instead, translators are expected to integrate an up-to-date version
from the master branch into their translation file using

   make ALL_POFILES=po/xx.po update-po

Update README to describe the new process. It is now understood that
different translations need not be based on the same message template
file, but rather individual translators should base their translation
on the most up-to-date code. Remove the section that addresses the
i18n coordinator as it does not apply when no common base is required
among translators.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
3 months agobuiltin/maintenance: introduce "rerere-gc" task
Patrick Steinhardt [Wed, 7 May 2025 07:21:42 +0000 (09:21 +0200)] 
builtin/maintenance: introduce "rerere-gc" task

While git-gc(1) knows to garbage collect the rerere cache,
git-maintenance(1) does not yet have a task for this cleanup. Introduce
a new "rerere-gc" task to plug this gap.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/gc: move rerere garbage collection into separate function
Patrick Steinhardt [Wed, 7 May 2025 07:21:41 +0000 (09:21 +0200)] 
builtin/gc: move rerere garbage collection into separate function

In a subsequent commit we are going to introduce a new "rerere-gc" task
for git-maintenance(1). To prepare for this, refactor the code that
spawns `git rerere gc` into a separate function.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/maintenance: introduce "worktree-prune" task
Patrick Steinhardt [Wed, 7 May 2025 07:21:40 +0000 (09:21 +0200)] 
builtin/maintenance: introduce "worktree-prune" task

While git-gc(1) knows to prune stale worktrees, git-maintenance(1) does
not yet have a task for this cleanup. Introduce a new "worktree-prune"
task to plug this gap.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/gc: move pruning of worktrees into a separate function
Patrick Steinhardt [Wed, 7 May 2025 07:21:39 +0000 (09:21 +0200)] 
builtin/gc: move pruning of worktrees into a separate function

In a subsequent commit we will introduce a new "worktree-prune" task for
git-maintenance(1). To prepare for this, refactor the code that spawns
`git worktree prune` into a separate function.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/gc: remove global variables where it is trivial to do
Patrick Steinhardt [Wed, 7 May 2025 07:21:38 +0000 (09:21 +0200)] 
builtin/gc: remove global variables where it is trivial to do

We use a couple of global variables to assemble command line arguments
for subprocesses we execute in git-gc(1). All of these variables except
the one for git-repack(1) are only used in a single place though, so
they don't really add anything but confusion.

Remove those variables.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/gc: fix indentation of `cmd_gc()` parameters
Patrick Steinhardt [Wed, 7 May 2025 07:21:37 +0000 (09:21 +0200)] 
builtin/gc: fix indentation of `cmd_gc()` parameters

The parameters of `cmd_gc()` aren't indented properly. Fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agointialize false_but_the_compiler_does_not_know_it_
Torsten Bögershausen [Tue, 6 May 2025 12:06:44 +0000 (14:06 +0200)] 
intialize false_but_the_compiler_does_not_know_it_

Compiling/linking 82e79c63642c on an older MacOs machine (like Xcode
14.3.1, the last version of 14.x series) leads to this:

    Undefined symbols for architecture x86_64:
      "_false_but_the_compiler_does_not_know_it_", referenced from:
  _start_command in libgit.a(run-command.o)

The linker fails to pick up compiler-tricks/not-constant.o that
defines the needed false_but_the_compiler_does_not_know_it_ symbol,
which is the only thing defined in that object file, from the
libgit.a archive.

Initializing the variable explicitly to 0 works around the linker
bug; the symbol type changes from 'C' to 'S' and is picked up by the
linker.

Xcode 15 introduces a new linker, which seems to fix the bug, making
the workaround here unnecessary, and Apple requires to build with
Xcode 16 or later in order to upload to their App Store Connect
since April 24, 2025, but not everybody is expected to upgrade their
toolchain immediately.

Helped-by: Koji Nakamaru <koji.nakamaru@gree.net>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agogitk: add Tamil translation
தமிழ் நேரம் [Wed, 7 May 2025 15:54:35 +0000 (21:24 +0530)] 
gitk: add Tamil translation

Signed-off-by: தமிழ் நேரம் <anishprabu.t@gmail.com>
3 months agot6011: fix misconversion from perl to sed
Junio C Hamano [Tue, 6 May 2025 22:48:55 +0000 (15:48 -0700)] 
t6011: fix misconversion from perl to sed

No, this is not about a quiz on regexp compatibility between Perl
and sed.

Back when cdbdc6bf (t: refactor tests depending on Perl substitution
operator, 2025-04-03) rewrote many uses of perl with sed, the general
pattern of the original scripts were

    chmod +w some_read_only_file &&
    perl -p -e "regexp to munge" some_read_only_file >some_tmp &&
    mv some_tmp some_read_only_file

persumably because the author knew that replacing some_read_only_file
with "mv" at the last step would not work without "mv -f" in some
environments (GNU seems to succeed without giving any prompt when
not running interactively, which is what happens when running t/
scripts).  Replacing perl with sed would be fine as long as sed with
updated regexp does the equivalent munging.

But one place used to use a different construct in the original:

    perl -i.bak -p -e "regexp to munge" some_read_only_file

With _no_ temporary file or "mv", "perl -i" allows you to replace a
read-only file in place.

When we replaced the use of "perl" with "sed" in the said commit,
however, because "sed -i" is not portable, we rewrote that in-place
replacement to

    sed "regexp to munge" some_read_only_file >some_tmp &&
    mv some_tmp some_read_only_file

Again, unfortunately that does not work in some environment, without
"mv -f".

We could run "mv -f" here, but we would then need to remove "chmod
+w" and have them use "mv -f" instead at all places that were
touched cdbdc6bf (t: refactor tests depending on Perl substitution
operator, 2025-04-03) to be consistent (and more concise).

For now, let's make it consistent in the other direction by mimick
the other places that made the target read-write before moving.

Speaking of portability, the outcome of using "sed" on non-text
files is unspecified, so the entire exercise of cdbdc6bf may have
needed to be reverted if people still used ancient version of
"standard compliant" sed that barfs on non-text files, but these
days we may be able to get away with "BSDs and GNU seem OK with it"
;-)  But one fix at a time.

Reported-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agowrapper: NetBSD gives EFTYPE and FreeBSD gives EMFILE where POSIX uses ELOOP
Collin Funk [Tue, 6 May 2025 01:08:59 +0000 (18:08 -0700)] 
wrapper: NetBSD gives EFTYPE and FreeBSD gives EMFILE where POSIX uses ELOOP

As documented on NetBSD's man page, open with the O_NOFOLLOW flag and a
symlink returns -1 and sets errno to EFTYPE which differs from POSIX.

This patch fixes the following test failure:

    $ sh t0602-reffiles-fsck.sh --verbose
    --- expect 2025-05-02 23:05:23.920890147 +0000
    +++ err 2025-05-02 23:05:23.916794959 +0000
    @@ -1 +1 @@
    -error: packed-refs: badRefFiletype: not a regular file but a symlink
    +error: unable to open '.git/packed-refs': Inappropriate file type or format
    not ok 12 - the filetype of packed-refs should be checked

FreeBSD has the same issue for EMLINK instead of EFTYPE.

This portability issue was introduced in cfea2f2da8 (packed-backend:
check whether the "packed-refs" is regular file, 2025-02-28)

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Acked-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe eleventh batch
Junio C Hamano [Mon, 5 May 2025 21:55:57 +0000 (14:55 -0700)] 
The eleventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'kn/meson-hdr-check'
Junio C Hamano [Mon, 5 May 2025 21:56:25 +0000 (14:56 -0700)] 
Merge branch 'kn/meson-hdr-check'

Add an equivalent to "make hdr-check" target to meson based builds.

* kn/meson-hdr-check:
  makefile/meson: add 'check-headers' as alias for 'hdr-check'
  meson: add support for 'hdr-check'
  meson: rename 'third_party_sources' to 'third_party_excludes'
  meson: move headers definition from 'contrib/coccinelle'
  coccinelle: meson: rename variables to be more specific
  ci/github: install git before checking out the repository

3 months agoMerge branch 'es/meson-cleanup'
Junio C Hamano [Mon, 5 May 2025 21:56:25 +0000 (14:56 -0700)] 
Merge branch 'es/meson-cleanup'

Code clean-up for meson-based build infrastructure.

* es/meson-cleanup:
  meson: only check for missing networking syms on non-Windows; add compat impls
  meson: fix typo in function check that prevented checking for hstrerror
  meson: add a couple missing networking dependencies
  meson: do a full usage-based compile check for sysinfo
  meson: check for getpagesize before using it
  meson: simplify and parameterize various standard function checks

3 months agoMerge branch 'ps/meson-build-perf-bench'
Junio C Hamano [Mon, 5 May 2025 21:56:24 +0000 (14:56 -0700)] 
Merge branch 'ps/meson-build-perf-bench'

The build procedure based on Meson learned to drive the
benchmarking tests.

* ps/meson-build-perf-bench:
  meson: wire up benchmarking options
  meson: wire up benchmarks
  t/perf: fix benchmarks with out-of-tree builds
  t/perf: use configured PERL_PATH
  t/perf: fix benchmarks with alternate repo formats

3 months agoMerge branch 'js/windows-arm64'
Junio C Hamano [Mon, 5 May 2025 21:56:24 +0000 (14:56 -0700)] 
Merge branch 'js/windows-arm64'

Update to arm64 Windows port.

* js/windows-arm64:
  max_tree_depth: lower it for clangarm64 on Windows
  mingw(arm64): do move the `/etc/git*` location
  msvc: do handle builds on Windows/ARM64
  mingw: do not use nedmalloc on Windows/ARM64
  config.mak.uname: add support for clangarm64
  bswap.h: add support for built-in bswap functions

3 months agoci: fix aggregation of test results with Meson
Patrick Steinhardt [Mon, 5 May 2025 10:55:45 +0000 (12:55 +0200)] 
ci: fix aggregation of test results with Meson

Our CI needs to be aware of the location of the test output directory so
that it knows where to find test results. Some of our CI jobs achieve
this by setting the `TEST_OUTPUT_DIRECTORY` environment variable, which
ensures that the output will be written to that directory. Other jobs,
especially on GitHub Workflows, don't set that environment variable and
instead expect test results to be located in the source directory in
"t/".

The latter logic does not work with Meson though, as the test results
are not written into the source directory by default, but instead into
the build directory. As such, any job that uses Meson without setting
the environment variable will be unable to locate and aggregate results.

Fix this by explicitly setting the test output directory when we set up
the Meson build directory. Like this, we can easily default to "t/" in
the source directory when the value hasn't been set explicitly.

Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoconfig.mak.uname: drop the `vcxproj` target
Johannes Schindelin [Mon, 5 May 2025 07:39:50 +0000 (07:39 +0000)] 
config.mak.uname: drop the `vcxproj` target

Now that we dropped `contrib/buildsystems/generate` to generate Visual
Studio Solution files, it is time to also drop the `vcxproj` Makefile
target that depended on that script.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agocontrib/buildsystems: drop support for building . vcproj/.vcxproj files
Johannes Schindelin [Mon, 5 May 2025 07:39:49 +0000 (07:39 +0000)] 
contrib/buildsystems: drop support for building . vcproj/.vcxproj files

Before we had CMake support, the only way to build Git in Visual Studio
was via this hacky `generate` script.

For a while I tried to fix whenever things got broken, in particular to
allow building confidence in embargoed releases by running the CI builds
in Azure Pipelines in a private Azure DevOps project. I even carried the
patches in Git for Windows with the intention of upstreaming them,
eventually.

However, it is a lot of work with too little benefit. CMake is much
better supported by Visual Studio. So let's drop this hacky script (plus
support code).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoci: stop linking the `prove` cache
Johannes Schindelin [Mon, 5 May 2025 07:39:48 +0000 (07:39 +0000)] 
ci: stop linking the `prove` cache

It is not useful because we do not have any persisted directory anymore,
not since dropping our Travis CI support.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: branch: fix inline-verbatim
Kristoffer Haugsbakk [Sat, 3 May 2025 19:13:09 +0000 (21:13 +0200)] 
doc: branch: fix inline-verbatim

7b399322a2e (doc: apply new format to git-branch man page, 2025-03-19)
updated the formatting for this doc to, among other things, use backtick
for some elements.  In the process `è` was used by accident instead
of backtick.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodoc: reflog: fix `drop` subheading
Kristoffer Haugsbakk [Sat, 3 May 2025 19:13:08 +0000 (21:13 +0200)] 
doc: reflog: fix `drop` subheading

The tilde (~) count doesn’t match the length of the heading.  In turn
you get a bunch of `<sub>~</sub>` instead of the intended `<h3>` in the
HTML output.

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoci(win+Meson): build in Release mode
Johannes Schindelin [Sat, 3 May 2025 14:25:46 +0000 (14:25 +0000)] 
ci(win+Meson): build in Release mode

When the `win+Meson` job was added to Git's CI, modeled after the
`win+vs` job, it overlooked that the latter built the Git artifacts in
release mode.

The reason for this is that there is code in `compat/mingw.c` that turns
on the modal assertion dialogs in debug mode, which are very useful when
debugging interactively (as they offer to attach Visual Studio's
debugger), but they are scarcely useful in CI builds (where that modal
dialog would sit around, waiting for a human being to see and deal with
it, which obviously won't ever happen).

This problem was not realized immediately because of a separate bug: the
`win+Meson` job erroneously built using the `gcc` that is in the `PATH`
by default on hosted GitHub Actions runners. Since that bug was fixed by
switching to `--vsenv`, though, the t7001-mv test consistently timed out
after six hours in the CI builds on GitHub, quite often, and wasting
build minutes without any benefit in return.

The reason for this timeout was a symptom of aforementioned debug mode
problem, where the test case 'nonsense mv triggers assertion failure and
partially updated index' in t7001-mv triggered an assertion.

I originally proposed this here patch to address the timeouts in CI
builds. The Git project decided to address this timeout differently,
though: by fixing the bug that the t7001-mv test case demonstrated. This
does not address the debug mode problem, though, as an `assert()` call
could be triggered in other ways in CI, and it should still not cause
the CI build to hang but should cause Git to error out instead. To avoid
having to accept this here patch, it was then proposed to replace all
`assert()` calls in Git's code base by `BUG()` calls. This might be
reasonable for independent reasons, but it obviously still does not
address the debug mode problem, as `assert()` calls could be easily
re-introduced by mistake, and besides, Git has a couple of dependencies
that all may have their own `assert()` calls (which are then safely
outside the control of the Git project to remove), therefore this here
patch is still needed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Patrick Steinhardt <ps@pks.im>
[jc: rebased on 'maint' to enable fast-tracking the change down]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodir.c: literal match with wildcard in pathspec should still glob
K Jayatheerth [Sat, 3 May 2025 06:07:36 +0000 (11:37 +0530)] 
dir.c: literal match with wildcard in pathspec should still glob

When a path with wildcard characters, e.g. 'f*o', exists in the
working tree, "git add -- 'f*o'" stops after happily finding
that there is 'f*o' and adding it to the index, without
realizing there may be other paths, e.g. 'foooo', that may match
the given pathspec.

This is because dir.c:do_match_pathspec() disables further
matches with pathspec when it finds an exact match.

Reported-by: piotrsiupa <piotrsiupa@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agotree-walk.h: fix incorrect API comment
Elijah Newren [Fri, 2 May 2025 19:19:11 +0000 (19:19 +0000)] 
tree-walk.h: fix incorrect API comment

When commit 50ddb089ff68 (tree-walk.c: remove the_repo from
get_tree_entry(), 2019-06-27) added an extra parameter to
get_tree_entry(), it did not fix the ordering comment about the meaning
of the parameters.  Rather than just changing "third"->"fourth" and
"fourth"->"fifth", give the paramemters meaningful names (or actually,
just take the existing names from the get_tree_entry() definition in the
tree-walk.c file) and while at it, tweak the rest of the description to
incorporate the other parameter names as well.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agobuiltin/mv: convert assert(3p) into `BUG()`
Patrick Steinhardt [Wed, 30 Apr 2025 12:44:58 +0000 (14:44 +0200)] 
builtin/mv: convert assert(3p) into `BUG()`

The use of asserts is discouraged in our codebase because they lead to
different behaviour depending on how Git is built. When being unsure
enough whether a condition always holds so that one adds the assert,
then the assert should probably trigger regardless of how Git is being
built.

Drop the call to assert(3p) in git-mv(1) and instead use `BUG()`.

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