]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 months agoMerge branch 'kn/non-transactional-batch-updates'
Junio C Hamano [Wed, 16 Apr 2025 20:54:19 +0000 (13:54 -0700)] 
Merge branch 'kn/non-transactional-batch-updates'

Updating multiple references have only been possible in all-or-none
fashion with transactions, but it can be more efficient to batch
multiple updates even when some of them are allowed to fail in a
best-effort manner.  A new "best effort batches of updates" mode
has been introduced.

* kn/non-transactional-batch-updates:
  update-ref: add --batch-updates flag for stdin mode
  refs: support rejection in batch updates during F/D checks
  refs: implement batch reference update support
  refs: introduce enum-based transaction error types
  refs/reftable: extract code from the transaction preparation
  refs/files: remove duplicate duplicates check
  refs: move duplicate refname update check to generic layer
  refs/files: remove redundant check in split_symref_update()

3 months agoMerge branch 'zy/send-email-error-handling'
Junio C Hamano [Wed, 16 Apr 2025 20:54:19 +0000 (13:54 -0700)] 
Merge branch 'zy/send-email-error-handling'

Auth-related (and unrelated) error handling in send-email has been
made more robust.

* zy/send-email-error-handling:
  send-email: finer-grained SMTP error handling
  send-email: capture errors in an eval {} block

3 months agoMerge branch 'ps/maintenance-reflog-expire'
Junio C Hamano [Wed, 16 Apr 2025 20:54:19 +0000 (13:54 -0700)] 
Merge branch 'ps/maintenance-reflog-expire'

"git maintenance" learns a new task to expire reflog entries.

* ps/maintenance-reflog-expire:
  builtin/maintenance: introduce "reflog-expire" task
  builtin/gc: split out function to expire reflog entries
  builtin/reflog: make functions regarding `reflog_expire_options` public
  builtin/reflog: stop storing per-reflog expiry dates globally
  builtin/reflog: stop storing default reflog expiry dates globally
  reflog: rename `cmd_reflog_expire_cb` to `reflog_expire_options`

3 months agoMerge branch 'jt/rev-list-z'
Junio C Hamano [Wed, 16 Apr 2025 20:54:18 +0000 (13:54 -0700)] 
Merge branch 'jt/rev-list-z'

"git rev-list" learns machine-parsable output format that delimits
each field with NUL.

* jt/rev-list-z:
  rev-list: support NUL-delimited --missing option
  rev-list: support NUL-delimited --boundary option
  rev-list: support delimiting objects with NUL bytes
  rev-list: refactor early option parsing
  rev-list: inline `show_object_with_name()` in `show_object()`

3 months agoMerge branch 'ab/pathspec-sign-compare-workaround'
Junio C Hamano [Wed, 16 Apr 2025 20:54:18 +0000 (13:54 -0700)] 
Merge branch 'ab/pathspec-sign-compare-workaround'

Some warnings from "-Wsign-compare" for pathspec.c have been
squelched.

* ab/pathspec-sign-compare-workaround:
  pathspec: fix sign comparison warnings

3 months agoMerge branch 'ps/misc-build-fixes'
Junio C Hamano [Wed, 16 Apr 2025 20:54:18 +0000 (13:54 -0700)] 
Merge branch 'ps/misc-build-fixes'

Random build fixes.

* ps/misc-build-fixes:
  ci: use Visual Studio for win+meson job on GitHub Workflows
  meson: distinguish build and target host binaries
  meson: respect 'tests' build option in contrib
  gitweb: fix generation of "gitweb.js"
  meson: fix handling of '-Dcurl=auto'

3 months agoMerge branch 'sk/clar-trailer-urlmatch-norm-test'
Junio C Hamano [Wed, 16 Apr 2025 20:54:17 +0000 (13:54 -0700)] 
Merge branch 'sk/clar-trailer-urlmatch-norm-test'

A few traditional unit tests have been rewritten to use the clar
framework.

* sk/clar-trailer-urlmatch-norm-test:
  t/unit-tests: convert urlmatch-normalization test to clar
  t/unit-tests: convert trailer test to use clar

3 months agoMerge branch 'ab/rm-sign-compare'
Junio C Hamano [Wed, 16 Apr 2025 20:54:17 +0000 (13:54 -0700)] 
Merge branch 'ab/rm-sign-compare'

Some warnings from "-Wsign-compare" for builtin/rm.c have been
squelched.

* ab/rm-sign-compare:
  rm: fix sign comparison warnings

3 months agoMerge branch 'jt/ref-transaction-abort-fix'
Junio C Hamano [Wed, 16 Apr 2025 20:54:17 +0000 (13:54 -0700)] 
Merge branch 'jt/ref-transaction-abort-fix'

A ref transaction corner case fix.

* jt/ref-transaction-abort-fix:
  builtin/fetch: avoid aborting closed reference transaction

3 months agoMerge branch 'js/ci-fedora-gawk'
Junio C Hamano [Wed, 16 Apr 2025 20:54:16 +0000 (13:54 -0700)] 
Merge branch 'js/ci-fedora-gawk'

Work around CI breakage due to fedora base image getting updated.

* js/ci-fedora-gawk:
  ci(pedantic): ensure that awk is installed

3 months agoMerge branch 'js/ci-github-update-ubuntu'
Junio C Hamano [Wed, 16 Apr 2025 20:54:16 +0000 (13:54 -0700)] 
Merge branch 'js/ci-github-update-ubuntu'

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

3 months agoMerge branch 'dd/sparse-glibc-workaround'
Junio C Hamano [Wed, 16 Apr 2025 20:54:16 +0000 (13:54 -0700)] 
Merge branch 'dd/sparse-glibc-workaround'

Squelch false-positive from sparse.

* dd/sparse-glibc-workaround:
  sparse: ignore warning from new glibc headers

3 months agoci(pedantic): ensure that awk is installed
Johannes Schindelin [Wed, 16 Apr 2025 05:31:01 +0000 (07:31 +0200)] 
ci(pedantic): ensure that awk is installed

The image pointed to by the fedora:latest tag has moved from fedora
41 to 42. The fedora 41 container images have awk installed while
the fedora 42 images do not.  That change is most likely just part
of reducing the size of the base container images.

In both AlmaLinux and Fedora (as well as other RHEL
derivatives/relatives), awk is provided by the gawk package.

On Fedora, `dnf install awk` would work, by using the package
filelist data to determine that /usr/bin/awk is provided by gawk and
installs gawk as a result.

On AlmaLinux (8 & 9, by quick testing by Todd), that is not the case
and you'd need to use `dnf install gawk` or `dnf install '*bin/awk'`
to get it installed. Having said that, awk _is_ included in the
current AlmaLinux 8 and 9 images, so it isn't strictly needed.  But
it's probably better to be explicit that we need it installed, as a
defense against some future change to the AlmaLinux container
removing awk.

Because we know that on both of these distros, our scripts that call
for 'awk' had been using 'gawk' that was installed as part of the
base image, let's make sure that we explicitly install 'gawk'.  If
the image already has it, it would be a no-op that does not cause
breakage.

