]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
8 months agoMerge branch 'ps/reftable-concurrent-writes'
Junio C Hamano [Mon, 30 Sep 2024 23:16:14 +0000 (16:16 -0700)] 
Merge branch 'ps/reftable-concurrent-writes'

Give timeout to the locking code to write to reftable.

* ps/reftable-concurrent-writes:
  refs/reftable: reload locked stack when preparing transaction
  reftable/stack: allow locking of outdated stacks
  refs/reftable: introduce "reftable.lockTimeout"

8 months agoGit 2.47-rc0 v2.47.0-rc0
Junio C Hamano [Thu, 26 Sep 2024 01:23:49 +0000 (18:23 -0700)] 
Git 2.47-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoMerge branch 'jk/sendemail-mailmap-doc'
Junio C Hamano [Thu, 26 Sep 2024 01:24:52 +0000 (18:24 -0700)] 
Merge branch 'jk/sendemail-mailmap-doc'

Docfix.

* jk/sendemail-mailmap-doc:
  send-email: document --mailmap and associated configuration

8 months agoMerge branch 'rs/diff-exit-code-binary'
Junio C Hamano [Thu, 26 Sep 2024 01:24:51 +0000 (18:24 -0700)] 
Merge branch 'rs/diff-exit-code-binary'

"git diff --exit-code" ignored modified binary files, which has
been corrected.

* rs/diff-exit-code-binary:
  diff: report modified binary files as changes in builtin_diff()

8 months agoMerge branch 'cb/ci-freebsd-13-4'
Junio C Hamano [Thu, 26 Sep 2024 01:24:51 +0000 (18:24 -0700)] 
Merge branch 'cb/ci-freebsd-13-4'

CI updates.

* cb/ci-freebsd-13-4:
  ci: update FreeBSD image to 13.4

8 months agoMerge branch 'ak/doc-sparse-co-typofix'
Junio C Hamano [Thu, 26 Sep 2024 01:24:50 +0000 (18:24 -0700)] 
Merge branch 'ak/doc-sparse-co-typofix'

Docfix.

* ak/doc-sparse-co-typofix:
  Documentation/technical: fix a typo

8 months agoMerge branch 'ak/typofix-builtins'
Junio C Hamano [Thu, 26 Sep 2024 01:24:50 +0000 (18:24 -0700)] 
Merge branch 'ak/typofix-builtins'

Typofix.

* ak/typofix-builtins:
  builtin: fix typos

8 months agoThe 21st batch
Junio C Hamano [Wed, 25 Sep 2024 17:33:15 +0000 (10:33 -0700)] 
The 21st batch

This pretty much should match what we would have in the upcoming
preview of 2.47.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 months agoMerge branch 'jc/cmake-unit-test-updates'
Junio C Hamano [Wed, 25 Sep 2024 17:37:13 +0000 (10:37 -0700)] 
Merge branch 'jc/cmake-unit-test-updates'

CMake adjustments for recent changes around unit tests.

* jc/cmake-unit-test-updates:
  cmake: generalize the handling of the `UNIT_TEST_OBJS` list
  cmake: stop looking for `REFTABLE_TEST_OBJS` in the Makefile
  cmake: rename clar-related variables to avoid confusion

8 months agoMerge branch 'ps/ci-gitlab-upgrade'
Junio C Hamano [Wed, 25 Sep 2024 17:37:12 +0000 (10:37 -0700)] 
Merge branch 'ps/ci-gitlab-upgrade'

CI updates.

* ps/ci-gitlab-upgrade:
  gitlab-ci: upgrade machine type of Linux runners

8 months agoMerge branch 'ak/refs-symref-referent-typofix'
Junio C Hamano [Wed, 25 Sep 2024 17:37:12 +0000 (10:37 -0700)] 
Merge branch 'ak/refs-symref-referent-typofix'

Typofix.

* ak/refs-symref-referent-typofix:
  ref-filter: fix a typo

8 months agoMerge branch 'ak/typofix-2.46-maint'
Junio C Hamano [Wed, 25 Sep 2024 17:37:11 +0000 (10:37 -0700)] 
Merge branch 'ak/typofix-2.46-maint'

Typofix.

* ak/typofix-2.46-maint:
  upload-pack: fix a typo
  sideband: fix a typo
  setup: fix a typo
  run-command: fix a typo
  revision: fix a typo
  refs: fix typos
  rebase: fix a typo
  read-cache-ll: fix a typo
  pretty: fix a typo
  object-file: fix a typo
  merge-ort: fix typos
  merge-ll: fix a typo
  http: fix a typo
  gpg-interface: fix a typo
  git-p4: fix typos
  git-instaweb: fix a typo
  fsmonitor-settings: fix a typo
  diffcore-rename: fix typos
  config.mak.dev: fix a typo

8 months agoMerge branch 'ps/reftable-exclude'
Junio C Hamano [Wed, 25 Sep 2024 17:37:11 +0000 (10:37 -0700)] 
Merge branch 'ps/reftable-exclude'

The reftable backend learned to more efficiently handle exclude
patterns while enumerating the refs.

* ps/reftable-exclude:
  refs/reftable: wire up support for exclude patterns
  reftable/reader: make table iterator reseekable
  t/unit-tests: introduce reftable library
  Makefile: stop listing test library objects twice
  builtin/receive-pack: fix exclude patterns when announcing refs
  refs: properly apply exclude patterns to namespaced refs

8 months agoMerge branch 'ps/apply-leakfix'
Junio C Hamano [Wed, 25 Sep 2024 17:37:10 +0000 (10:37 -0700)] 
Merge branch 'ps/apply-leakfix'

"git apply" had custom buffer management code that predated before
use of strbuf got widespread, which has been updated to use strbuf,
which also plugged some memory leaks.

* ps/apply-leakfix:
  apply: refactor `struct image` to use a `struct strbuf`
  apply: rename members that track line count and allocation length
  apply: refactor code to drop `line_allocated`
  apply: introduce macro and function to init images
  apply: rename functions operating on `struct image`
  apply: reorder functions to move image-related things together

