]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
2 months agoobject-file: drop OBJECT_INFO_ALLOW_UNKNOWN_TYPE flag
Jeff King [Fri, 16 May 2025 04:49:45 +0000 (00:49 -0400)] 
object-file: drop OBJECT_INFO_ALLOW_UNKNOWN_TYPE flag

Since cat-file dropped its "--allow-unknown-type" option in the previous
commit, there are no more uses of the internal flag that implemented it.
Let's drop it.

That in turn lets us drop the strbuf parameter of unpack_loose_header(),
which now is always NULL. And without that, we can drop all of the
additional code to inflate larger headers into the strbuf.

Arguably we could drop ULHR_TOO_LONG, as no callers really care about
the distinction from ULHR_BAD. But it's easy enough to retain, and it
does let us produce a slightly more specific message in one instance.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agocat-file: make --allow-unknown-type a noop
Jeff King [Fri, 16 May 2025 04:49:35 +0000 (00:49 -0400)] 
cat-file: make --allow-unknown-type a noop

The cat-file command has some minor support for handling objects with
"unknown" types. I.e., strings that are not "blob", "commit", "tree", or
"tag".

In theory this could be used for debugging or experimenting with
extensions to Git. But in practice this support is not very useful:

  1. You can get the type and size of such objects, but nothing else.
     Not even the contents!

  2. Only loose objects are supported, since packfiles use numeric ids
     for the types, rather than strings.

  3. Likewise you cannot ever transfer objects between repositories,
     because they cannot be represented in the packfiles used for the
     on-the-wire protocol.

The support for these unknown types complicates the object-parsing code,
and has led to bugs such as b748ddb7a4 (unpack_loose_header(): fix
infinite loop on broken zlib input, 2025-02-25). So let's drop it.

The first step is to remove the user-facing parts, which are accessible
only via cat-file. This is technically backwards-incompatible, but given
the limitations listed above, these objects couldn't possibly be useful
in any workflow.

However, we can't just rip out the option entirely. That would hurt a
caller who ran:

  git cat-file -t --allow-unknown-object <oid>

and fed it normal, well-formed objects. There --allow-unknown-type was
doing nothing, but we wouldn't want to start bailing with an error. So
to protect any such callers, we'll retain --allow-unknown-type as a
noop.

The code change is fairly small (but we'll able to clean up more code in
follow-on patches). The test updates drop any use of the option. We
still retain tests that feed the broken objects to cat-file without
--allow-unknown-type, as we should continue to confirm that those
objects are rejected. Note that in one spot we can drop a layer of loop,
re-indenting the body; viewing the diff with "-w" helps there.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 months agoobject-file.h: fix typo in variable declaration
Jeff King [Fri, 16 May 2025 04:49:28 +0000 (00:49 -0400)] 
object-file.h: fix typo in variable declaration

This should be "compat", not "comapt".

Signed-off-by: Jeff King <peff@peff.net>
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 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 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>
2 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

2 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

2 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

2 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

2 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"

2 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 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 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 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 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>
3 months agobuiltin/mv: bail out when trying to move child and its parent
Patrick Steinhardt [Wed, 30 Apr 2025 12:44:57 +0000 (14:44 +0200)] 
builtin/mv: bail out when trying to move child and its parent

We have a known issue in git-mv(1) where moving both a child and any of
its parents causes an assert to trigger because the child cannot be
found anymore in the index. We have added a test for this in commit
0fcd473fdd3 (t7001: add failure test which triggers assertion,
2024-10-22) without addressing the issue, which is why the test itself
is marked as `test_expect_failure`.

The behaviour of that test relies on a call to assert(3p) though, which
may or may not be compiled into the resulting binary depending on
whether or not we pass `-DNDEBUG`. When these asserts are compiled into
Git this may cause our CI to hang on Windows though, because asserts may
cause a modal window to be shown.

While we could work around the issue by converting this into a call to
`BUG()`, let's rather address the root cause of the issue by bailing out
in case we see that both a child and any of its parents are being moved
in the same command.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe tenth batch
Junio C Hamano [Tue, 29 Apr 2025 21:07:22 +0000 (14:07 -0700)] 
The tenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'ps/ci-resurrect-p4-on-github'
Junio C Hamano [Tue, 29 Apr 2025 21:21:33 +0000 (14:21 -0700)] 
Merge branch 'ps/ci-resurrect-p4-on-github'

CI fix.

