Commit Graph

76990 Commits

Author SHA1 Message Date
Junio C Hamano
4a4656d083 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()
2025-05-08 12:36:31 -07:00
Junio C Hamano
6f84262c44 The eleventh batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-05-05 14:56:25 -07:00
Junio C Hamano
791db2c7ba 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
2025-05-05 14:56:25 -07:00
Junio C Hamano
cbda07879d 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
2025-05-05 14:56:25 -07:00
Junio C Hamano
cc14ba68d7 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
2025-05-05 14:56:25 -07:00
Junio C Hamano
b50795db79 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
2025-05-05 14:56:24 -07:00
Junio C Hamano
6c0bd1fc70 The tenth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-04-29 14:21:34 -07:00
Junio C Hamano
daae7937c7 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
2025-04-29 14:21:33 -07:00
Junio C Hamano
29c9aee5f0 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
2025-04-29 14:21:33 -07:00
Junio C Hamano
87b0875425 Merge branch 'jk/p5332-testfix'
A test fix.

* jk/p5332-testfix:
  p5332: drop "+" from --stdin-packs input
2025-04-29 14:21:32 -07:00
Junio C Hamano
0faae382ca 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
2025-04-29 14:21:31 -07:00
Junio C Hamano
27bd8ee311 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
2025-04-29 14:21:31 -07:00
Junio C Hamano
a819a3da85 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
2025-04-29 14:21:30 -07:00
Junio C Hamano
0c9d6b7ced 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
2025-04-29 14:21:29 -07:00
Junio C Hamano
5a6de390d8 Merge branch 'az/tighten-string-array-constness'
Code clean-up.

* az/tighten-string-array-constness:
  global: mark usage strings and string tables const
2025-04-29 14:21:28 -07:00
Junio C Hamano
dd45c2e48f Merge branch 'as/typofix-in-env-h-header'
Typofix.

* as/typofix-in-env-h-header:
  environment: fix typo: 'setup_git_directory_gently'
2025-04-29 14:21:27 -07:00
Junio C Hamano
a501213402 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
2025-04-29 14:21:27 -07:00
Junio C Hamano
8bb81ccfad Merge branch 'js/git-perf-env-override'
Developer support fix..

* js/git-perf-env-override:
  perf: do allow `GIT_PERF_*` to be overridden again