8 months agosend-email: document --mailmap and associated configuration
Jacob Keller [Mon, 23 Sep 2024 22:24:28 +0000 (15:24 -0700)] 
send-email: document --mailmap and associated configuration

241499aba007 ("send-email: add mailmap support via sendemail.mailmap and
--mailmap", 2024-08-27) added support for --mailmap, and the associated
sendemail.mailmap.* configuration variables. Add documentation to
reflect this feature.

Fixes: 241499aba007 ("send-email: add mailmap support via sendemail.mailmap and --mailmap")
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobuiltin: fix typos
Andrew Kreimer [Tue, 24 Sep 2024 13:09:06 +0000 (16:09 +0300)] 
builtin: fix typos

Fix typos in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorefs/reftable: reload locked stack when preparing transaction
Patrick Steinhardt [Tue, 24 Sep 2024 05:33:08 +0000 (07:33 +0200)] 
refs/reftable: reload locked stack when preparing transaction

When starting a reftable transaction we lock all stacks we are about to
modify. While it may happen that the stack is out-of-date at this point
in time we don't really care: transactional updates encode the expected
state of a certain reference, so all that we really want to verify is
that the _current_ value matches that expected state.

Pass `REFTABLE_STACK_NEW_ADDITION_RELOAD` when locking the stack such
that an out-of-date stack will be reloaded after having been locked.
This change is safe because all verifications of the expected state
happen after this step anyway.

Add a testcase that verifies that many writers are now able to write to
the stack concurrently without failures and with a deterministic end
result.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoreftable/stack: allow locking of outdated stacks
Patrick Steinhardt [Tue, 24 Sep 2024 05:33:05 +0000 (07:33 +0200)] 
reftable/stack: allow locking of outdated stacks

In `reftable_stack_new_addition()` we first lock the stack and then
check whether it is still up-to-date. If it is not we return an error to
the caller indicating that the stack is outdated.

This is overly restrictive in our ref transaction interface though: we
lock the stack right before we start to verify the transaction, so we do
not really care whether it is outdated or not. What we really want is
that the stack is up-to-date after it has been locked so that we can
verify queued updates against its current state while we know that it is
locked for concurrent modification.

Introduce a new flag `REFTABLE_STACK_NEW_ADDITION_RELOAD` that alters
the behaviour of `reftable_stack_init_addition()` in this case: when we
notice that it is out-of-date we reload it instead of returning an error
to the caller.

This logic will be wired up in the reftable backend in the next commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorefs/reftable: introduce "reftable.lockTimeout"
Patrick Steinhardt [Tue, 24 Sep 2024 05:33:02 +0000 (07:33 +0200)] 
refs/reftable: introduce "reftable.lockTimeout"

When multiple concurrent processes try to update references in a
repository they may try to lock the same lockfiles. This can happen even
when the updates are non-conflicting and can both be applied, so it
doesn't always make sense to abort the transaction immediately. Both the
"loose" and "packed" backends thus have a grace period that they wait
for the lock to be released that can be controlled via the config values
"core.filesRefLockTimeout" and "core.packedRefsTimeout", respectively.

The reftable backend doesn't have such a setting yet and instead fails
immediately when it sees such a lock. But the exact same concepts apply
here as they do apply to the other backends.

Introduce a new "reftable.lockTimeout" config that controls how long we
may wait for a "tables.list" lock to be released. The default value of
this config is 100ms, which is the same default as we have it for the
"loose" backend.

Note that even though we also lock individual tables, this config really
only applies to the "tables.list" file. This is because individual
tables are only ever locked when we already hold the "tables.list" lock
during compaction. When we observe such a lock we in fact do not want to
compact the table at all because it is already in the process of being
compacted by a concurrent process. So applying the same timeout here
would not make any sense and only delay progress.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoDocumentation/technical: fix a typo
Andrew Kreimer [Fri, 20 Sep 2024 08:28:13 +0000 (11:28 +0300)] 
Documentation/technical: fix a typo

Fix a typo in documentation.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe 20th batch
Junio C Hamano [Mon, 23 Sep 2024 17:31:05 +0000 (10:31 -0700)] 
The 20th batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jc/pass-repo-to-builtins'
Junio C Hamano [Mon, 23 Sep 2024 17:35:09 +0000 (10:35 -0700)] 
Merge branch 'jc/pass-repo-to-builtins'

The convention to calling into built-in command implementation has
been updated to pass the repository, if known, together with the
prefix value.

* jc/pass-repo-to-builtins:
  add: pass in repo variable instead of global the_repository
  builtin: remove USE_THE_REPOSITORY for those without the_repository
  builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
  builtin: add a repository parameter for builtin functions

9 months agoMerge branch 'jk/t9001-deflake'
Junio C Hamano [Mon, 23 Sep 2024 17:35:08 +0000 (10:35 -0700)] 
Merge branch 'jk/t9001-deflake'

Test fix.

* jk/t9001-deflake:
  t9001: use a more distinct fake BugID

9 months agoMerge branch 'jk/jump-quickfix-fixes'
Junio C Hamano [Mon, 23 Sep 2024 17:35:08 +0000 (10:35 -0700)] 
Merge branch 'jk/jump-quickfix-fixes'

A few usability fixes to "git jump" (in contrib/).

* jk/jump-quickfix-fixes:
  git-jump: ignore deleted files in diff mode
  git-jump: always specify column 1 for diff entries

9 months agoMerge branch 'ak/typofixes'
Junio C Hamano [Mon, 23 Sep 2024 17:35:07 +0000 (10:35 -0700)] 
Merge branch 'ak/typofixes'

Trivial typofixes.

* ak/typofixes:
  cbtree: fix a typo
  bloom: fix a typo
  attr: fix a typo

9 months agoMerge branch 'jk/diag-unexpected-remote-helper-death'
Junio C Hamano [Mon, 23 Sep 2024 17:35:06 +0000 (10:35 -0700)] 
Merge branch 'jk/diag-unexpected-remote-helper-death'

When a remote-helper dies before Git writes to it, SIGPIPE killed
Git silently.  We now explain the situation a bit better to the end
user in our error message.

* jk/diag-unexpected-remote-helper-death:
  print an error when remote helpers die during capabilities

9 months agoMerge branch 'jc/t5512-sigpipe-fix'
Junio C Hamano [Mon, 23 Sep 2024 17:35:05 +0000 (10:35 -0700)] 
Merge branch 'jc/t5512-sigpipe-fix'

Test fix.

* jc/t5512-sigpipe-fix:
  t5512.40 sometimes dies by SIGPIPE

9 months agoMerge branch 'ps/environ-wo-the-repository'
Junio C Hamano [Mon, 23 Sep 2024 17:35:04 +0000 (10:35 -0700)] 
Merge branch 'ps/environ-wo-the-repository'

Code clean-up.

* ps/environ-wo-the-repository: (21 commits)
  environment: stop storing "core.notesRef" globally
  environment: stop storing "core.warnAmbiguousRefs" globally
  environment: stop storing "core.preferSymlinkRefs" globally
  environment: stop storing "core.logAllRefUpdates" globally
  refs: stop modifying global `log_all_ref_updates` variable
  branch: stop modifying `log_all_ref_updates` variable
  repo-settings: track defaults close to `struct repo_settings`
  repo-settings: split out declarations into a standalone header
  environment: guard state depending on a repository
  environment: reorder header to split out `the_repository`-free section
  environment: move `set_git_dir()` and related into setup layer
  environment: make `get_git_namespace()` self-contained
  environment: move object database functions into object layer
  config: make dependency on repo in `read_early_config()` explicit
  config: document `read_early_config()` and `read_very_early_config()`
  environment: make `get_git_work_tree()` accept a repository
  environment: make `get_graft_file()` accept a repository
  environment: make `get_index_file()` accept a repository
  environment: make `get_object_directory()` accept a repository
  environment: make `get_git_common_dir()` accept a repository
  ...

9 months agoSync with Git 2.46.2
Junio C Hamano [Mon, 23 Sep 2024 17:34:39 +0000 (10:34 -0700)] 
Sync with Git 2.46.2

9 months agoGit 2.46.2 v2.46.2
Junio C Hamano [Fri, 20 Sep 2024 16:10:24 +0000 (09:10 -0700)] 
Git 2.46.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'ma/test-libcurl-prereq' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:33:00 +0000 (10:33 -0700)] 
Merge branch 'ma/test-libcurl-prereq' into maint-2.46