* ps/ci-resurrect-p4-on-github:
  ci: fix p4d executable not being found on GitHub Actions

3 months agoMerge branch 'ps/install-bash-completion'
Junio C Hamano [Tue, 29 Apr 2025 21:21:32 +0000 (14:21 -0700)] 
Merge branch 'ps/install-bash-completion'

Build update to install bash (but not zsh) completion script.

* ps/install-bash-completion:
  contrib/completion: install Bash completion

3 months agoMerge branch 'jk/p5332-testfix'
Junio C Hamano [Tue, 29 Apr 2025 21:21:32 +0000 (14:21 -0700)] 
Merge branch 'jk/p5332-testfix'

A test fix.

* jk/p5332-testfix:
  p5332: drop "+" from --stdin-packs input

3 months agoMerge branch 'lo/remove-log-reencode-from-rev-info'
Junio C Hamano [Tue, 29 Apr 2025 21:21:31 +0000 (14:21 -0700)] 
Merge branch 'lo/remove-log-reencode-from-rev-info'

Code clean-up.

* lo/remove-log-reencode-from-rev-info:
  revision: remove log_reencode field from rev_info

3 months agoMerge branch 'ps/fewer-perl'
Junio C Hamano [Tue, 29 Apr 2025 21:21:30 +0000 (14:21 -0700)] 
Merge branch 'ps/fewer-perl'

Reduce requirement for Perl in our documentation build and a few
scripts.

* ps/fewer-perl:
  Documentation: stop depending on Perl to generate command list
  Documentation: stop depending on Perl to massage user manual
  request-pull: stop depending on Perl
  filter-branch: stop depending on Perl

3 months agoMerge branch 'ps/reftable-api-revamp'
Junio C Hamano [Tue, 29 Apr 2025 21:21:29 +0000 (14:21 -0700)] 
Merge branch 'ps/reftable-api-revamp'

Overhaul of the reftable API.

* ps/reftable-api-revamp:
  reftable/table: move printing logic into test helper
  reftable/constants: make block types part of the public interface
  reftable/table: introduce iterator for table blocks
  reftable/table: add `reftable_table` to the public interface
  reftable/block: expose a generic iterator over reftable records
  reftable/block: make block iterators reseekable
  reftable/block: store block pointer in the block iterator
  reftable/block: create public interface for reading blocks
  git-zlib: use `struct z_stream_s` instead of typedef
  reftable/block: rename `block_reader` to `reftable_block`
  reftable/block: rename `block` to `block_data`
  reftable/table: move reading block into block reader
  reftable/block: simplify how we track restart points
  reftable/blocksource: consolidate code into a single file
  reftable/reader: rename data structure to "table"
  reftable: fix formatting of the license header

3 months agoMerge branch 'jh/gc-launchctl-schedule-fix'
Junio C Hamano [Tue, 29 Apr 2025 21:21:28 +0000 (14:21 -0700)] 
Merge branch 'jh/gc-launchctl-schedule-fix'

Fix for scheduled maintenance tasks on platforms using launchctl.

* jh/gc-launchctl-schedule-fix:
  maintenance: fix launchctl calendar intervals

3 months agoMerge branch 'az/tighten-string-array-constness'
Junio C Hamano [Tue, 29 Apr 2025 21:21:28 +0000 (14:21 -0700)] 
Merge branch 'az/tighten-string-array-constness'

Code clean-up.

* az/tighten-string-array-constness:
  global: mark usage strings and string tables const

3 months agoMerge branch 'as/typofix-in-env-h-header'
Junio C Hamano [Tue, 29 Apr 2025 21:21:27 +0000 (14:21 -0700)] 
Merge branch 'as/typofix-in-env-h-header'

Typofix.

* as/typofix-in-env-h-header:
  environment: fix typo: 'setup_git_directory_gently'

3 months agoMerge branch 'ua/call-repo-config-with-possibly-null-repository'
Junio C Hamano [Tue, 29 Apr 2025 21:21:27 +0000 (14:21 -0700)] 
Merge branch 'ua/call-repo-config-with-possibly-null-repository'

Since a call to repo_config() can be called with repo set to NULL
these days, a command that is marked as RUN_SETUP in the builtin
command table does not have to check repo with NULL before making
the call.

* ua/call-repo-config-with-possibly-null-repository:
  builtin/difftool: remove unnecessary if statement
  builtin/add: remove unnecessary if statement