2025-04-29 14:21:26 -07:00
Elijah Newren
9481877de3 hashmap: ensure hashmaps are reusable after hashmap_clear()
In the series merged at bf0a430f70 (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>
2025-04-29 09:51:33 -07:00
Patrick Steinhardt
c3fc5c68f6 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>
2025-04-28 13:13:52 -07:00
Patrick Steinhardt
d84eefaeea 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>
2025-04-28 13:13:52 -07:00
Patrick Steinhardt
5756ccd181 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>
2025-04-28 13:13:52 -07:00
Patrick Steinhardt
d84b990883 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>
2025-04-28 13:13:51 -07:00
Patrick Steinhardt
5a6b9c8155 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>
2025-04-28 13:13:51 -07:00
Eli Schwartz
d380dfeed7 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>
2025-04-25 09:35:56 -07:00
Eli Schwartz
2b83df36f4 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>
2025-04-25 09:35:55 -07:00
Eli Schwartz
5cb05d76af 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>
2025-04-25 09:35:55 -07:00
Eli Schwartz
f5e3c6c57d 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>
2025-04-25 09:35:55 -07:00
Eli Schwartz
945090de2d 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>
2025-04-25 09:35:54 -07:00
Eli Schwartz
61fb2262e7 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>
2025-04-25 09:35:54 -07:00
Junio C Hamano
f65182a99e The ninth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-04-24 17:27:03 -07:00
Junio C Hamano
e09ffefea5 Sync with 'maint' 2025-04-24 17:26:33 -07:00
Junio C Hamano
028c43269e Merge branch 'rj/build-tweaks'
Various build tweaks, including CSPRNG selection on some platforms.

* rj/build-tweaks:
  config.mak.uname: set CSPRNG_METHOD to getrandom on Linux
  config.mak.uname: add arc4random to the cygwin build
  config.mak.uname: add sysinfo() configuration for cygwin
  builtin/gc.c: correct RAM calculation when using sysinfo
  config.mak.uname: add clock_gettime() to the cygwin build
  config.mak.uname: add HAVE_GETDELIM to the cygwin section
  config.mak.uname: only set NO_REGEX on cygwin for v1.7
  config.mak.uname: add a note about NO_STRLCPY for Linux
  Makefile: remove NEEDS_LIBRT build variable
  meson.build: set default help format to html on windows
  meson.build: only set build variables for non-default values
  Makefile: only set some BASIC_CFLAGS when RUNTIME_PREFIX is set
  meson.build: remove -DCURL_DISABLE_TYPECHECK
2025-04-24 17:25:34 -07:00
Junio C Hamano
2bc5414c41 Merge branch 'ps/parse-options-integers'
Update parse-options API to catch mistakes to pass address of an
integral variable of a wrong type/size.

* ps/parse-options-integers:
  parse-options: detect mismatches in integer signedness
  parse-options: introduce precision handling for `OPTION_UNSIGNED`
  parse-options: introduce precision handling for `OPTION_INTEGER`
  parse-options: rename `OPT_MAGNITUDE()` to `OPT_UNSIGNED()`
  parse-options: support unit factors in `OPT_INTEGER()`
  global: use designated initializers for options
  parse: fix off-by-one for minimum signed values
2025-04-24 17:25:34 -07:00
Junio C Hamano
68e5342e19 Merge branch 'ds/doc-disable-hooks'
Document the convention to disable hooks altogether by setting the
hooksPath configuration variable to /dev/nulll

* ds/doc-disable-hooks:
  docs: document core.hooksPath=/dev/null
2025-04-24 17:25:33 -07:00
Junio C Hamano
36d8035d27 Merge branch 'ps/object-file-cleanup'
Code clean-up.

* ps/object-file-cleanup:
  object-store: merge "object-store-ll.h" and "object-store.h"
  object-store: remove global array of cached objects
  object: split out functions relating to object store subsystem
  object-file: drop `index_blob_stream()`
  object-file: split up concerns of `HASH_*` flags
  object-file: split out functions relating to object store subsystem
  object-file: move `xmmap()` into "wrapper.c"
  object-file: move `git_open_cloexec()` to "compat/open.c"
  object-file: move `safe_create_leading_directories()` into "path.c"
  object-file: move `mkdir_in_gitdir()` into "path.c"
2025-04-24 17:25:33 -07:00
Junio C Hamano
51ddc126de Merge branch 'aw/t9811-modernize'
Test updates.

* aw/t9811-modernize:
  t9811: fix misconversion of tests
  t9811: be more precise to check importing of tags
2025-04-24 17:25:32 -07:00
Junio C Hamano
cbe2267d3c Merge branch 'jc/ci-skip-unavailable-external-software'
Make sure outage of third-party sites that supply P4, Git-LFS, and
JGit we use for testing would not prevent our CI jobs from running
at all.

* jc/ci-skip-unavailable-external-software:
  ci: skip unavailable external software
2025-04-24 17:25:32 -07:00
Junio C Hamano
d50a5e8939 CI updates
Ever since we issued 2.49, external forces broke our CI jobs in
various ways, and we had to adjust our code to work them around.
Backmerge them from the 'master' front to make it easier to test
real changes to the maintenance track.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-04-24 17:14:14 -07:00
Junio C Hamano
a910fda6b0 Merge branch 'jc/ci-skip-unavailable-external-software' into maint-2.49
Make sure outage of third-party sites that supply P4, Git-LFS, and
JGit we use for testing would not prevent our CI jobs from running
at all.

* jc/ci-skip-unavailable-external-software:
  ci: skip unavailable external software
2025-04-24 17:13:31 -07:00
Junio C Hamano
051923e5ce Merge branch 'js/ci-fedora-gawk' into maint-2.49
Work around CI breakage due to fedora base image getting updated.

* js/ci-fedora-gawk:
  ci(pedantic): ensure that awk is installed
2025-04-24 17:13:31 -07:00
Junio C Hamano
8829bbfba1 Merge branch 'js/ci-github-update-ubuntu' into maint-2.49
Adjust to the deprecation of use of Ubuntu 20.04 GitHub Actions CI.

* js/ci-github-update-ubuntu:
  ci: upgrade `sparse` to supported build agents
2025-04-24 17:13:30 -07:00
Junio C Hamano
d5b8a70db1 Merge branch 'dd/sparse-glibc-workaround' into maint-2.49
Squelch false-positive from sparse.

* dd/sparse-glibc-workaround:
  sparse: ignore warning from new glibc headers
2025-04-24 17:13:30 -07:00
Junio C Hamano
b0026daf1e ci: skip unavailable external software
The ci/install-dependencies.sh script used in a very early phase of
our CI jobs downloads Perforce, Git-LFS, and JGit, used for running
the test scripts.  The test framework is prepared to properly skip
the tests that depend on these external software, but the CI script
is unnecessarily strict (due to its use of "set -e" in ci/lib.sh)
and fails the entire CI run before even starting to test the rest of
the system.

Notice a failure to download to any of these external software, but
keep going.  We need to be careful about cleaning after a failed
wget, as a later part of the script that does:

        if type jgit >/dev/null 2>&1
        then
                echo "$(tput setaf 6)JGit Version$(tput sgr0)"
                jgit version
        else
                echo >&2 "WARNING: JGit wasn't installed, see above for clues why"
        fi

will (surprise!) succeed running "type jgit", and then fail with
"jgit version", taking the whole thing down due to "set -e".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-04-24 16:12:09 -07:00
Junio C Hamano
a2955b34f4 The eighth batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-04-23 13:58:51 -07:00
Junio C Hamano
477209bd7f Merge branch 'mh/left-right-limited'
"git log --{left,right}-only A...B", when A and B does not share
any common ancestor, now behaves as expected.

* mh/left-right-limited:
  revision: fix --left/right-only use with unrelated histories
2025-04-23 13:58:51 -07:00
Junio C Hamano
480ddc566f Merge branch 'js/range-check-codeql-workaround'
Work around false positive from CodeQL checker.

* js/range-check-codeql-workaround:
  read-cache: check range before dereferencing an array element
2025-04-23 13:58:51 -07:00
Junio C Hamano
29860f3282 Merge branch 'ja/doc-reset-mv-rm-markup-updates'
Doc mark-up updates.

* ja/doc-reset-mv-rm-markup-updates:
  doc: add markup for characters in Guidelines
  doc: fix asciidoctor synopsis processing of triple-dots
  doc: convert git-mv to new documentation format
  doc: move synopsis git-mv commands in the synopsis section
  doc: convert git-rm to new documentation format
  doc: fix synopsis analysis logic
  doc: convert git-reset to new documentation format
2025-04-23 13:58:51 -07:00
Junio C Hamano
bb74c0abbc Merge branch 'kn/bundle-dedup-optim'
Optimize the code to dedup references recorded in a bundle file.

* kn/bundle-dedup-optim:
  bundle: fix non-linear performance scaling with refs
  t6020: test for duplicate refnames in bundle creation
2025-04-23 13:58:50 -07:00
Junio C Hamano
68cd0cfa7e Merge branch 'pb/perf-test-fixes'
"make perf" fixes.

* pb/perf-test-fixes:
  p7821: fix instructions for testing with threads
  p9210: fix 'scalar clone' when running from a detached HEAD
  p7821: fix test_perf invocation for prereqs
2025-04-23 13:58:50 -07:00