Test portability fix.

* ma/test-libcurl-prereq:
  t0211: add missing LIBCURL prereq
  t1517: add missing LIBCURL prereq

9 months agoMerge branch 'jc/doc-skip-fetch-all-and-prefetch' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:33:00 +0000 (10:33 -0700)] 
Merge branch 'jc/doc-skip-fetch-all-and-prefetch' into maint-2.46

Doc updates.

* jc/doc-skip-fetch-all-and-prefetch:
  doc: remote.*.skip{DefaultUpdate,FetchAll} stops prefetch

9 months agoMerge branch 'bl/trailers-and-incomplete-last-line-fix' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:32:59 +0000 (10:32 -0700)] 
Merge branch 'bl/trailers-and-incomplete-last-line-fix' into maint-2.46

The interpret-trailers command failed to recognise the end of the
message when the commit log ends in an incomplete line.

* bl/trailers-and-incomplete-last-line-fix:
  interpret-trailers: handle message without trailing newline

9 months agoMerge branch 'rj/cygwin-has-dev-tty' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:32:59 +0000 (10:32 -0700)] 
Merge branch 'rj/cygwin-has-dev-tty' into maint-2.46

Cygwin does have /dev/tty support that is needed by things like
single-key input mode.

* rj/cygwin-has-dev-tty:
  config.mak.uname: add HAVE_DEV_TTY to cygwin config section

9 months agoMerge branch 'rs/diff-exit-code-fix' into maint-2.46
Junio C Hamano [Mon, 23 Sep 2024 17:32:58 +0000 (10:32 -0700)] 
Merge branch 'rs/diff-exit-code-fix' into maint-2.46

In a few corner cases "git diff --exit-code" failed to report
"changes" (e.g., renamed without any content change), which has
been corrected.

* rs/diff-exit-code-fix:
  diff: report dirty submodules as changes in builtin_diff()
  diff: report copies and renames as changes in run_diff_cmd()

9 months agodiff: report modified binary files as changes in builtin_diff()
René Scharfe [Sat, 21 Sep 2024 15:09:54 +0000 (17:09 +0200)] 
diff: report modified binary files as changes in builtin_diff()

The diff machinery has two ways to detect changes to set the exit code:
Just comparing hashes and comparing blob contents.  The latter is needed
if certain changes have to be ignored, e.g. with --ignore-space-change
or --ignore-matching-lines.  It's enabled by the diff_options flag
diff_from_contents.