3 months agoMerge branch 'js/git-perf-env-override'
Junio C Hamano [Tue, 29 Apr 2025 21:21:26 +0000 (14:21 -0700)] 
Merge branch 'js/git-perf-env-override'

Developer support fix..

* js/git-perf-env-override:
  perf: do allow `GIT_PERF_*` to be overridden again

3 months agoxdiff: disable cleanup_records heuristic with --minimal
Niels Glodny [Tue, 29 Apr 2025 14:09:49 +0000 (16:09 +0200)] 
xdiff: disable cleanup_records heuristic with --minimal

The cleanup_records function marks some lines as changed before running
the actual diff algorithm. For most lines, this is a good performance
optimization, but it also marks lines that are surrounded by many
changed lines as changed as well. This can cause redundant changes and
longer-than-necessary diffs.

Whether this results in better-looking diffs is subjective. However, the
--minimal flag explicitly requests the shortest possible diff.

The change results in shorter diffs in about 1.3% of all diffs in Git's
history. Performance wise, I have measured the impact on
"git log -p -3000 --minimal > /dev/null". With this change, I get
  Time (mean ± σ): 2.363 s ±  0.023 s (25 runs)
and without this patch I measured
  Time (mean ± σ): 2.362 s ±  0.035 s (25 runs).
As the difference is well within the margin of error, this does not seem
to have an impact on performance.

Signed-off-by: Niels Glodny <n.glodny@campus.lmu.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agodiff: check range before dereferencing an array element
Johannes Schindelin [Tue, 29 Apr 2025 11:37:58 +0000 (11:37 +0000)] 
diff: check range before dereferencing an array element

Before accessing an array element at a given index, it should be
verified that the index is within the desired bounds, not afterwards,
otherwise it may not make sense to even access the array element in the
first place. This is the point of CodeQL's
`cpp/offset-use-before-range-check` rule.

This CodeQL rule unfortunately is also triggered by the
`fill_es_indent_data()` code, even though the condition `off < len - 1`
does not even need to guarantee that the offset is in bounds (`s` points
to a NUL-terminated string, for which `s[off] == '\r'` would fail before
running out of bounds).

Let's work around this rare false positive to help us use an otherwise
mostly useful tool is a worthy thing to do.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoobject-store: drop `repo_has_object_file()`
Patrick Steinhardt [Tue, 29 Apr 2025 07:52:21 +0000 (09:52 +0200)] 
object-store: drop `repo_has_object_file()`

In the preceding commits we have converted all users of
`repo_has_object_file()` and its `_with_flags()` variant to instead use
`has_object()`. Drop these functions.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agotreewide: convert users of `repo_has_object_file()` to `has_object()`
Patrick Steinhardt [Tue, 29 Apr 2025 07:52:20 +0000 (09:52 +0200)] 
treewide: convert users of `repo_has_object_file()` to `has_object()`

As the comment of `repo_has_object_file()` and its `_with_flags()`
variant tells us, these functions are considered to be deprecated in
favor of `has_object()`. There are a couple of slight benefits in favor
of the replacement:

  - The new function has a short-and-sweet name.

  - More explicit defaults: `has_object()` doesn't fetch missing objects
    via promisor remotes, and neither does it reload packfiles if an
    object wasn't found by default. This ensures that it becomes
    immediately obvious when a simple object existence check may result
    in expensive actions.

Most importantly though, it is confusing that we have two sets of
functions that ultimately do the same thing, but with different
defaults.

Start sunsetting `repo_has_object_file()` and its `_with_flags()`
sibling by replacing all callsites with `has_object()`:

  - `repo_has_object_file(...)` is equivalent to
    `has_object(..., HAS_OBJECT_RECHECK_PACKED | HAS_OBJECT_FETCH_PROMISOR)`.

  - `repo_has_object_file_with_flags(..., OBJECT_INFO_QUICK | OBJECT_INFO_SKIP_FETCH_OBJECT)`
    is equivalent to `has_object(..., 0)`.

  - `repo_has_object_file_with_flags(..., OBJECT_INFO_SKIP_FETCH_OBJECT)`
    is equivalent to `has_object(..., HAS_OBJECT_RECHECK_PACKED)`.

  - `repo_has_object_file_with_flags(..., OBJECT_INFO_QUICK)`
    is equivalent to `has_object(..., HAS_OBJECT_FETCH_PROMISOR)`.