Suggested-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoThe fifth batch
Junio C Hamano [Tue, 15 Apr 2025 20:50:30 +0000 (13:50 -0700)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 months agoMerge branch 'bc/allow-upload-pack-from-other-people'
Junio C Hamano [Tue, 15 Apr 2025 20:50:17 +0000 (13:50 -0700)] 
Merge branch 'bc/allow-upload-pack-from-other-people'

Test fix for an already graduated topic.

* bc/allow-upload-pack-from-other-people:
  t5605: fix test for cloning from a different user

3 months agoMerge branch 'pw/custom-conflict-marker-size-for-merge-related-docs'
Junio C Hamano [Tue, 15 Apr 2025 20:50:17 +0000 (13:50 -0700)] 
Merge branch 'pw/custom-conflict-marker-size-for-merge-related-docs'

"git-merge-file" documentation source, which has lines that look
like conflict markers, lacked custom conflict marker size defined,
which has been corrected..

* pw/custom-conflict-marker-size-for-merge-related-docs:
  merge-file doc: set conflict-marker-size attribute

3 months agoMerge branch 'js/comma-semicolon-confusion'
Junio C Hamano [Tue, 15 Apr 2025 20:50:16 +0000 (13:50 -0700)] 
Merge branch 'js/comma-semicolon-confusion'

Code clean-up.

* js/comma-semicolon-confusion:
  detect-compiler: detect clang even if it found CUDA
  clang: warn when the comma operator is used
  compat/regex: explicitly mark intentional use of the comma operator
  wildmatch: avoid using of the comma operator
  diff-delta: avoid using the comma operator
  xdiff: avoid using the comma operator unnecessarily
  clar: avoid using the comma operator unnecessarily
  kwset: avoid using the comma operator unnecessarily
  rebase: avoid using the comma operator unnecessarily
  remote-curl: avoid using the comma operator unnecessarily

3 months agoMerge branch 'jt/clone-guess-remote-head-fix'
Junio C Hamano [Tue, 15 Apr 2025 20:50:16 +0000 (13:50 -0700)] 
Merge branch 'jt/clone-guess-remote-head-fix'

"git clone" still gave the message about the default branch name;
this message has been turned into an advice message that can be
turned off.

* jt/clone-guess-remote-head-fix:
  advice: allow disabling default branch name advice
  builtin/clone: suppress unexpected default branch advice
  remote: allow `guess_remote_head()` to suppress advice

3 months agoMerge branch 'ds/maintenance-loose-objects-batchsize'
Junio C Hamano [Tue, 15 Apr 2025 20:50:16 +0000 (13:50 -0700)] 
Merge branch 'ds/maintenance-loose-objects-batchsize'

The job to coalesce loose objects into packfiles in "git
maintenance" now has configurable batch size.

* ds/maintenance-loose-objects-batchsize:
  maintenance: add loose-objects.batchSize config
  maintenance: force progress/no-quiet to children

3 months agoMerge branch 'lo/userdiff-gitconfig'
Junio C Hamano [Tue, 15 Apr 2025 20:50:15 +0000 (13:50 -0700)] 
Merge branch 'lo/userdiff-gitconfig'

* lo/userdiff-gitconfig:
  userdiff: add builtin driver for INI files

3 months agoMerge branch 'ps/mingw-creat-excl-fix'
Junio C Hamano [Tue, 15 Apr 2025 20:50:15 +0000 (13:50 -0700)] 
Merge branch 'ps/mingw-creat-excl-fix'

Fix lockfile contention in reftable code on Windows.

* ps/mingw-creat-excl-fix:
  compat/mingw: fix EACCESS when opening files with `O_CREAT | O_EXCL`
  meson: fix compat sources when compiling with MSVC

3 months agoMerge branch 'kn/reflog-drop'
Junio C Hamano [Tue, 15 Apr 2025 20:50:15 +0000 (13:50 -0700)] 
Merge branch 'kn/reflog-drop'

"git reflog" learns "drop" subcommand, that discards the entire
reflog data for a ref.

* kn/reflog-drop:
  reflog: implement subcommand to drop reflogs
  reflog: improve error for when reflog is not found

3 months agoMerge branch 'ps/object-wo-the-repository'
Junio C Hamano [Tue, 15 Apr 2025 20:50:14 +0000 (13:50 -0700)] 
Merge branch 'ps/object-wo-the-repository'

The object layer has been updated to take an explicit repository
instance as a parameter in more code paths.

* ps/object-wo-the-repository:
  hash: stop depending on `the_repository` in `null_oid()`
  hash: fix "-Wsign-compare" warnings
  object-file: split out logic regarding hash algorithms
  delta-islands: stop depending on `the_repository`
  object-file-convert: stop depending on `the_repository`
  pack-bitmap-write: stop depending on `the_repository`
  pack-revindex: stop depending on `the_repository`
  pack-check: stop depending on `the_repository`
  environment: move access to "core.bigFileThreshold" into repo settings
  pack-write: stop depending on `the_repository` and `the_hash_algo`
  object: stop depending on `the_repository`
  csum-file: stop depending on `the_repository`

3 months agoMerge branch 'md/t1403-path-is-file'
Junio C Hamano [Tue, 15 Apr 2025 20:50:14 +0000 (13:50 -0700)] 
Merge branch 'md/t1403-path-is-file'

Test tweak.

* md/t1403-path-is-file:
  t1403: verify that path exists and is a file

3 months agoMerge branch 'jk/zlib-inflate-fixes'
Junio C Hamano [Tue, 15 Apr 2025 20:50:13 +0000 (13:50 -0700)] 
Merge branch 'jk/zlib-inflate-fixes'

Fix our use of zlib corner cases.

* jk/zlib-inflate-fixes:
  unpack_loose_rest(): rewrite return handling for clarity
  unpack_loose_rest(): simplify error handling
  unpack_loose_rest(): never clean up zstream
  unpack_loose_rest(): avoid numeric comparison of zlib status
  unpack_loose_header(): avoid numeric comparison of zlib status
  git_inflate(): skip zlib_post_call() sanity check on Z_NEED_DICT
  unpack_loose_header(): fix infinite loop on broken zlib input
  unpack_loose_header(): report headers without NUL as "bad"
  unpack_loose_header(): simplify next_out assignment
  loose_object_info(): BUG() on inflating content with unknown type

3 months agoMerge branch 'ps/reftable-windows-unlink-fix'
Junio C Hamano [Tue, 15 Apr 2025 20:50:13 +0000 (13:50 -0700)] 
Merge branch 'ps/reftable-windows-unlink-fix'

Portability fix.

* ps/reftable-windows-unlink-fix:
  reftable: ignore file-in-use errors when unlink(3p) fails on Windows

4 months agoci: upgrade `sparse` to supported build agents
Johannes Schindelin [Tue, 8 Apr 2025 20:56:33 +0000 (22:56 +0200)] 
ci: upgrade `sparse` to supported build agents

The `sparse` job still uses the `ubuntu-20.04` runner pool, but that
pool is about to go away, so let's stop using it.

There is no `sparse-22.04` artifact provided by the "Build sparse for
Ubuntu" Azure Pipeline, but that is not necessary anyway because Ubuntu
22.04 has the `sparse` package: https://packages.ubuntu.com/jammy/sparse

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agosparse: ignore warning from new glibc headers
Đoàn Trần Công Danh [Tue, 16 Jul 2024 23:17:41 +0000 (06:17 +0700)] 
sparse: ignore warning from new glibc headers

With at least glibc 2.39, glibc provides a function declaration that
matches with this POSIX interface:

    int regexec(const regex_t *restrict preg, const char *restrict string,
           size_t nmatch, regmatch_t pmatch[restrict], int eflags);

such prototype requires variable-length-array for `pmatch'.

Thus, sparse reports this error:

> ../add-patch.c: note: in included file (through ../git-compat-util.h):
> /usr/include/regex.h:682:41: error: undefined identifier '__nmatch'
> /usr/include/regex.h:682:41: error: bad constant expression type
> /usr/include/regex.h:682:41: error: Variable length array is used.

Note: `__nmatch' is POSIX's nmatch.

The glibc's intention is informing their users to provides a large
enough buffer to hold `__nmatch' results and provides diagnosis if
necessary.  It's merely a glibc' implementation detail.

Hide that usage from sparse by using standard C11's macro:
__STDC_NO_VLA__

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoThe fourth batch
Junio C Hamano [Tue, 8 Apr 2025 18:42:53 +0000 (11:42 -0700)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'dk/vimdiff-doc-fix'
Junio C Hamano [Tue, 8 Apr 2025 18:43:16 +0000 (11:43 -0700)] 
Merge branch 'dk/vimdiff-doc-fix'

Doc update.

* dk/vimdiff-doc-fix:
  vimdiff: clarify the sigil used for marking the buffer to save

4 months agoMerge branch 'fr/vimdiff-layout-fixes'
Junio C Hamano [Tue, 8 Apr 2025 18:43:16 +0000 (11:43 -0700)] 
Merge branch 'fr/vimdiff-layout-fixes'

Layout configuration in vimdiff backend didn't work as advertised,
which has been corrected.

* fr/vimdiff-layout-fixes:
  mergetools: vimdiff: add tests for layout with REMOTE as the target
  mergetools: vimdiff: fix layout where REMOTE is the target

4 months agoMerge branch 'es/meson-build-skip-coccinelle'
Junio C Hamano [Tue, 8 Apr 2025 18:43:15 +0000 (11:43 -0700)] 
Merge branch 'es/meson-build-skip-coccinelle'

Build fix.

* es/meson-build-skip-coccinelle:
  meson: disable coccinelle configuration when building from a tarball

4 months agoMerge branch 'ta/bulk-checkin-signed-compare-false-warning-fix'
Junio C Hamano [Tue, 8 Apr 2025 18:43:15 +0000 (11:43 -0700)] 
Merge branch 'ta/bulk-checkin-signed-compare-false-warning-fix'

Compiler warnings workaround.

* ta/bulk-checkin-signed-compare-false-warning-fix:
  bulk-checkin: fix sign compare warnings

4 months agoMerge branch 'rs/clear-commit-marks-simplify'
Junio C Hamano [Tue, 8 Apr 2025 18:43:15 +0000 (11:43 -0700)] 
Merge branch 'rs/clear-commit-marks-simplify'

Code clean-up.

* rs/clear-commit-marks-simplify:
  commit: move clear_commit_marks_many() loop body to clear_commit_marks()

4 months agoMerge branch 'tb/incremental-midx-part-2'
Junio C Hamano [Tue, 8 Apr 2025 18:43:14 +0000 (11:43 -0700)] 
Merge branch 'tb/incremental-midx-part-2'

Incrementally updating multi-pack index files.

* tb/incremental-midx-part-2:
  midx: implement writing incremental MIDX bitmaps
  pack-bitmap.c: use `ewah_or_iterator` for type bitmap iterators
  pack-bitmap.c: keep track of each layer's type bitmaps
  ewah: implement `struct ewah_or_iterator`
  pack-bitmap.c: apply pseudo-merge commits with incremental MIDXs
  pack-bitmap.c: compute disk-usage with incremental MIDXs
  pack-bitmap.c: teach `rev-list --test-bitmap` about incremental MIDXs
  pack-bitmap.c: support bitmap pack-reuse with incremental MIDXs
  pack-bitmap.c: teach `show_objects_for_type()` about incremental MIDXs
  pack-bitmap.c: teach `bitmap_for_commit()` about incremental MIDXs
  pack-bitmap.c: open and store incremental bitmap layers
  pack-revindex: prepare for incremental MIDX bitmaps
  Documentation: describe incremental MIDX bitmaps
  Documentation: remove a "future work" item from the MIDX docs

4 months agoMerge branch 'ps/reftable-sans-compat-util'
Junio C Hamano [Tue, 8 Apr 2025 18:43:14 +0000 (11:43 -0700)] 
Merge branch 'ps/reftable-sans-compat-util'

Make the code in reftable library less reliant on the service
routines it used to borrow from Git proper, to make it easier to
use by external users of the library.

* ps/reftable-sans-compat-util:
  Makefile: skip reftable library for Coccinelle
  reftable: decouple from Git codebase by pulling in "compat/posix.h"
  git-compat-util.h: split out POSIX-emulating bits
  compat/mingw: split out POSIX-related bits
  reftable/basics: introduce `REFTABLE_UNUSED` annotation
  reftable/basics: stop using `SWAP()` macro
  reftable/stack: stop using `sleep_millisec()`
  reftable/system: introduce `reftable_rand()`
  reftable/reader: stop using `ARRAY_SIZE()` macro
  reftable/basics: provide wrappers for big endian conversion
  reftable/basics: stop using `st_mult()` in array allocators
  reftable: stop using `BUG()` in trivial cases
  reftable/record: don't `BUG()` in `reftable_record_cmp()`
  reftable/record: stop using `BUG()` in `reftable_record_init()`
  reftable/record: stop using `COPY_ARRAY()`
  reftable/blocksource: stop using `xmmap()`
  reftable/stack: stop using `write_in_full()`
  reftable/stack: stop using `read_in_full()`

4 months agoMerge branch 'ps/ci-meson-check-build-docs'
Junio C Hamano [Tue, 8 Apr 2025 18:43:13 +0000 (11:43 -0700)] 
Merge branch 'ps/ci-meson-check-build-docs'

CI update.

* ps/ci-meson-check-build-docs:
  ci: perform build and smoke tests for Meson docs

4 months agoMerge branch 'tb/http-curl-keepalive'
Junio C Hamano [Tue, 8 Apr 2025 18:43:13 +0000 (11:43 -0700)] 
Merge branch 'tb/http-curl-keepalive'

TCP keepalive behaviour on http transports can now be configured by
calling cURL library.

* tb/http-curl-keepalive:
  http.c: allow custom TCP keepalive behavior via config
  http.c: inline `set_curl_keepalive()`
  http.c: introduce `set_long_from_env()` for convenience
  http.c: remove unnecessary casts to long

4 months agoMerge branch 'tb/refspec-fetch-cleanup'
Junio C Hamano [Tue, 8 Apr 2025 18:43:13 +0000 (11:43 -0700)] 
Merge branch 'tb/refspec-fetch-cleanup'

Code clean-up.

* tb/refspec-fetch-cleanup:
  refspec: replace `refspec_item_init()` with fetch/push variants
  refspec: remove refspec_item_init_or_die()
  refspec: replace `refspec_init()` with fetch/push variants
  refspec: treat 'fetch' as a Boolean value

4 months agoMerge branch 'ms/reftable-block-writer-errors'
Junio C Hamano [Tue, 8 Apr 2025 18:43:12 +0000 (11:43 -0700)] 
Merge branch 'ms/reftable-block-writer-errors'

Give more meaningful error return values from block writer layer of
the reftable ref-API backend.

* ms/reftable-block-writer-errors:
  reftable: adapt write_object_record() to propagate block_writer_add() errors
  reftable: adapt writer_add_record() to propagate block_writer_add() errors
  reftable: propagate specific error codes in block_writer_add()

4 months agoMerge branch 'en/assert-wo-side-effects'
Junio C Hamano [Tue, 8 Apr 2025 18:43:12 +0000 (11:43 -0700)] 
Merge branch 'en/assert-wo-side-effects'

Ensure what we write in assert() does not have side effects,
and introduce ASSERT() macro to mark those that cannot be
mechanically checked for lack of side effects.

* en/assert-wo-side-effects:
  treewide: replace assert() with ASSERT() in special cases
  ci: add build checking for side-effects in assert() calls
  git-compat-util: introduce ASSERT() macro

4 months agoupdate-ref: add --batch-updates flag for stdin mode
Karthik Nayak [Tue, 8 Apr 2025 08:51:12 +0000 (10:51 +0200)] 
update-ref: add --batch-updates flag for stdin mode

When updating multiple references through stdin, Git's update-ref
command normally aborts the entire transaction if any single update
fails. This atomic behavior prevents partial updates. Introduce a new
batch update system, where the updates the performed together similar
but individual updates are allowed to fail.

Add a new `--batch-updates` flag that allows the transaction to continue
even when individual reference updates fail. This flag can only be used
in `--stdin` mode and builds upon the batch update support added to the
refs subsystem in the previous commits. When enabled, failed updates are
reported in the following format:

  rejected SP (<old-oid> | <old-target>) SP (<new-oid> | <new-target>) SP <rejection-reason> LF

Update the documentation to reflect this change and also tests to cover
different scenarios where an update could be rejected.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorefs: support rejection in batch updates during F/D checks
Karthik Nayak [Tue, 8 Apr 2025 08:51:11 +0000 (10:51 +0200)] 
refs: support rejection in batch updates during F/D checks

The `refs_verify_refnames_available()` is used to batch check refnames
for F/D conflicts. While this is the more performant alternative than
its individual version, it does not provide rejection capabilities on a
single update level. For batched updates, this would mean a rejection of
the entire transaction whenever one reference has a F/D conflict.

Modify the function to call `ref_transaction_maybe_set_rejected()` to
check if a single update can be rejected. Since this function is only
internally used within 'refs/' and we want to pass in a `struct
ref_transaction *` as a variable. We also move and mark
`refs_verify_refnames_available()` to 'refs-internal.h' to be an
internal function.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorefs: implement batch reference update support
Karthik Nayak [Tue, 8 Apr 2025 08:51:10 +0000 (10:51 +0200)] 
refs: implement batch reference update support

Git supports making reference updates with or without transactions.
Updates with transactions are generally better optimized. But
transactions are all or nothing. This means, if a user wants to batch
updates to take advantage of the optimizations without the hard
requirement that all updates must succeed, there is no way currently to
do so. Particularly with the reftable backend where batching multiple
reference updates is more efficient than performing them sequentially.

Introduce batched update support with a new flag,
'REF_TRANSACTION_ALLOW_FAILURE'. Batched updates while different from
transactions, use the transaction infrastructure under the hood. When
enabled, this flag allows individual reference updates that would
typically cause the entire transaction to fail due to non-system-related
errors to be marked as rejected while permitting other updates to
proceed. System errors referred by 'REF_TRANSACTION_ERROR_GENERIC'
continue to result in the entire transaction failing. This approach
enhances flexibility while preserving transactional integrity where
necessary.

The implementation introduces several key components:

  - Add 'rejection_err' field to struct `ref_update` to track failed
    updates with failure reason.

  - Add a new struct `ref_transaction_rejections` and a field within
    `ref_transaction` to this struct to allow quick iteration over
    rejected updates.

  - Modify reference backends (files, packed, reftable) to handle
    partial transactions by using `ref_transaction_set_rejected()`
    instead of failing the entire transaction when
    `REF_TRANSACTION_ALLOW_FAILURE` is set.

  - Add `ref_transaction_for_each_rejected_update()` to let callers
    examine which updates were rejected and why.

This foundational change enables batched update support throughout the
reference subsystem. A following commit will expose this capability to
users by adding a `--batch-updates` flag to 'git-update-ref(1)',
providing both a user-facing feature and a testable implementation.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorefs: introduce enum-based transaction error types
Karthik Nayak [Tue, 8 Apr 2025 08:51:09 +0000 (10:51 +0200)] 
refs: introduce enum-based transaction error types

Replace preprocessor-defined transaction errors with a strongly-typed
enum `ref_transaction_error`. This change:

  - Improves type safety and function signature clarity.
  - Makes error handling more explicit and discoverable.
  - Maintains existing error cases, while adding new error cases for
    common scenarios.

This refactoring paves the way for more comprehensive error handling
which we will utilize in the upcoming commits to add batch reference
update support.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorefs/reftable: extract code from the transaction preparation
Karthik Nayak [Tue, 8 Apr 2025 08:51:08 +0000 (10:51 +0200)] 
refs/reftable: extract code from the transaction preparation

Extract the core logic for preparing individual reference updates from
`reftable_be_transaction_prepare()` into `prepare_single_update()`. This
dedicated function now handles all validation and preparation steps for
each reference update in the transaction, including object ID
verification, HEAD reference handling, and symref processing.

The refactoring consolidates all reference update validation into a
single logical block, which improves code maintainability and
readability. More importantly, this restructuring lays the groundwork
for implementing batched reference update support in the reftable
backend, which will be introduced in a followup commit.

No functional changes are included in this commit - it is purely a code
reorganization to support future enhancements.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorefs/files: remove duplicate duplicates check
Karthik Nayak [Tue, 8 Apr 2025 08:51:07 +0000 (10:51 +0200)] 
refs/files: remove duplicate duplicates check

Within the files reference backend's transaction's 'finish' phase, a
verification step is currently performed wherein the refnames list is
sorted and examined for multiple updates targeting the same refname.

It has been observed that this verification is redundant, as an
identical check is already executed during the transaction's 'prepare'
stage. Since the refnames list remains unmodified following the
'prepare' stage, this secondary verification can be safely eliminated.

The duplicate check has been removed accordingly, and the
`ref_update_reject_duplicates()` function has been marked as static, as
its usage is now confined to 'refs.c'.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorefs: move duplicate refname update check to generic layer
Karthik Nayak [Tue, 8 Apr 2025 08:51:06 +0000 (10:51 +0200)] 
refs: move duplicate refname update check to generic layer

Move the tracking of refnames in `affected_refnames` from individual
backends into the generic layer in 'refs.c'. This centralizes the
duplicate refname detection that was previously handled separately by
each backend.

Make some changes to accommodate this move:

  - Add a `string_list` field `refnames` to `ref_transaction` to contain
    all the references in a transaction. This field is updated whenever
    a new update is added via `ref_transaction_add_update`, so manual
    additions in reference backends are dropped.

  - Modify the backends to use this field internally as needed. The
    backends need to check if an update for refname already exists when
    splitting symrefs or adding an update for 'HEAD'.

  - In the reftable backend, within `reftable_be_transaction_prepare()`,
    move the `string_list_has_string()` check above
    `ref_transaction_add_update()`. Since `ref_transaction_add_update()`
    automatically adds the refname to `transaction->refnames`,
    performing the check after will always return true, so we perform
    the check before adding the update.

This helps reduce duplication of functionality between the backends and
makes it easier to make changes in a more centralized manner.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorefs/files: remove redundant check in split_symref_update()
Karthik Nayak [Tue, 8 Apr 2025 08:51:05 +0000 (10:51 +0200)] 
refs/files: remove redundant check in split_symref_update()

In `split_symref_update()`, there were two checks for duplicate
refnames:

  - At the start, `string_list_has_string()` ensures the refname is not
    already in `affected_refnames`, preventing duplicates from being
    added.

  - After adding the refname, another check verifies whether the newly
    inserted item has a `util` value.

The second check is unnecessary because the first one guarantees that
`string_list_insert()` will never encounter a preexisting entry.

The `item->util` field is assigned to validate that a rename doesn't
already exist in the list. The validation is done after the first check.
As this check is removed, clean up the validation and the assignment of
this field in `split_head_update()` and `files_transaction_prepare()`.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agobuiltin/maintenance: introduce "reflog-expire" task
Patrick Steinhardt [Tue, 8 Apr 2025 06:22:17 +0000 (08:22 +0200)] 
builtin/maintenance: introduce "reflog-expire" task

By default, git-maintenance(1) uses the "gc" task to ensure that the
repository is well-maintained. This can be changed, for example by
either explicitly configuring which tasks should be enabled or by using
the "incremental" maintenance strategy. If so, git-maintenance(1) does
not know to expire reflog entries, which is a subtask that git-gc(1)
knows to perform for the user. Consequently, the reflog will grow
indefinitely unless the user manually trims it.

Introduce a new "reflog-expire" task that plugs this gap:

  - When running the task directly, then we simply execute `git reflog
    expire --all`, which is the same as git-gc(1).

  - When running git-maintenance(1) with the `--auto` flag, then we only
    run the task in case the "HEAD" reflog has at least N reflog entries
    that would be discarded. By default, N is set to 100, but this can
    be configured via "maintenance.reflog-expire.auto". When a negative
    integer has been provided we always expire entries, zero causes us
    to never expire entries, and a positive value specifies how many
    entries need to exist before we consider pruning the entries.

Note that the condition for the `--auto` flags is merely a heuristic and
optimized for being fast. This is because `git maintenance run --auto`
will be executed quite regularly, so scanning through all reflogs would
likely be too expensive in many repositories.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agobuiltin/gc: split out function to expire reflog entries
Patrick Steinhardt [Tue, 8 Apr 2025 06:22:16 +0000 (08:22 +0200)] 
builtin/gc: split out function to expire reflog entries

We're about to introduce a new task for git-maintenance(1) that knows to
expire reflog entries. The logic will be shared with git-gc(1), which
already knows how to do this.

Pull out the common logic into a separate function so that we can share
the implementation between both builtins.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agobuiltin/reflog: make functions regarding `reflog_expire_options` public
Patrick Steinhardt [Tue, 8 Apr 2025 06:22:15 +0000 (08:22 +0200)] 
builtin/reflog: make functions regarding `reflog_expire_options` public

Make functions that are required to manage `reflog_expire_options`
available elsewhere by moving them into "reflog.c" and exposing them in
the corresponding header. The functions will be used in a subsequent
commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agobuiltin/reflog: stop storing per-reflog expiry dates globally
Patrick Steinhardt [Tue, 8 Apr 2025 06:22:14 +0000 (08:22 +0200)] 
builtin/reflog: stop storing per-reflog expiry dates globally

As described in the preceding commit, the per-reflog expiry dates are
stored in a global pair of variables. Refactor the code so that they are
contained in `struct reflog_expire_options` to make the structure useful
in other contexts.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agobuiltin/reflog: stop storing default reflog expiry dates globally
Patrick Steinhardt [Tue, 8 Apr 2025 06:22:13 +0000 (08:22 +0200)] 
builtin/reflog: stop storing default reflog expiry dates globally

When expiring reflog entries, it is possible to configure expiry dates
that depend on the name of the reflog. This requires us to store a
couple of different expiry dates:

  - The default expiry date for reflog entries that aren't otherwise
    specified.

  - The per-reflog expiry date.

  - The currently active set of expiry dates for a given reference.

While the last item is stored in `struct reflog_expire_options`, the
other items aren't, which makes it hard to reuse the structure in other
places.

Refactor the code so that the default expiry date is stored as part of
the structure. The per-reflog expiry dates will be adapted accordingly
in the subsequent commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoreflog: rename `cmd_reflog_expire_cb` to `reflog_expire_options`
Patrick Steinhardt [Tue, 8 Apr 2025 06:22:12 +0000 (08:22 +0200)] 
reflog: rename `cmd_reflog_expire_cb` to `reflog_expire_options`

We're about to expose `struct cmd_reflog_expire_cb` via "reflog.h" so
that we can also use this structure in "builtin/gc.c". Once we make it
accessible to a wider scope though it becomes awkwardly named, as it
isn't only useful in the context of a callback. Instead, the function is
containing all kinds of options relevant to whether or not a reflog
entry should be expired.

Rename the structure to `reflog_expire_options` to prepare for this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agosend-email: finer-grained SMTP error handling
Zheng Yuting [Wed, 26 Mar 2025 07:52:46 +0000 (15:52 +0800)] 
send-email: finer-grained SMTP error handling

Code captured errors but did not process them further.
This treated all failures the same without distinguishing SMTP status.

Add handle-smtp_error to extract SMTP status codes using a regex (as
defined in RFC 5321) and handle errors as follows:

- No error present:
- If a result is provided, return 1 to indicate success.
- Otherwise, return 0 to indicate failure.

- Error present with a captured three-digit status code:
- For 4yz (transient errors), return 1 and allow retries.
- For 5yz (permanent errors), return 0 to indicate failure.
- For any other recognized status code, return 1, treating it as
a transient error.

- Error present but no status code found:
- Return 1 as a transient error.

Signed-off-by: Zheng Yuting <05ZYT30@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agosend-email: capture errors in an eval {} block
Zheng Yuting [Wed, 26 Mar 2025 07:52:45 +0000 (15:52 +0800)] 
send-email: capture errors in an eval {} block

Auth relied solely on return values without catching errors. This misjudges
non-credential errors as auth failure without error info.

Patch wraps the entire auth process in an eval {} block to catch
all exceptions, including non-credential errors. It adds a new $error var,
uses 'or do' to prevent flow break, and returns $result ? 1 : 0. And merges
if/else branches, integrates SASL and basic auth, with comments for
future status code handling.

Signed-off-by: Zheng Yuting <05ZYT30@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoThe third batch
Junio C Hamano [Mon, 7 Apr 2025 20:16:23 +0000 (13:16 -0700)] 
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'js/imap-send-peer-cert-verify'
Junio C Hamano [Mon, 7 Apr 2025 21:23:20 +0000 (14:23 -0700)] 
Merge branch 'js/imap-send-peer-cert-verify'

* js/imap-send-peer-cert-verify:
  imap-send: explicitly verify the peer certificate

4 months agoMerge branch 'js/mingw-admins-are-special'
Junio C Hamano [Mon, 7 Apr 2025 21:23:20 +0000 (14:23 -0700)] 
Merge branch 'js/mingw-admins-are-special'

"Dubious ownership" checks on Windows has been tightened up.

* js/mingw-admins-are-special:
  test-tool path-utils: support debugging "dubious ownership" issues
  mingw: special-case administrators even more

4 months agoMerge branch 'tb/bitamp-typofix'
Junio C Hamano [Mon, 7 Apr 2025 21:23:20 +0000 (14:23 -0700)] 
Merge branch 'tb/bitamp-typofix'

Typofix.

* tb/bitamp-typofix:
  pseudo-merge.h: fix a typo

4 months agoMerge branch 'dm/completion-remote-names-fix'
Junio C Hamano [Mon, 7 Apr 2025 21:23:19 +0000 (14:23 -0700)] 
Merge branch 'dm/completion-remote-names-fix'

The bash command line completion script (in contrib/) has been
updated to cope with remote repository nicknames with slashes in
them.

* dm/completion-remote-names-fix:
  completion: fix bugs with slashes in remote names
  completion: add helper to count path components

4 months agoMerge branch 'pw/doc-pack-refs-markup-fix'
Junio C Hamano [Mon, 7 Apr 2025 21:23:19 +0000 (14:23 -0700)] 
Merge branch 'pw/doc-pack-refs-markup-fix'

Doc markup fix.

* pw/doc-pack-refs-markup-fix:
  pack-refs doc: fix indentation for --exclude

4 months agoMerge branch 'pw/build-breaking-changes-doc'
Junio C Hamano [Mon, 7 Apr 2025 21:23:18 +0000 (14:23 -0700)] 
Merge branch 'pw/build-breaking-changes-doc'

A documentation page was left out from formatting and installation,
which has been corrected.

* pw/build-breaking-changes-doc:
  docs: add BreakingChanges to TECH_DOCS target

4 months agoMerge branch 'jh/hash-init-fixes'
Junio C Hamano [Mon, 7 Apr 2025 21:23:18 +0000 (14:23 -0700)] 
Merge branch 'jh/hash-init-fixes'

An earlier code refactoring of the hash machinery missed a few
required calls to init_fn.

* jh/hash-init-fixes:
  index-pack, unpack-objects: restore missing ->init_fn

4 months agoMerge branch 'tb/combine-cruft-below-size'
Junio C Hamano [Mon, 7 Apr 2025 21:23:18 +0000 (14:23 -0700)] 
Merge branch 'tb/combine-cruft-below-size'

"git repack" learned "--combine-cruft-below-size" option that
controls how cruft-packs are combined.

* tb/combine-cruft-below-size:
  repack: begin combining cruft packs with `--combine-cruft-below-size`
  repack: avoid combining cruft packs with `--max-cruft-size`
  t/t7704-repack-cruft.sh: consolidate `write_blob()`
  t/t7704-repack-cruft.sh: clarify wording in --max-cruft-size tests
  t/t5329-pack-objects-cruft.sh: evict 'repack'-related tests

4 months agoMerge branch 'ja/doc-branch-markup'
Junio C Hamano [Mon, 7 Apr 2025 21:23:17 +0000 (14:23 -0700)] 
Merge branch 'ja/doc-branch-markup'

Doc mark-up updates.

* ja/doc-branch-markup:
  doc: apply new format to git-branch man page
  completion: take into account the formatting backticks for options

4 months agoMerge branch 'cc/lop-remote'
Junio C Hamano [Mon, 7 Apr 2025 21:23:17 +0000 (14:23 -0700)] 
Merge branch 'cc/lop-remote'

Bugfix in newly introduced large-object-promisor remote support.

* cc/lop-remote:
  promisor-remote: compare remote names case sensitively
  promisor-remote: fix possible issue when no URL is advertised
  promisor-remote: fix segfault when remote URL is missing
  t5710: arrange to delete the client before cloning

4 months agoMerge branch 'jc/name-rev-stdin'
Junio C Hamano [Mon, 7 Apr 2025 21:23:17 +0000 (14:23 -0700)] 
Merge branch 'jc/name-rev-stdin'

Using "git name-rev --stdin" as an example, improve the framework to
prepare tests to pretend to be in the future where the breaking
changes have already happened.

* jc/name-rev-stdin:
  name-rev: remove "--stdin" support
  t6120: further modernize
  t6120: avoid hiding "git" exit status
  t: introduce WITH_BREAKING_CHANGES prerequisite
  t: extend test_lazy_prereq
  t: document test_lazy_prereq

4 months agoMerge branch 'kn/ci-meson-check-build-docs-fix'
Junio C Hamano [Mon, 7 Apr 2025 21:23:16 +0000 (14:23 -0700)] 
Merge branch 'kn/ci-meson-check-build-docs-fix'

GitHub Actions CI switched on a CI/CD variable that does not exist
when choosing what packages to install etc., which has been
corrected.

* kn/ci-meson-check-build-docs-fix:
  ci/github: add missing 'CI_JOB_IMAGE' env variable

4 months agoMerge branch 'aj/doc-restore-p-update'
Junio C Hamano [Mon, 7 Apr 2025 21:23:16 +0000 (14:23 -0700)] 
Merge branch 'aj/doc-restore-p-update'

Stale description in "git restore -p" documentation has been
updated.

* aj/doc-restore-p-update:
  doc: restore: remove note on --patch w/ pathspecs

4 months agot5605: fix test for cloning from a different user
brian m. carlson [Mon, 31 Mar 2025 21:53:58 +0000 (21:53 +0000)] 
t5605: fix test for cloning from a different user

This test currently passes, but for the wrong reason.  The
repo_is_hardlinked function expects a .git directory or a bare
repository and currently fails because it cannot find the objects
directory.

One solution is to use the --bare argument, but then --show-toplevel
won't work.  We could change that, but there's no need to, so just add
the missing .git directory.

In addition, use the built-in negation functionality of test_grep to
avoid mishandling real errors (such as a missing file) and, as a final
fix, remove the extra newline.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agouserdiff: add builtin driver for INI files
Lucas Seiki Oshiro [Mon, 31 Mar 2025 03:13:09 +0000 (00:13 -0300)] 
userdiff: add builtin driver for INI files

Add a new builtin driver for generic INI files (e. g. the gitconfig
files), where:

- the funcname regular expression matches section names, i. e. any
  string between brackets at the beginning of the line, with or without
  indentation;

- word_regex matches any word with one or more non-whitespace
  characters without checking if it is a valid variable name or value.

Also add tests for the new userdiff driver. These files define sections
and subsections, with and without indentation.

Helped-by: Patrick Steinhardt <ps@pks.im>
Helped-by: D. Ben Knoble <ben.knoble@gmail.com>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agopathspec: fix sign comparison warnings
Arnav Bhate [Sun, 30 Mar 2025 17:45:06 +0000 (23:15 +0530)] 
pathspec: fix sign comparison warnings

There are multiple places, especially in loops, where a signed and an
unsigned data type are compared. Git uses a mix of signed and unsigned
types to store lengths of arrays. This sometimes leads to using a signed
index for an array whose length is stored in an unsigned variable or
vice versa. In some cases, where both signed and unsigned data types
have been used to store lengths of arrays in the same function, only
one variable was used to iterate over both types.

Replace signed data types with unsigned data types and vice versa
wherever necessary. Where both types of iterators are required, move
the declaration inside the for loop. In cases where this is not
possible, add appropriate cast.

Remove #define DISABLE_SIGN_COMPARE_WARNINGS.

Signed-off-by: Arnav Bhate <bhatearnav@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoci: use Visual Studio for win+meson job on GitHub Workflows
Patrick Steinhardt [Mon, 31 Mar 2025 08:33:11 +0000 (10:33 +0200)] 
ci: use Visual Studio for win+meson job on GitHub Workflows

In 7304bd2bc39 (ci: wire up Visual Studio build with Meson, 2025-01-22)
we have wired up a new CI job that builds and tests Git with Meson on a
Windows machine. The expectation here was that this build uses the
Visual Studio toolchain to do so, and that is true on GitLab CI. But on
GitHub Workflows it is not the case because we've got GCC in our PATH,
and thus Meson favors that compiler toolchain over Visual Studio's.

Fix this by explicitly asking Meson to use the Visual Studio toolchain.
While this is only really required for GitHub Workflows, let's also pass
the flag in GitLab CI so that we don't implicitly assume the toolchain
that Meson is going to pick.

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>
4 months agomeson: distinguish build and target host binaries
Patrick Steinhardt [Mon, 31 Mar 2025 08:33:10 +0000 (10:33 +0200)] 
meson: distinguish build and target host binaries

Almost all of the tools we discover during the build process need to be
native programs. There are only a handful of exceptions, which typically
are programs whose paths we need to embed into the resulting executable
so that they can be found on the target system when Git executes. While
this distinction typically doesn't matter, it does start to matter when
considering cross-compilation where the build and target machines are
different.

Meson supports cross-compilation via so-called machine files. These
machine files allow the user to override parameters for the build
machine, but also for the target machine when cross-compiling. Part of
the machine file is a section that allows the user to override the
location where binaries are to be found in the target system. The
following machine file would for example override the path of the POSIX
shell:

    [binaries]
    sh = '/usr/xpg4/bin/sh'

It can be handed over to Meson via `meson setup --cross-file`.

We do not handle this correctly right now though because we don't know
to distinguish binaries for the build and target hosts at all. Address
this by explicitly passing the `native:` parameter to `find_program()`:

  - When set to `true`, we get binaries discovered on the build host.

  - When set to `false`, we get either the path specified in the
    machine file. Or, if no machine file exists or it doesn't specify
    the binary path, then we fall back to the binary discovered on the
    build host.

As mentioned, only a handful of binaries are not native: only the system
shell, Python and Perl need to be treated specially here.

Reported-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomeson: respect 'tests' build option in contrib
Patrick Steinhardt [Mon, 31 Mar 2025 08:33:09 +0000 (10:33 +0200)] 
meson: respect 'tests' build option in contrib

Both the "netrc" credential helper and git-subtree(1) from "contrib/"
carry a couple of tests with them. These tests get wired up in Meson
unconditionally even in the case where `-Dtests=false`. As those tests
depend on the `test_enviroment` variable, which only gets defined in
case `-Dtests=true`, the result is an error:

```
$ meson setup -Dtests=false -Dcontrib=subtree build
[...]

contrib/subtree/meson.build:15:27: ERROR: Unknown variable "test_environment".
```

Fix the issue by not defining these tests at all in case the "tests"
option is set to `false`.

Reported-by: Sam James <sam@gentoo.org>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agogitweb: fix generation of "gitweb.js"
Patrick Steinhardt [Mon, 31 Mar 2025 08:33:08 +0000 (10:33 +0200)] 
gitweb: fix generation of "gitweb.js"

In 19d8fe7da65 (Makefile: extract script to generate gitweb.js,
2024-12-06) we have extracted the logic to build "gitweb.js" into a
separate script. As part of that the rules that builds the script
has gained a new dependency on that script.

This refactoring is broken though because we use "$^" to determine
the set of JavaScript files that need to be concatenated, and this
implicit variable now also contains the build script itself. As a
result, the build script ends up ni the generated "gitweb.js" file,
which is wrong.

Fix the issue by filtering out non-JavaScript files.

Based-on-patch-by: Thorsten Glaser <tg@debian.org>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agomeson: fix handling of '-Dcurl=auto'
Patrick Steinhardt [Mon, 31 Mar 2025 08:33:07 +0000 (10:33 +0200)] 
meson: fix handling of '-Dcurl=auto'

The "curl" option controls whether or not a couple of features that
depend on curl shall be included. Most importantly, these features
include the HTTP remote helpers, which are rather quintessential for a
well-functioning Git installation. So while the dependency can in theory
be dropped, most users wouldn't consider the resulting installation to
be fully functional.

The "curl" option is defined as a feature, which means that it can be
"enabled", "disabled" or "auto", which has the effect that the feature
will be enabled if the dependency itself has been found. While most of
the other features have "auto" as default value, the "curl" option is
set to "enabled" by default due to it being so important. Consequently,
autoconfiguration of Git will fail by default if the library cannot be
found.

There is a bug though with how we handle the option in case the user
overrides the feature with `meson setup -Dcurl=auto`: while we will try
to find the library in that case, we won't ever use it because we later
on check for `get_option('curl').enabled()` when deciding whether or not
we want to build dependent sources. But `enabled()` only returns true if
the option has the value "enabled", for "auto" it will return false.

Fix the issue by instead checking for `curl.found()`, which is only true
if the library has been found. And as we only try to find the library
when `get_option('curl')` returns "true" or "auto" this is exactly what
we want.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agorm: fix sign comparison warnings
Arnav Bhate [Sat, 29 Mar 2025 06:03:14 +0000 (11:33 +0530)] 
rm: fix sign comparison warnings

There are multiple places in loops, where a signed and an
unsigned data type are compared. Git uses a mix of signed and unsigned
types to store lengths of arrays. This sometimes leads to using a signed
index for an array whose length is stored in an unsigned variable or
vice versa.

get_ours_cache_pos is a special case where i, though derived from a
signed variable is never negative. Move this part to the caller side
and make i an unsigned argument of the function. Rename i to
pos to make it descriptive, now that it is a function argument.

Replace signed data types with unsigned data types and vice versa
wherever necessary. Where both signed and unsigned data types have been
used, define a new variable in the scope of the for loop for use as the
iterator. Remove #define DISABLE_SIGN_COMPARE_WARNINGS.

Signed-off-by: Arnav Bhate <bhatearnav@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoThe second batch
Junio C Hamano [Sat, 29 Mar 2025 05:02:33 +0000 (14:02 +0900)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoMerge branch 'hj/doc-rev-list-ancestry-fix'
Junio C Hamano [Sat, 29 Mar 2025 07:39:11 +0000 (16:39 +0900)] 
Merge branch 'hj/doc-rev-list-ancestry-fix'

Doc update.

* hj/doc-rev-list-ancestry-fix:
  doc: add missing commit C to the graph for --ancestry-path=H D..M

4 months agoMerge branch 'es/meson-building-docs-requires-perl'
Junio C Hamano [Sat, 29 Mar 2025 07:39:11 +0000 (16:39 +0900)] 
Merge branch 'es/meson-building-docs-requires-perl'

Build update.

* es/meson-building-docs-requires-perl:
  meson: fix perl detection when docs are enabled, but perl bindings aren't

4 months agoMerge branch 'en/random-cleanups'
Junio C Hamano [Sat, 29 Mar 2025 07:39:10 +0000 (16:39 +0900)] 
Merge branch 'en/random-cleanups'

Miscellaneous code clean-ups.

* en/random-cleanups:
  merge-ort: remove extraneous word in comment
  merge-ort: fix accidental strset<->strintmap
  t7615: be more explicit about diff algorithm used
  t6423: fix a comment that accidentally reversed two commits
  stash: remove merge-recursive.h include

4 months agoMerge branch 'rs/xdiff-context-length-fix'
Junio C Hamano [Sat, 29 Mar 2025 07:39:10 +0000 (16:39 +0900)] 
Merge branch 'rs/xdiff-context-length-fix'

The xdiff code on 32-bit platform misbehaved when an insanely large
context size is given, which has been corrected.

* rs/xdiff-context-length-fix:
  xdiff: avoid arithmetic overflow in xdl_get_hunk()

4 months agoMerge branch 'jk/use-wunreachable-code-for-devs'
Junio C Hamano [Sat, 29 Mar 2025 07:39:10 +0000 (16:39 +0900)] 
Merge branch 'jk/use-wunreachable-code-for-devs'

Enable -Wunreachable-code for developer builds.

* jk/use-wunreachable-code-for-devs:
  config.mak.dev: enable -Wunreachable-code
  git-compat-util: add NOT_CONSTANT macro and use it in atfork_prepare()
  run-command: use errno to check for sigfillset() error

4 months agoMerge branch 'en/diff-rename-follow-fix'
Junio C Hamano [Sat, 29 Mar 2025 07:39:09 +0000 (16:39 +0900)] 
Merge branch 'en/diff-rename-follow-fix'

A corner-case bug in "git log --follow -B" has been fixed.

* en/diff-rename-follow-fix:
  diffcore-rename: fix BUG when break detection and --follow used together

4 months agoMerge branch 'tb/multi-cruft-pack-refresh-fix'
Junio C Hamano [Sat, 29 Mar 2025 07:39:09 +0000 (16:39 +0900)] 
Merge branch 'tb/multi-cruft-pack-refresh-fix'

Certain "cruft" objects would have never been refreshed when there
are multiple cruft packs in the repository, which has been
corrected.

* tb/multi-cruft-pack-refresh-fix:
  builtin/pack-objects.c: freshen objects from existing cruft packs

4 months agoMerge branch 'am/dir-dedup-decl-of-repository'
Junio C Hamano [Sat, 29 Mar 2025 07:39:08 +0000 (16:39 +0900)] 
Merge branch 'am/dir-dedup-decl-of-repository'

Code cleanup.

* am/dir-dedup-decl-of-repository:
  dir.h: remove duplicate forward declaration of struct repository

4 months agoMerge branch 'ps/meson-with-breaking-changes'
Junio C Hamano [Sat, 29 Mar 2025 07:39:08 +0000 (16:39 +0900)] 
Merge branch 'ps/meson-with-breaking-changes'

Update meson based build procedure for breaking changes support.

* ps/meson-with-breaking-changes:
  meson: don't install git-pack-redundant(1) docs with breaking changes
  meson: don't compile git-pack-redundant(1) with breaking changes
  meson: define WITH_BREAKING_CHANGES when enabling breaking changes

4 months agoMerge branch 'jk/fetch-ref-prefix-cleanup'
Junio C Hamano [Sat, 29 Mar 2025 07:39:08 +0000 (16:39 +0900)] 
Merge branch 'jk/fetch-ref-prefix-cleanup'

In protocol v2 where the refs advertisement is constrained, we try
to tell the server side not to limit the advertisement when there
is no specific need to, which has been the source of confusion and
recent bugs.  Revamp the logic to simplify.

* jk/fetch-ref-prefix-cleanup:
  fetch: use ref prefix list to skip ls-refs
  fetch: avoid ls-refs only to ask for HEAD symref update
  fetch: stop protecting additions to ref-prefix list
  fetch: ask server to advertise HEAD for config-less fetch
  refspec_ref_prefixes(): clean up refspec_item logic
  t5516: beef up exact-oid ref prefixes test
  t5516: drop NEEDSWORK about v2 reachability behavior
  t5516: prefer "oid" to "sha1" in some test titles
  t5702: fix typo in test name

4 months agoMerge branch 'ab/decorate-code-cleanup'
Junio C Hamano [Sat, 29 Mar 2025 07:39:07 +0000 (16:39 +0900)] 
Merge branch 'ab/decorate-code-cleanup'

Code clean-up.

* ab/decorate-code-cleanup:
  decorate: fix sign comparison warnings

4 months agoMerge branch 'en/merge-ort-prepare-to-remove-recursive'
Junio C Hamano [Sat, 29 Mar 2025 07:39:07 +0000 (16:39 +0900)] 
Merge branch 'en/merge-ort-prepare-to-remove-recursive'

First step of deprecating and removing merge-recursive.

* en/merge-ort-prepare-to-remove-recursive:
  am: switch from merge_recursive_generic() to merge_ort_generic()
  merge-ort: fix merge.directoryRenames=false
  t3650: document bug when directory renames are turned off
  merge-ort: support having merge verbosity be set to 0
  merge-ort: allow rename detection to be disabled
  merge-ort: add new merge_ort_generic() function

4 months agoMerge branch 'ps/refname-avail-check-optim'
Junio C Hamano [Sat, 29 Mar 2025 07:39:07 +0000 (16:39 +0900)] 
Merge branch 'ps/refname-avail-check-optim'

The code paths to check whether a refname X is available (by seeing
if another ref X/Y exists, etc.) have been optimized.

* ps/refname-avail-check-optim:
  refs: reuse iterators when determining refname availability
  refs/iterator: implement seeking for files iterators
  refs/iterator: implement seeking for packed-ref iterators
  refs/iterator: implement seeking for ref-cache iterators
  refs/iterator: implement seeking for reftable iterators
  refs/iterator: implement seeking for merged iterators
  refs/iterator: provide infrastructure to re-seek iterators
  refs/iterator: separate lifecycle from iteration
  refs: stop re-verifying common prefixes for availability
  refs/files: batch refname availability checks for initial transactions
  refs/files: batch refname availability checks for normal transactions
  refs/reftable: batch refname availability checks
  refs: introduce function to batch refname availability checks
  builtin/update-ref: skip ambiguity checks when parsing object IDs
  object-name: allow skipping ambiguity checks in `get_oid()` family
  object-name: introduce `repo_get_oid_with_flags()`

4 months agoMerge branch 'cc/signed-fast-export-import'
Junio C Hamano [Sat, 29 Mar 2025 07:39:06 +0000 (16:39 +0900)] 
Merge branch 'cc/signed-fast-export-import'

"git fast-export | git fast-import" learns to deal with commit and
tag objects with embedded signatures a bit better.

* cc/signed-fast-export-import:
  fast-export, fast-import: add support for signed-commits
  fast-export: do not modify memory from get_commit_buffer
  git-fast-export.adoc: clarify why 'verbatim' may not be a good idea
  fast-export: rename --signed-tags='warn' to 'warn-verbatim'
  fast-export: fix missing whitespace after switch
  git-fast-import.adoc: add missing LF in the BNF

4 months agomerge-file doc: set conflict-marker-size attribute
Phillip Wood [Fri, 28 Mar 2025 14:45:40 +0000 (14:45 +0000)] 
merge-file doc: set conflict-marker-size attribute

When committing a conflict resolution for a merge containing
1f010d6bdf7 (doc: use .adoc extension for AsciiDoc files, 2025-01-20)
my pre-commit hook failed because "git diff --check" thought there was
a left over conflict marker in "merge-file.adoc". Fix this by setting
the "conflict-marker-size" attribute as we do for all the other
documentation files that contain example conflict markers.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agodetect-compiler: detect clang even if it found CUDA
Johannes Schindelin [Thu, 27 Mar 2025 11:53:03 +0000 (11:53 +0000)] 
detect-compiler: detect clang even if it found CUDA

In my setup, clang finds `/usr/local/cuda` and hence the output of
`clang -v` ends with this line:

Found CUDA installation: /usr/local/cuda, version

This confuses the `detect-compiler` script because it matches _all_
lines that contain the needle "version" surrounded by spaces. As a
consequence, the `get_family` function returns two lines: "Ubuntu clang"
and above-mentioned line, which the `case` statement does not handle
well and hence reports "unknown compiler family" instead of the expected
set of "clang14", "clang13", ..., "clang1" output.

Let's unconfuse the script by letting it parse the first matching line
and ignore the rest.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agoclang: warn when the comma operator is used
Johannes Schindelin [Thu, 27 Mar 2025 11:53:02 +0000 (11:53 +0000)] 
clang: warn when the comma operator is used

When compiling Git using `clang`, the `-Wcomma` option can be used to
warn about code using the comma operator (because it is typically
unintentional and wants to use the semicolon instead).

Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agocompat/regex: explicitly mark intentional use of the comma operator
Johannes Schindelin [Thu, 27 Mar 2025 11:53:01 +0000 (11:53 +0000)] 
compat/regex: explicitly mark intentional use of the comma operator

The comma operator is a somewhat obscure C feature that is often used by
mistake and can even cause unintentional code flow. That is why the
`-Wcomma` option of clang was introduced: To identify unintentional uses
of the comma operator.

In the `compat/regex/` code, the comma operator is used twice, once to
avoid surrounding two conditional statements with curly brackets, the
other one to increment two counters simultaneously in a `do ... while`
condition.

The first one is replaced with a proper conditional block, surrounded by
curly brackets.

The second one would be harder to replace because the loop contains two
`continue`s. Therefore, the second one is marked as intentional by
casting the value-to-discard to `void`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 months agowildmatch: avoid using of the comma operator
Johannes Schindelin [Thu, 27 Mar 2025 11:53:00 +0000 (11:53 +0000)] 
wildmatch: avoid using of the comma operator

The comma operator is a somewhat obscure C feature that is often used by
mistake and can even cause unintentional code flow. That is why the
`-Wcomma` option of clang was introduced: To identify unintentional uses
of the comma operator.

In this instance, the usage is intentional because it allows storing the
value of the current character as `prev_ch` before making the next
character the current one, all of which happens in the loop condition
that lets the loop stop at a closing bracket.

However, it is hard to read.

The chosen alternative to using the comma operator is to move those
assignments from the condition into the loop body; In this particular
case that requires special care because the loop body contains a
`continue` for the case where a character class is found that starts
with `[:` but does not end in `:]` (and the assignments should occur
even when that code path is taken), which needs to be turned into a
`goto`.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>