The code for handling binary files added by 1aaf69e669 (diff: shortcut
for diff'ing two binary SHA-1 objects, 2014-08-16) always uses a quick
hash-only comparison, even if the slow way is taken.  We need it to
report a hash difference as a change for the purpose of setting the
exit code, though, but it never did.  Fix that.

d7b97b7185 (diff: let external diffs report that changes are
uninteresting, 2024-06-09) set diff_from_contents if external diff
programs are allowed.  This is the default e.g. for git diff, and so
that change exposed the inconsistency much more widely.

Reported-by: Kohei Shibata <shiba200712@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoci: update FreeBSD image to 13.4
Carlo Marcelo Arenas Belón [Fri, 20 Sep 2024 20:14:09 +0000 (13:14 -0700)] 
ci: update FreeBSD image to 13.4

FreeBSD 13.4 was recently released, and that means the version
of the image used by this job (13.2) will be out of support soon.

Update it before the job starts failing because packages are no
longer compatible or the image gets retired by the provider since
it is now EOL.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoThe 19th batch
Junio C Hamano [Fri, 20 Sep 2024 15:59:27 +0000 (08:59 -0700)] 
The 19th batch

Merge the topics that have been cooking since 2024-09-13 or so in
'next'.

Let's try a new workflow to update the maintenance track by removing
the "merge ... later to maint" comments from the draft release notes
on the 'master' track.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jk/git-pm-bare-repo-fix'
Junio C Hamano [Fri, 20 Sep 2024 18:16:32 +0000 (11:16 -0700)] 
Merge branch 'jk/git-pm-bare-repo-fix'

In Git 2.39, Git.pm stopped working in a bare repository, which has
been corrected.

* jk/git-pm-bare-repo-fix:
  Git.pm: use "rev-parse --absolute-git-dir" rather than perl code
  Git.pm: fix bare repository search with Directory option

9 months agoMerge branch 'bb/unicode-width-table-16'
Junio C Hamano [Fri, 20 Sep 2024 18:16:32 +0000 (11:16 -0700)] 
Merge branch 'bb/unicode-width-table-16'

Update the character width table for Unicode 16.

* bb/unicode-width-table-16:
  unicode: update the width tables to Unicode 16

9 months agoMerge branch 'ma/test-libcurl-prereq'
Junio C Hamano [Fri, 20 Sep 2024 18:16:31 +0000 (11:16 -0700)] 
Merge branch 'ma/test-libcurl-prereq'

Test portability fix.

* ma/test-libcurl-prereq:
  t0211: add missing LIBCURL prereq
  t1517: add missing LIBCURL prereq

9 months agoMerge branch 'jk/interop-test-build-options'
Junio C Hamano [Fri, 20 Sep 2024 18:16:31 +0000 (11:16 -0700)] 
Merge branch 'jk/interop-test-build-options'

The support to customize build options to adjust for older versions
and/or older systems for the interop tests has been improved.

* jk/interop-test-build-options:
  t/interop: allow per-version make options

9 months agoMerge branch 'jk/no-openssl-with-openssl-sha1'
Junio C Hamano [Fri, 20 Sep 2024 18:16:30 +0000 (11:16 -0700)] 
Merge branch 'jk/no-openssl-with-openssl-sha1'

The "imap-send" now allows to be compiled with NO_OPENSSL and
OPENSSL_SHA1 defined together.

* jk/no-openssl-with-openssl-sha1:
  imap-send: handle NO_OPENSSL even when openssl exists

9 months agoMerge branch 'ps/leakfixes-part-6'
Junio C Hamano [Fri, 20 Sep 2024 18:16:30 +0000 (11:16 -0700)] 
Merge branch 'ps/leakfixes-part-6'

More leakfixes.

* ps/leakfixes-part-6: (22 commits)
  builtin/repack: fix leaking keep-pack list
  merge-ort: fix two leaks when handling directory rename modifications
  match-trees: fix leaking prefixes in `shift_tree()`
  builtin/fmt-merge-msg: fix leaking buffers
  builtin/grep: fix leaking object context
  builtin/pack-objects: plug leaking list of keep-packs
  builtin/repack: fix leaking line buffer when packing promisors
  negotiator/skipping: fix leaking commit entries
  shallow: fix leaking members of `struct shallow_info`
  shallow: free grafts when unregistering them
  object: clear grafts when clearing parsed object pool
  gpg-interface: fix misdesigned signing key interfaces
  send-pack: fix leaking push cert nonce
  remote: fix leak in reachability check of a remote-tracking ref
  remote: fix leaking tracking refs
  builtin/submodule--helper: fix leaking refs on push-check
  submodule: fix leaking fetch task data
  upload-pack: fix leaking child process data on reachability checks
  builtin/push: fix leaking refspec query result
  send-pack: fix leaking common object IDs
  ...

9 months agoMerge branch 'pw/rebase-autostash-fix'
Junio C Hamano [Fri, 20 Sep 2024 18:16:29 +0000 (11:16 -0700)] 
Merge branch 'pw/rebase-autostash-fix'

"git rebase --autostash" failed to resurrect the autostashed
changes when the command gets aborted after giving back control
asking for hlep in conflict resolution.

* pw/rebase-autostash-fix:
  rebase: apply and cleanup autostash when rebase fails to start

9 months agogitlab-ci: upgrade machine type of Linux runners
Patrick Steinhardt [Wed, 18 Sep 2024 06:49:37 +0000 (08:49 +0200)] 
gitlab-ci: upgrade machine type of Linux runners

With the recent effort to make the test suite free of memory leaks we
now run a lot more of test suites with the leak-sanitizer enabled. While
we were originally only executing around 23000 tests, we're now at 30000
tests. Naturally, this has a significant impact on the runtime of such a
test run.

Naturally, this impact can also be felt for our leak-checking CI jobs.
While macOS used to be the slowest-executing job on GitLab CI with ~15
minutes of runtime, nowadays it is our leak checks which take around 45
to 55 minutes.

Our Linux runners for GitLab CI are untagged, which means that they
default to the "small" machine type with two CPU cores [1]. Upgrade
these to the "medium" runner, which provide four CPU cores and which
should thus provide a noticeable speedup.

In theory, we could upgrade to an ever larger machine than that. The
official mirror [2] has an Ultimate license, so we could get up to 128
cores. But anybody running a fork of the Git project without such a
license wouldn't be able to use those beefier machines and thus their
pipelines would fail.

[1]: https://docs.gitlab.com/ee/ci/runners/hosted_runners/linux.html
[2]: https://gitlab.com/git-scm/git/

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoref-filter: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:34 +0000 (18:34 +0000)] 
ref-filter: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoupload-pack: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:40 +0000 (18:34 +0000)] 
upload-pack: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosideband: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:39 +0000 (18:34 +0000)] 
sideband: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agosetup: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:38 +0000 (18:34 +0000)] 
setup: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorun-command: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:37 +0000 (18:34 +0000)] 
run-command: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorevision: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:36 +0000 (18:34 +0000)] 
revision: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorefs: fix typos
Andrew Kreimer [Thu, 19 Sep 2024 18:34:35 +0000 (18:34 +0000)] 
refs: fix typos