The replacements should be functionally equivalent.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoobject-store: allow fetching objects via `has_object()`
Patrick Steinhardt [Tue, 29 Apr 2025 07:52:19 +0000 (09:52 +0200)] 
object-store: allow fetching objects via `has_object()`

We're about to fully remove `repo_has_object_file()` in favor of
`has_object()`. The latter function does not yet have a way to fetch
missing objects via a promisor remote though, which means that it cannot
fully replace all usecases of `repo_has_object_file()`.

Introduce a new flag `HAS_OBJECT_FETCH_PROMISOR` that causes the
function to optionally fetch missing objects which are part of a
promisor pack. This flag will be used in the subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoobject-store: move function declarations to their respective subsystems
Patrick Steinhardt [Tue, 29 Apr 2025 07:52:18 +0000 (09:52 +0200)] 
object-store: move function declarations to their respective subsystems

We carry declarations for a couple of functions in "object-store.h" that
are not defined in "object-store.c", but in a different subsystem. Move
these declarations to the respective headers whose matching code files
carry the corresponding definition.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoobject-store: move and rename `odb_pack_keep()`
Patrick Steinhardt [Tue, 29 Apr 2025 07:52:17 +0000 (09:52 +0200)] 
object-store: move and rename `odb_pack_keep()`

The function `odb_pack_keep()` creates a file at the passed-in path. If
this fails, then the function re-tries by first creating any potentially
missing leading directories and then trying to create the file once
again. As such, this function doesn't host any kind of logic that is
specific to the object store, but is rather a generic helper function.

Rename the function to `safe_create_file_with_leading_directories()` and
move it into "path.c". While at it, refactor it so that it loses its
dependency on `the_repository`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoobject-store: drop `loose_object_path()`
Patrick Steinhardt [Tue, 29 Apr 2025 07:52:16 +0000 (09:52 +0200)] 
object-store: drop `loose_object_path()`

The function `loose_object_path()` is a trivial wrapper around
`odb_loose_path()`, with the only exception that it always uses the
primary object database of the given repository. This doesn't really add
a ton of value though, so let's drop the function and inline it at every
callsite.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoobject-store: move `struct packed_git` into "packfile.h"
Patrick Steinhardt [Tue, 29 Apr 2025 07:52:15 +0000 (09:52 +0200)] 
object-store: move `struct packed_git` into "packfile.h"

The "object-store.h" header contains the definition of `struct
packed_git`. As this structure hosts all kind of information about a
specific packfile it is arguably a bit out of place in a generic place
like "object-store.h".

Move the structure as well as `pack_map_entry_cmp()` into "packfile.h".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agosend-email: add --[no-]outlook-id-fix option
Aditya Garg [Tue, 29 Apr 2025 16:37:09 +0000 (16:37 +0000)] 
send-email: add --[no-]outlook-id-fix option

Add an option to allow users to specifically enable or disable
retrieving the Message-ID from the Outlook SMTP server. This can be used
for other hosts mimicking the behaviour of Outlook, or for users who set
a custom domain to be a CNAME for the Outlook SMTP server.

While at it, lets also add missing * in description of --no-smtp-auth.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agohashmap: ensure hashmaps are reusable after hashmap_clear()
Elijah Newren [Tue, 29 Apr 2025 15:47:43 +0000 (15:47 +0000)] 
hashmap: ensure hashmaps are reusable after hashmap_clear()

In the series merged at bf0a430f70b5 (Merge branch 'en/strmap',
2020-11-21), strmap was built on top of hashmap and hashmap was extended
in a few ways to support strmap and be more generally useful.  One of
the extensions was that hashmap_partial_clear() was introduced to allow
reuse of the hashmap without freeing the table.  Peff believed that it
also made sense to introduce a hashmap_clear() which freed everything
while allowing reuse.

I added hashmap_clear(), but in doing so, overlooked the fact that for
a hashmap to be reusable, it needs a defined cmpfn and data (the
HASHMAP_INIT macro requires these fields as parameters, for example).
So, if we want the hashmap to be reusable, we shouldn't zero out those
fields.  We probably also shouldn't zero out do_count_items.  (We could
zero out grow_at and shrink_at, but whether we zero those or not is
irrelevant as they'll be automatically updated whenever a new entry is
inserted.)

Since clearing is associated with freeing map->table, and the only thing
required for consistency after freeing map->table is zeroing tablesize
and private_size, let's only zero those fields out.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoindex-pack: allow revisiting REF_DELTA chains
Derrick Stolee [Mon, 28 Apr 2025 20:24:45 +0000 (20:24 +0000)] 
index-pack: allow revisiting REF_DELTA chains

As detailed in the previous changes to t5309-pack-delta-cycles.sh, the
logic within 'git index-pack' to analyze an incoming thin packfile with
REF_DELTAs is suspect. The algorithm is overly cautious around delta
cycles, and that leads in fact to failing even when there is no cycle.

This change adjusts the algorithm to no longer fail in these cases. In
fact, these cycle cases will no longer fail but more importantly the
valid cases will no longer fail, either. The resulting packfile from the
--fix-thin operation will not have cycles either since REF_DELTAs are
forbidden from the on-disk format and OFS_DELTAs are impossible to write
as a cycle.

The crux of the matter is how the algorithm works when the REF_DELTAs
point to base objects that exist in the local repository. When reading
the thin packfile, the object IDs for the delta objects are unknown so
we do not have the delta chain structure automatically. Instead, we need
to start somewhere by selecting a delta whose base is inside our current
object database.

Consider the case where the packfile has two REF_DELTA objects, A and B,
and the delta chain looks like "A depends on B" and "B depends on C" for
some third object C, where C is already in the current repository. The
algorithm _should_ start with all objects that depend on C, finding B,
and then moving on to all objects depending on B, finding A.

However, if the repository also already has object B, then the delta
chain can be analyzed in a different order. The deltas with base B can
be analyzed first, finding A, and then the deltas with base C are
analyzed, finding B. The algorithm currently continues to look for
objects that depend on B, finding A again. This fails due to A's
'real_type' member already being overwritten from OBJ_REF_DELTA to the
correct object type.

This scenario is possible in a typical 'git fetch' where the client does
not advertise B as a 'have' but requests A as a 'want' (and C is noticed
as a common object based on other 'have's). The reason this isn't
typically seen is that most Git servers use OFS_DELTAs to represent
deltas within a packfile. However, if a server uses only REF_DELTAs,
then this kind of issue can occur. There is nothing in the explicit
packfile format that states this use of inter-pack REF_DELTA is
incorrect, only that REF_DELTAs should not be used in the on-disk
representation to avoid cycles.

This die() was introduced in ab791dd138 (index-pack: fix race condition
with duplicate bases, 2014-08-29). Several refactors have adjusted the
error message and the surrounding logic, but this issue has existed for
a longer time as that was only a conversion from an assert().

The tests in t5309 originated in 3b910d0c5e (add tests for indexing
packs with delta cycles, 2013-08-23) and b2ef3d9ebb (test index-pack on
packs with recoverable delta cycles, 2013-08-23). These changes make
note that the current behavior of handling "resolvable" cycles is mostly
a documentation-only test, not that this behavior is the best way for
Git to handle the situation.

The fix here is somewhat complicated due to the amount of state being
adjusted by the loop within threaded_second_pass(). Instead of trying to
resume the start of the loop while adjusting the necessary context, I
chose to scan the REF_DELTAs depending on the current 'parent' and skip
any that have already been processed. This necessarily leaves us in a
state where 'child' and 'child_obj' could be left as NULL and that must
be handled later. There is also some careful handling around skipping
REF_DELTAs when there are also OFS_DELTAs depending on that parent.
There may be value in extending 'test-tool pack-deltas' to allow writing
OFS_DELTAs in order to exercise this logic across the delta types.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot5309: create failing test for 'git index-pack'
Derrick Stolee [Mon, 28 Apr 2025 20:24:44 +0000 (20:24 +0000)] 
t5309: create failing test for 'git index-pack'

This new test demonstrates some behavior where a valid packfile is being
rejected by the Git client due to the order in which it is resolving
REF_DELTAs.

The thin packfile has a REF_DELTA chain A->B->C where C is not included
in the packfile. However, the client repository contains both C and B
already. Thus, 'git index-pack' is able to resolve A before resolving B.

When resolving B, it then attempts to resolve any other REF_DELTAs that
are pointing to B as a base. This "revisits" A and complains as if there
is a cycle, but it did not actually detect a cycle.

A fix will arrive in the next change.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agotest-tool: add pack-deltas helper
Derrick Stolee [Mon, 28 Apr 2025 20:24:43 +0000 (20:24 +0000)] 
test-tool: add pack-deltas helper