Fix typos in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorebase: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:33 +0000 (18:34 +0000)] 
rebase: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoread-cache-ll: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:32 +0000 (18:34 +0000)] 
read-cache-ll: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agopretty: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:31 +0000 (18:34 +0000)] 
pretty: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoobject-file: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:30 +0000 (18:34 +0000)] 
object-file: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agomerge-ort: fix typos
Andrew Kreimer [Thu, 19 Sep 2024 18:34:29 +0000 (18:34 +0000)] 
merge-ort: fix typos

Fix typos in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agomerge-ll: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:28 +0000 (18:34 +0000)] 
merge-ll: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agohttp: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:27 +0000 (18:34 +0000)] 
http: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agogpg-interface: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:26 +0000 (18:34 +0000)] 
gpg-interface: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agogit-p4: fix typos
Andrew Kreimer [Thu, 19 Sep 2024 18:34:25 +0000 (18:34 +0000)] 
git-p4: fix typos

Fix typos in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agogit-instaweb: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:24 +0000 (18:34 +0000)] 
git-instaweb: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agofsmonitor-settings: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:23 +0000 (18:34 +0000)] 
fsmonitor-settings: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agodiffcore-rename: fix typos
Andrew Kreimer [Thu, 19 Sep 2024 18:34:22 +0000 (18:34 +0000)] 
diffcore-rename: fix typos

Fix typos in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoconfig.mak.dev: fix a typo
Andrew Kreimer [Thu, 19 Sep 2024 18:34:21 +0000 (18:34 +0000)] 
config.mak.dev: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agocmake: generalize the handling of the `UNIT_TEST_OBJS` list
Johannes Schindelin [Wed, 18 Sep 2024 19:29:29 +0000 (19:29 +0000)] 
cmake: generalize the handling of the `UNIT_TEST_OBJS` list

In a15d4465a991 (cmake: also build unit tests, 2023-09-25), I
accommodated the CMake definition. Seeing that a `UNIT_TEST_OBJS` list
was introduced that was built by transforming the `UNIT_TEST_PROGRAMS`
list and then adding a single, hard-coded file
("t/unit-tests/test-lib.c"), I decided to hard-code that in the CMake
definition, too.

The reason why I hard-coded it instead of imitating the
`parse_makefile_for_sources()` paradigm that was used elsewhere when
using the `Makefile` as source of truth for given lists of files: This
function expects _only_ hard-coded values, and that transformed
`UNIT_TEST_PROGRAMS` list complicated everything.

In 872721538c26 (cmake: fix build of `t-oidtree`, 2024-07-12), I
accommodated the CMake definition again, after seeing that the
`UNIT_TEST_OBJS` was still defined via that transformed list but now
appending _two_ hard-coded files ("t/unit-tests/lib-oid.c" joined the
fray).

In 428672a3b16 (Makefile: stop listing test library objects twice,
2024-09-16), the `Makefile` was changed so that `UNIT_TEST_OBJS` is
finally only constructed using hard-coded file names just like the other
`*_OBJS` variables. I missed that and therefore did not adjust the CMake
definition. Besides, the code was working, so there was no real need to
adjust it.

With a4f50bb1e9b (t/unit-tests: introduce reftable library, 2024-09-16),
however, the `UNIT_TEST_OBJS` list became a trio, and the CMake
definition has to be adjusted again. Now that we can use the
`parse_makefile_for_sources()` function without many complications,
let's do that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agocmake: stop looking for `REFTABLE_TEST_OBJS` in the Makefile
Johannes Schindelin [Wed, 18 Sep 2024 19:23:20 +0000 (19:23 +0000)] 
cmake: stop looking for `REFTABLE_TEST_OBJS` in the Makefile

As of 15e29ea1c648 (t: move reftable/stack_test.c to the unit testing
framework, 2024-09-08), the reftable tests are no longer part of
`test-tool.exe`, so let's stop looking for those lines that are no
longer in the `Makefile`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agocmake: rename clar-related variables to avoid confusion
Johannes Schindelin [Wed, 18 Sep 2024 19:21:16 +0000 (19:21 +0000)] 
cmake: rename clar-related variables to avoid confusion

In c3de556a841f (Makefile: rename clar-related variables to avoid
confusion, 2024-09-10) some `Makefile` variables were renamed that were
partially used by the CMake definition. Adapt the latter to the new lay
of the land.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'ps/reftable-exclude' into jc/cmake-unit-test-updates
Junio C Hamano [Thu, 19 Sep 2024 01:05:44 +0000 (18:05 -0700)] 
Merge branch 'ps/reftable-exclude' into jc/cmake-unit-test-updates

* ps/reftable-exclude:
  refs/reftable: wire up support for exclude patterns
  reftable/reader: make table iterator reseekable
  t/unit-tests: introduce reftable library
  Makefile: stop listing test library objects twice
  builtin/receive-pack: fix exclude patterns when announcing refs
  refs: properly apply exclude patterns to namespaced refs

9 months agoThe eighteenth batch
Junio C Hamano [Thu, 19 Sep 2024 00:47:14 +0000 (17:47 -0700)] 
The eighteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'es/chainlint-message-updates'
Junio C Hamano [Thu, 19 Sep 2024 01:02:05 +0000 (18:02 -0700)] 
Merge branch 'es/chainlint-message-updates'

The error messages from the test script checker have been improved.

* es/chainlint-message-updates:
  chainlint: reduce annotation noise-factor
  chainlint: make error messages self-explanatory
  chainlint: don't be fooled by "?!...?!" in test body

9 months agoMerge branch 'ps/clar-unit-test'
Junio C Hamano [Thu, 19 Sep 2024 01:02:05 +0000 (18:02 -0700)] 
Merge branch 'ps/clar-unit-test'

Import clar unit tests framework libgit2 folks invented for our
use.