When trying to demonstrate certain behavior in tests, it can be helpful
to create packfiles that have specific delta structures. 'git
pack-objects' uses various algorithms to select deltas based on their
compression rates, but that does not always demonstrate all possible
packfile shapes. This becomes especially important when wanting to test
'git index-pack' and its ability to parse certain pack shapes.

We have prior art in t/lib-pack.sh, where certain delta structures are
produced by manually writing certain opaque pack contents. However,
producing these script updates is cumbersome and difficult to do as a
contributor.

Instead, create a new test-tool, 'test-tool pack-deltas', that reads a
list of instructions for which objects to include in a packfile and how
those objects should be written in delta form.

At the moment, this only supports REF_DELTAs as those are the kinds of
deltas needed to exercise a bug in 'git index-pack'.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: wire up benchmarking options
Patrick Steinhardt [Mon, 28 Apr 2025 07:30:50 +0000 (09:30 +0200)] 
meson: wire up benchmarking options

Wire up a couple of benchmarking options that we end up writing into our
"GIT-BUILD-OPTIONS" file. These options allow users to control how
exactly benchmarks are executed.

Note that neither `GIT_PERF_MAKE_COMMAND` nor `GIT_PERF_MAKE_OPTS` are
exposed as a build option. Those options are used by "t/perf/run", which
is not used by Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: wire up benchmarks
Patrick Steinhardt [Mon, 28 Apr 2025 07:30:49 +0000 (09:30 +0200)] 
meson: wire up benchmarks

Wire up benchmarks in Meson. The setup is mostly the same as how we wire
up our tests. The only difference is that benchmarks get wired up via
the `benchmark()` option instead of via `test()`, which gives them a bit
of special treatment:

  - Benchmarks never run in parallel.

  - Benchmarks aren't run by default when tests are executed.

  - Meson does not inject the `MALLOC_PERTURB` environment variable.

Using benchmarks is quite simple:

    ```
    $ meson setup build
    # Run all benchmarks.
    $ meson test -C build --benchmark
    # Run a specific benchmark.
    $ meson test -C build --benchmark p0000-*
    ```

Other than that the usual command line arguments accepted when running
tests are also accepted when running benchmarks.

Note that the benchmarking target is somewhat limited because it will
only run benchmarks for the current build. Other use cases, like running
benchmarks against multiple different versions of Git, are not currently
supported. Users should continue to use "t/perf/run" for those use
cases. The script should get extended at one point in time to support
Meson, but this is outside of the scope of this series.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot/perf: fix benchmarks with out-of-tree builds
Patrick Steinhardt [Mon, 28 Apr 2025 07:30:48 +0000 (09:30 +0200)] 
t/perf: fix benchmarks with out-of-tree builds

The "perf-lib.sh" script is sourced by all of our benchmarking suites to
make available common infrastructure. The script assumes that build and
source directory are the same, which works for our Makefile. But the
assumption breaks with both CMake and Meson, where the build directory
can be located in an arbitrary place.

Adapt the script so that it works with out-of-tree builds. Most
importantly, this requires us to figure out the location of the build
directory:

  - When running benchmarks via our Makefile the build directory is the
    same as the source directory. We already know to derive the test
    directory ("t/") via `$(pwd)/..`, which works because we chdir into
    "t/perf" before executing benchmarks. We can thus derive the build
    directory by appending another "/.." to that path.

  - When running benchmarks via Meson the build directory is located at
    an arbitrary location. The build system thus has to make the path
    known by exporting the `GIT_BUILD_DIR` environment variable.

This change prepares us for wiring up benchmarks in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot/perf: use configured PERL_PATH
Patrick Steinhardt [Mon, 28 Apr 2025 07:30:47 +0000 (09:30 +0200)] 
t/perf: use configured PERL_PATH

Our benchmarks use a couple of Perl scripts to compute results. These
Perl scripts get executed directly, and as the shebang is hardcoded to
"/usr/bin/perl" this will fail on any system where the Perl interpreter
is located in a different path.

Our build infrastructure already lets users configure the location of
Perl, which ultimately gets written into the GIT-BUILD-OPTIONS file.
This file is being sourced by "test-lib.sh", and consequently we already
have the "PERL_PATH" variable available that contains its configured
location.