* ps/clar-unit-test:
  Makefile: rename clar-related variables to avoid confusion
  clar: add CMake support
  t/unit-tests: convert ctype tests to use clar
  t/unit-tests: convert strvec tests to use clar
  t/unit-tests: implement test driver
  Makefile: wire up the clar unit testing framework
  Makefile: do not use sparse on third-party sources
  Makefile: make hdr-check depend on generated headers
  Makefile: fix sparse dependency on GENERATED_H
  clar: stop including `shellapi.h` unnecessarily
  clar(win32): avoid compile error due to unused `fs_copy()`
  clar: avoid compile error with mingw-w64
  t/clar: fix compatibility with NonStop
  t: import the clar unit testing framework
  t: do not pass GIT_TEST_OPTS to unit tests with prove

9 months agoapply: refactor `struct image` to use a `struct strbuf`
Patrick Steinhardt [Tue, 17 Sep 2024 10:08:08 +0000 (12:08 +0200)] 
apply: refactor `struct image` to use a `struct strbuf`

The `struct image` uses a character array to track the pre- or postimage
of a patch operation. This has multiple downsides:

  - It is somewhat hard to track memory ownership. In fact, we have
    several memory leaks in git-apply(1) because we do not (and cannot
    easily) free the buffer in all situations.

  - We have to reinvent the wheel and manually implement a lot of
    functionality that would already be provided by `struct strbuf`.

  - We have to carefully track whether `update_pre_post_images()` can do
    an in-place update of the postimage or whether it has to allocate a
    new buffer for it.

This is all rather cumbersome, and especially `update_pre_post_images()`
is really hard to understand as a consequence even though what it is
doing is rather trivial.

Refactor the code to use a `struct strbuf` instead, addressing all of
the above. Like this we can easily perform in-place updates in all
situations, the logic to perform those updates becomes way simpler and
the lifetime of the buffer becomes a ton easier to track.

This refactoring also plugs some leaking buffers as a side effect.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoapply: rename members that track line count and allocation length
Patrick Steinhardt [Tue, 17 Sep 2024 10:08:06 +0000 (12:08 +0200)] 
apply: rename members that track line count and allocation length

The `struct image` has two members `nr` and `alloc` that track the
number of lines as well as how large its array is. It is somewhat easy
to confuse these members with `len` though, which tracks the length of
the `buf` member.

Rename these members to `line_nr` and `line_alloc` respectively to avoid
confusion. This is in line with how we typically name variables that
track an array in this way.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoapply: refactor code to drop `line_allocated`
Patrick Steinhardt [Tue, 17 Sep 2024 10:08:03 +0000 (12:08 +0200)] 
apply: refactor code to drop `line_allocated`

The `struct image` has two members `line` and `line_allocated`. The
former member is the one that should be used throughout the code,
whereas the latter one is used to track whether the lines have been
allocated or not.

In practice, the array of lines is always allocated. The reason why we
have `line_allocated` is that `remove_first_line()` will advance the
array pointer to drop the first entry, and thus it points into the array
instead of to the array header.

Refactor the function to use memmove(3P) instead, which allows us to get
rid of this double bookkeeping. This is less efficient, but I doubt that
this matters much in practice. If this judgement call is found to be
wrong at a later point in time we can likely refactor the surrounding
loop such that we first calculate the number of leading context lines to
remove and then remove them in a single call to memmove(3P).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoapply: introduce macro and function to init images
Patrick Steinhardt [Tue, 17 Sep 2024 10:08:01 +0000 (12:08 +0200)] 
apply: introduce macro and function to init images

We're about to convert the `struct image` to gain a `struct strbuf`
member, which requires more careful initialization than just memsetting
it to zeros. Introduce the `IMAGE_INIT` macro and `image_init()`
function to prepare for this change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoapply: rename functions operating on `struct image`
Patrick Steinhardt [Tue, 17 Sep 2024 10:07:55 +0000 (12:07 +0200)] 
apply: rename functions operating on `struct image`

Rename functions operating on `struct image` to have a `image_` prefix
to match our modern code style.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoapply: reorder functions to move image-related things together
Patrick Steinhardt [Tue, 17 Sep 2024 10:07:52 +0000 (12:07 +0200)] 
apply: reorder functions to move image-related things together

While most of the functions relating to `struct image` are relatively
close to one another, `fuzzy_matchlines()` sits in between those even
though it is rather unrelated.

Reorder functions such that `struct image`-related functions are next to
each other. While at it, move `clear_image()` to the top such that it is
close to the struct definition itself. This makes this lifecycle-related
thing easy to discover.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoci updates
Junio C Hamano [Mon, 16 Sep 2024 22:31:39 +0000 (15:31 -0700)] 
ci updates

This batch is solely to unbreak the 32-bit CI jobs that can no
longer work with Ubuntu xenial image that is too ancient.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoSync with 'maint'
Junio C Hamano [Mon, 16 Sep 2024 22:27:46 +0000 (15:27 -0700)] 
Sync with 'maint'

9 months agoMerge branch 'jk/ci-linux32-update'
Junio C Hamano [Mon, 16 Sep 2024 22:27:08 +0000 (15:27 -0700)] 
Merge branch 'jk/ci-linux32-update'

CI updates

* jk/ci-linux32-update:
  ci: add Ubuntu 16.04 job to GitLab CI
  ci: use regular action versions for linux32 job
  ci: use more recent linux32 image
  ci: unify ubuntu and ubuntu32 dependencies
  ci: drop run-docker scripts

9 months agoMerge branch 'jc/ci-upload-artifact-and-linux32'
Junio C Hamano [Mon, 16 Sep 2024 22:27:08 +0000 (15:27 -0700)] 
Merge branch 'jc/ci-upload-artifact-and-linux32'

CI started failing completely for linux32 jobs, as the step to
upload failed test directory uses GitHub actions that is deprecated
and is now disabled.  Remove the step so at least we will know if
the tests are passing.

* jc/ci-upload-artifact-and-linux32:
  ci: remove 'Upload failed tests' directories' step from linux32 jobs

9 months agoStart preparing for Git 2.46.2
Junio C Hamano [Mon, 16 Sep 2024 22:18:58 +0000 (15:18 -0700)] 
Start preparing for Git 2.46.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jk/ci-linux32-update' into maint-2.46
Junio C Hamano [Mon, 16 Sep 2024 22:13:24 +0000 (15:13 -0700)] 
Merge branch 'jk/ci-linux32-update' into maint-2.46

CI updates

* jk/ci-linux32-update:
  ci: add Ubuntu 16.04 job to GitLab CI
  ci: use regular action versions for linux32 job
  ci: use more recent linux32 image
  ci: unify ubuntu and ubuntu32 dependencies
  ci: drop run-docker scripts

9 months agoMerge branch 'jc/ci-upload-artifact-and-linux32' into maint-2.46
Junio C Hamano [Mon, 16 Sep 2024 22:13:24 +0000 (15:13 -0700)] 
Merge branch 'jc/ci-upload-artifact-and-linux32' into maint-2.46

CI started failing completely for linux32 jobs, as the step to
upload failed test directory uses GitHub actions that is deprecated
and is now disabled.  Remove the step so at least we will know if
the tests are passing.

* jc/ci-upload-artifact-and-linux32:
  ci: remove 'Upload failed tests' directories' step from linux32 jobs

9 months agoRevert "Merge branch 'jc/patch-id' into maint-2.46"
Junio C Hamano [Mon, 16 Sep 2024 22:12:06 +0000 (15:12 -0700)] 
Revert "Merge branch 'jc/patch-id' into maint-2.46"

This reverts commit 41c952ebacf7e3369e7bee721f768114d65e50c4,
reversing changes made to 712d970c0145b95ce655773e7cd1676f09dfd215.
Keeping a known breakage for now is better than introducing new
regression(s).

9 months agoThe seventeenth batch
Junio C Hamano [Mon, 16 Sep 2024 21:22:38 +0000 (14:22 -0700)] 
The seventeenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMerge branch 'jk/ref-filter-trailer-fixes'
Junio C Hamano [Mon, 16 Sep 2024 21:22:55 +0000 (14:22 -0700)] 
Merge branch 'jk/ref-filter-trailer-fixes'

Bugfixes and leak plugging in "git for-each-ref --format=..." code
paths.

* jk/ref-filter-trailer-fixes:
  ref-filter: fix leak with unterminated %(if) atoms
  ref-filter: add ref_format_clear() function
  ref-filter: fix leak when formatting %(push:remoteref)
  ref-filter: fix leak with %(describe) arguments
  ref-filter: fix leak of %(trailers) "argbuf"
  ref-filter: store ref_trailer_buf data per-atom
  ref-filter: drop useless cast in trailers_atom_parser()
  ref-filter: strip signature when parsing tag trailers
  ref-filter: avoid extra copies of payload/signature
  t6300: drop newline from wrapped test title

9 months agoMerge branch 'jc/range-diff-lazy-setup'
Junio C Hamano [Mon, 16 Sep 2024 21:22:54 +0000 (14:22 -0700)] 
Merge branch 'jc/range-diff-lazy-setup'

Code clean-up.

* jc/range-diff-lazy-setup:
  remerge-diff: clean up temporary objdir at a central place
  remerge-diff: lazily prepare temporary objdir on demand

9 months agoMerge branch 'ah/apply-3way-ours'
Junio C Hamano [Mon, 16 Sep 2024 21:22:53 +0000 (14:22 -0700)] 
Merge branch 'ah/apply-3way-ours'

"git apply --3way" learned to take "--ours" and other options.

* ah/apply-3way-ours:
  apply: support --ours, --theirs, and --union for three-way merges

9 months agoMerge branch 'cp/unit-test-reftable-stack'
Junio C Hamano [Mon, 16 Sep 2024 21:22:53 +0000 (14:22 -0700)] 
Merge branch 'cp/unit-test-reftable-stack'

Another reftable test migrated to the unit-test framework.

* cp/unit-test-reftable-stack:
  t-reftable-stack: add test for stack iterators
  t-reftable-stack: add test for non-default compaction factor
  t-reftable-stack: use reftable_ref_record_equal() to compare ref records
  t-reftable-stack: use Git's tempfile API instead of mkstemp()
  t: harmonize t-reftable-stack.c with coding guidelines
  t: move reftable/stack_test.c to the unit testing framework

9 months agorefs/reftable: wire up support for exclude patterns
Patrick Steinhardt [Mon, 16 Sep 2024 08:50:16 +0000 (10:50 +0200)] 
refs/reftable: wire up support for exclude patterns

Exclude patterns can be used by reference backends to skip over blocks
of references that are uninteresting to the caller. Reference backends
do not have to wire up support for them, and all callers are expected to
behave as if the backend didn't support them. In fact, the only backend
that supports exclude patterns right now is the "packed" backend.

Exclude patterns can be quite an important performance optimization in
repositories that have loads of references. The patterns are set up in
case "transfer.hideRefs" and friends are configured during a fetch, so
handling these patterns becomes important once there are lots of hidden
refs in a served repository.

Now that we have properly re-seekable reftable iterators we can also
wire up support for these patterns in the "reftable" backend. Doing so
is conceptually simple: once we hit a reference whose prefix matches the
current exclude pattern we re-seek the iterator to the first reference
that doesn't match the pattern anymore. This schema only works for
trivial patterns that do not have any globbing characters in them, but
this restriction also applies do the "packed" backend.

This makes t1419 work with the "reftable" backend with some slight
modifications. Of course it also speeds up listing of references with
hidden refs. The following benchmark prints one reference with 1 million
hidden references:

    Benchmark 1: HEAD~
      Time (mean ± σ):      93.3 ms ±   2.1 ms    [User: 90.3 ms, System: 2.5 ms]
      Range (min … max):    89.8 ms …  97.2 ms    33 runs

    Benchmark 2: HEAD
      Time (mean ± σ):       4.2 ms ±   0.6 ms    [User: 2.2 ms, System: 1.8 ms]
      Range (min … max):     3.1 ms …   8.1 ms    765 runs

    Summary
      HEAD ran
       22.15 ± 3.19 times faster than HEAD~

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoreftable/reader: make table iterator reseekable
Patrick Steinhardt [Mon, 16 Sep 2024 08:50:14 +0000 (10:50 +0200)] 
reftable/reader: make table iterator reseekable