Use "PERL_PATH" to execute Perl scripts, which makes them work on more
esoteric systems like NixOS. Furthermore, adapt the shebang to use
env(1) to execute Perl so that users who have Perl in PATH, but in a
non-standard location can execute the script directly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agot/perf: fix benchmarks with alternate repo formats
Patrick Steinhardt [Mon, 28 Apr 2025 07:30:46 +0000 (09:30 +0200)] 
t/perf: fix benchmarks with alternate repo formats

Many of our benchmarks operate on a user-defined repository that we copy
over before running the benchmarked logic. To keep unintentional side
effects caused by on-disk state at bay we skip copying some files. This
includes for example hooks, but also the repo's configuration.

It is quite sensible to not copy over the configuration, as it is quite
easy to inadvertently carry over configuration that may significantly
impact the performance measurements. But we cannot fully ignore the
configuration either, as it may contain information about the repository
format. This will cause failures when for example using a repository
with SHA256 object format or the reftable ref format.

Fix the issue by parsing the reference and object formats from the
source repository and passing them to git-init(1).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agosend-email: retrieve Message-ID from outlook SMTP server
Aditya Garg [Fri, 25 Apr 2025 10:09:09 +0000 (10:09 +0000)] 
send-email: retrieve Message-ID from outlook SMTP server

The script generates a Message-ID alongwith the other headers when
gen_header is called, and is sent alongwith the email. For most email
providers, including gmail, the Message-ID goes unchanged to the
recipient.

But, this does not seem to be a case with Outlook. In Outlook, when we
send our own Message-ID as a part of the headers, it discards it. Then
it generates a new random Message-ID and that is what the recipient
gets.

This is a problem because the Message-ID is crucial when we are sending
multiple emails in a thread. The current implementation for threads in
the script replies to the Message-ID it generated, but due to Outlook's
behavior, it is not the same as the one that the recipient got, thus
breaking threads. So a need arises to retrieve the Message-ID from the
server response and set it in the In-Reply-To and References email
headers instead of using the self generated one for the purpose of
replies.

The $smtp->message variable in this script for outlook is something like
this:

2.0.0 OK <Message-ID> [Hostname=Some-hostname]

The Message-ID here is the one the recipient gets, rather than the one
the script generated.

This patch uses the fact above and retrieves the Message-ID from the
server response. It then changes the value of the $message_id variable
to the one received from the server. This value will be used when next
and subsequent messages are sent as replies to the message, thus
preserving the threading of the messages.

Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: prefer shell at "/bin/sh"
Patrick Steinhardt [Fri, 25 Apr 2025 14:11:29 +0000 (16:11 +0200)] 
meson: prefer shell at "/bin/sh"

Meson detects the path of the target shell via `find_program("sh")`,
which essentially does a lookup via `PATH`. This may easily lead to a
subtly-broken Git distribution when the build host has its shell in a
location that the target host doesn't know about.

Fix the issue by appending "/bin" to the custom program path, which
causes us to prefer "/bin/sh" over a `PATH`-based lookup. While
"/bin/sh" isn't standardized, this path tends to work alright on Linux
and BSD distributions. Furthermore, "/bin/sh" is also the path we pick
in our Makefile by default, which further demonstrates that this shell
fulfills our needs.

Note that we intentionally append, not prepend, to the custom program
path. This is because the program path can be configured by the user via
the `-Dsane_tool_path=` build option, which should take precedence over
any defaults we pick for the user.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: report detected runtime executable paths
Patrick Steinhardt [Fri, 25 Apr 2025 14:11:28 +0000 (16:11 +0200)] 
meson: report detected runtime executable paths

Git needs to know about a couple of executable paths to pick at runtime.
This includes the system shell, but may also optionally include the Perl
and Python interpreters. Meson detects the location of these paths
automatically via `find_program()`, which does a lookup via the `PATH`
environment variable. As such, it may not be immediately obvious to the
developer which paths have been autodetected.

Improve this by exposing runtime executable paths at setup time.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: only check for missing networking syms on non-Windows; add compat impls
Eli Schwartz [Fri, 25 Apr 2025 05:25:45 +0000 (01:25 -0400)] 
meson: only check for missing networking syms on non-Windows; add compat impls

These are added in the Makefile, but not in meson. They probably won't
work well on systems without them.

CMake adds them, but only on non-Windows. Actually, it only performs
compiler checks for hstrerror, but excludes that check on Windows with
the note that it is "incompatible with the Windows build". This seems to
be misleading -- it is not incompatible, it simply doesn't exist. Still,
the compat version should not be used.