In 67ce50ba26 (Merge branch 'ps/reftable-reusable-iterator', 2024-05-30)
we have refactored the interface of reftable iterators such that they
can be reused in theory. This patch series only landed the required
changes on the interface level, but didn't yet implement the actual
logic to make iterators reusable.

As it turns out almost all of the infrastructure already does support
re-seeking. The only exception is the table iterator, which does not
reset its `is_finished` bit. Do so and add a couple of tests that verify
that we can re-seek iterators.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agot/unit-tests: introduce reftable library
Patrick Steinhardt [Mon, 16 Sep 2024 08:50:11 +0000 (10:50 +0200)] 
t/unit-tests: introduce reftable library

We have recently migrated all of the reftable unit tests that were part
of the reftable library into our own unit testing framework. As part of
that migration we have duplicated some of the functionality that was
part of the reftable test framework into each of the migrated test
suites. This was a sensible decision to not have all of the migrations
dependent on each other, but now that the migration is done it makes
sense to deduplicate the functionality again.

Introduce a new reftable test library that hosts some shared code and
adapt tests to use it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agoMakefile: stop listing test library objects twice
Patrick Steinhardt [Mon, 16 Sep 2024 08:50:08 +0000 (10:50 +0200)] 
Makefile: stop listing test library objects twice

Whenever one adds another test library compilation unit one has to wire
it up twice in the Makefile: once to append it to `UNIT_TEST_OBJS`, and
once to append it to the `UNIT_TEST_PROGS` target. Ideally, we'd just
reuse the `UNIT_TEST_OBJS` variable in the target so that we can avoid
the duplication. But it also contains all the objects for our test
programs, each of which contains a `cmd_main()`, and thus we cannot link
them all into the target executable.

Refactor the code such that `UNIT_TEST_OBJS` does not contain the unit
test program objects anymore, which we can instead manually append to
the `OBJECTS` variable. Like this, the former variable now only contains
objects for test libraries and can thus be reused.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobuiltin/receive-pack: fix exclude patterns when announcing refs
Patrick Steinhardt [Mon, 16 Sep 2024 08:50:05 +0000 (10:50 +0200)] 
builtin/receive-pack: fix exclude patterns when announcing refs

In `write_head_info()` we announce references to the remote client. We
need to honor "transfer.hideRefs" here so that we do not announce any
references that the client shouldn't be able to learn about. This is
done via two separate mechanisms:

  - We hand over exclude patterns to the reference backend. We can only
    honor "plain" exclude patterns here that do not have prefixes with
    special meaning such as "^" or "!". Filtering down the references is
    handled by `hidden_refs_to_excludes()`.

  - In `show_ref_cb()` we perform a second check against hidden refs.
    For one this is done such that we can handle those special prefixes.
    And second, handling exclude patterns in ref backends is optional,
    so we also have to handle "normal" patterns.

The special-meaning "^" prefix alters whether a hidden ref applies to
the namespace-stripped reference name or the full name. So while we
would usually call `refs_for_each_namespaced_ref()` to only get those
references in the current namespace, we can't because we'd get the
already-rewritten reference names. Instead, we are forced to use
`refs_for_each_fullref_in()` and then manually strip away the namespace
prefix such that we have access to both names.

But this also means that we do not get namespace handling for exclude
patterns, which `refs_for_each_namespaced_ref()` brings for free. This
results in a bug because we potentially end up hiding away references
based on their namespaced name and not on the stripped name as we really
should be doing.

Fix this by manually rewriting the exclude patterns to their namespaced
variants.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agorefs: properly apply exclude patterns to namespaced refs
Patrick Steinhardt [Mon, 16 Sep 2024 08:50:03 +0000 (10:50 +0200)] 
refs: properly apply exclude patterns to namespaced refs

Reference namespaces allow commands like git-upload-pack(1) to serve
different sets of references to the client depending on which namespace
is enabled, which is for example useful in fork networks. Namespaced
refs are stored with a `refs/namespaces/$namespace` prefix, but all the
user will ultimately see is a stripped version where that prefix is
removed.

The way that this interacts with "transfer.hideRefs" is not immediately
obvious: the hidden refs can either apply to the stripped references, or
to the non-stripped ones that still have the namespace prefix. In fact,
the "transfer.hideRefs" machinery does the former and applies to the
stripped reference by default, but rules can have "^" prefixed to switch
this behaviour to instead match against the full reference name.

Namespaces are exclusively handled at the generic "refs" layer, the
respective backends have no clue that such a thing even exists. This
also has the consequence that they cannot handle hiding references as
soon as reference namespaces come into play because they neither know
whether a namespace is active, nor do they know how to strip references
if they are active.

Handling such exclude patterns in `refs_for_each_namespaced_ref()` and
`refs_for_each_fullref_in_prefixes()` is broken though, as both support
that the user passes both namespaces and exclude patterns. In the case
where both are set we will exclude references with unstripped names,
even though we really wanted to exclude references based on their
stripped names.

This only surfaces when:

  - A repository uses reference namespaces.

  - "transfer.hideRefs" is active.

  - The namespaced references are packed into the "packed-refs" file.

None of our tests exercise this scenario, and thus we haven't ever hit
it. While t5509 exercises both (1) and (2), it does not happen to hit
(3). It is trivial to demonstrate the bug though by explicitly packing
refs in the tests, and then we indeed surface the breakage.

Fix this bug by prefixing exclude patterns with the namespace in the
generic layer. The newly introduced function will be used outside of
"refs.c" in the next patch, so we add a declaration to "refs.h".

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agocbtree: fix a typo
Andrew Kreimer [Sun, 15 Sep 2024 23:05:22 +0000 (02:05 +0300)] 
cbtree: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 months agobloom: fix a typo
Andrew Kreimer [Sun, 15 Sep 2024 23:03:37 +0000 (02:03 +0300)] 
bloom: fix a typo

Fix a typo in comments.

Signed-off-by: Andrew Kreimer <algonell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>