I interpret this cmake logic to mean we shouldn't even be checking for
symbol availability on Windows. In addition to making it simple to add
compat definitions, this also probably shaves off a second or two of
configure time on Windows as no compiler check needs to be performed.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: fix typo in function check that prevented checking for hstrerror
Eli Schwartz [Fri, 25 Apr 2025 05:25:44 +0000 (01:25 -0400)] 
meson: fix typo in function check that prevented checking for hstrerror

Nowhere in the codebase do we otherwise check for strerror. Nowhere in
the codebase do we make use of -DNO_STRERROR. `strerror` is not a
networking function at all.

We do utilize `hstrerror` though, which is a networking function we
should have been checking here.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: add a couple missing networking dependencies
Eli Schwartz [Fri, 25 Apr 2025 05:25:43 +0000 (01:25 -0400)] 
meson: add a couple missing networking dependencies

As evidenced in config.mak.uname and configure.ac, there are various
possible scenarios where these libraries are default-enabled in the
build, which mainly boils down to: SunOS. -lresolv is simply not the
only library that, when it exists, probably needs to be linked to for
networking.

Check for and add -lnsl -lsocket as well.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: do a full usage-based compile check for sysinfo
Eli Schwartz [Fri, 25 Apr 2025 05:25:42 +0000 (01:25 -0400)] 
meson: do a full usage-based compile check for sysinfo

On Solaris, sys/sysinfo.h is a completely different file and doesn't
resemble the linux file at all. There is also a sysinfo() function, but
it takes a totally different call signature, which asks for:

- the field you wish to receive
- a `char *buf` to copy the data to

and is very useful IFF you want to know, say, the hardware provider. Or,
get *specific* fields from uname(2).

https://docs.oracle.com/cd/E86824_01/html/E54765/sysinfo-2.html

It is surely possible to do this manually via `sysconf(3)` without the
nice API. I can't find anything more direct. Either way, I'm not very
attached to Solaris, so someone who cares can add it. Either way, it's
wrong to assume that sysinfo.h contains what we are looking for.

Check that sysinfo.h defines the struct we actually utilize in
builtins/gc.c, which will correctly fail on systems that don't have it.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: check for getpagesize before using it
Eli Schwartz [Fri, 25 Apr 2025 05:25:41 +0000 (01:25 -0400)] 
meson: check for getpagesize before using it

It is deprecated and removed in SUS v3 / POSIX 2001, so various systems
may not include it. Solaris, in particular, carefully refrains from
defining it except inside of a maze of `#ifdef` to make sure you have
kept your nose clean and only used it in code that *targets* SUS v2 or
earlier.

config.mak.uname defines this automatically, though only for QNX.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agomeson: simplify and parameterize various standard function checks
Eli Schwartz [Fri, 25 Apr 2025 05:25:40 +0000 (01:25 -0400)] 
meson: simplify and parameterize various standard function checks

This is repetitive logic. We either want to use some -lc function, or if
it is not available we define it as -DNO_XXX and usually (but not
always) provide some custom compatibility impl instead.

Checking the intent of each block when reading through the file is slow
and not very DRY. Switch to taking an array of checkable functions
instead.

Not all functions are straightforward to move, since different macro
prefixes are used.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoci: download JGit from maven, not eclipse.org
Junio C Hamano [Fri, 25 Apr 2025 15:38:27 +0000 (08:38 -0700)] 
ci: download JGit from maven, not eclipse.org

As Matthias Sohn, JGit maintainer, recommends, update the JGit
download link from repo.eclipse.org to a one in maven.org

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoci: update the message for unavailble third-party software
Junio C Hamano [Fri, 25 Apr 2025 15:38:26 +0000 (08:38 -0700)] 
ci: update the message for unavailble third-party software

An earlier fix added an extra message immediately after failing to
download a third-party package.  But near the end of the script,
their availability is checked again and given a message.

Remove the new ones added with a recent fix, as they are redundant.
If we were to add more places to download these software (e.g. for
other platforms we currently do not download them on), the existing
warnning near the end of the script will also trigger.

While at it, as Dscho suggests, rewrite the WARNING: label on the
warning message to ::warning::, which presumably should be shown a
bit more prominently in the CI summary.

Suggested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe ninth batch
Junio C Hamano [Fri, 25 Apr 2025 00:27:03 +0000 (17:27 -0700)] 
The ninth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>