]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 weeks agot7815: fix unexpectedly passing test on macOS
Patrick Steinhardt [Mon, 2 Jun 2025 06:44:47 +0000 (08:44 +0200)] 
t7815: fix unexpectedly passing test on macOS

In t7815, we have the following test:

    test_expect_failure !CYGWIN 'git grep .fi a' '
        git grep .fi a
    '

The test passes if '.' matches a NUL byte, which we expect to only
happen on Cygwin. The upcoming changes to support parsing TAP output in
Meson surface that this test, surprisingly, passes on macOS as well.

It is unclear how long the test has been passing on macOS already.
064eed36c7f (config.mak.uname: only set NO_REGEX on cygwin for v1.7,
2025-04-17) mentions that the test started to pass for Cygwin. This was
attributed to a new implementation of regcomp(3p) and friends, which was
inherited from FreeBSD. Given the BSD lineage of macOS it is feasible
that it also inherited similar code eventually that made the test pass
now.

It is somewhat dubious what the test actually brings to the table given
that it is quite platform specific. Ideally, we would fix this mess by
having a configure-time check whether regcomp(3p) works as expected,
including NUL bytes, and use our bundled version of the regex library in
case it doesn't. Like this, we could ensure that all platforms work the
same in this edge case and mark the new behaviour as expected.

This change is outside of the scope of this patch series, which only
introduces support for TAP. So instead of fixing the bigger issue,
ignore the test on Darwin like we already do for Cygwin.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 weeks agot/test-lib: fix TAP format for BASH_XTRACEFD warning
Patrick Steinhardt [Mon, 2 Jun 2025 06:44:46 +0000 (08:44 +0200)] 
t/test-lib: fix TAP format for BASH_XTRACEFD warning

When the Bash version is too old to support BASH_XTRACEFD we print a
warning to stderr. This warning is not prefixed with "#", which causes
TAP parsers to (wrongly) interpret the warning as part of the protocol.

Fix this issue by prefixing the warning with a "#" so that it is treated
as comment.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 weeks agot/test-lib: don't print shell traces to stdout
Patrick Steinhardt [Mon, 2 Jun 2025 06:44:45 +0000 (08:44 +0200)] 
t/test-lib: don't print shell traces to stdout

We have several flags like "--verbose", "--verbose-only" or "-x" that
cause us to generate shell traces. The generated tracing output is split
up in these cases so that the test's stdout is printed to file
descriptor 3 whereas its stderr is printed to file descriptor 4.
Depending on which options have been given, we then end up either:

  - Redirecting both file descriptors to a file.

  - Redirecting them to stdout and stderr, respectively.

  - Closing them in case we're running in none-verbose mode.

The second case causes problems though when passing output to a TAP
parser. We print the test's stdout to the console's stdout, and that
results in broken TAP output.

Fix the issue by instead redirecting the test's stdout to the shell's
stderr. This makes it impossible to discern stdout from stderr, but
going by my own experience I never came across a usecase where I would
have needed this distinction.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 weeks agot983*: use prereq to check for Python-specific git-p4(1) support
Patrick Steinhardt [Mon, 2 Jun 2025 06:44:44 +0000 (08:44 +0200)] 
t983*: use prereq to check for Python-specific git-p4(1) support

The tests in t9835 and t9836 verify that git-p4(1) works with both
Python 2 and 3, respectively. To determine whether we have those Python
versions in the first place we create a wrapper script that directly
executes the git-p4(1) script with `python2` or `python3` binaries. We
then condition the execution of tests on whether that wrapper script can
be executed successfully.

The logic that does all of this is not contained in a prerequisite block
though, so the output it generates causes us to break the TAP format.
Refactor the logic to use `test_lazy_prereq()` to fix this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 weeks agot9822: use prereq to check for ISO-8859-1 support
Patrick Steinhardt [Mon, 2 Jun 2025 06:44:43 +0000 (08:44 +0200)] 
t9822: use prereq to check for ISO-8859-1 support

Tests in t9822 depend on filesystem support for ISO-8859-1 encoding. We
thus have a block of code that acts as a prerequisite -- if we fail to
write a file with an ISO-8859-1-encoded file name to disk then we skip
all tests.

When the prerequisite fails though we end up printing an error message
to stderr, which breaks the TAP format. Fix this by converting the code
to a proper prerequisite, which handles output redirection for us.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 weeks agot: silence output from `test_create_repo()`
Patrick Steinhardt [Mon, 2 Jun 2025 06:44:42 +0000 (08:44 +0200)] 
t: silence output from `test_create_repo()`

There are a couple users of `test_create_repo()` that use this function
outside of any test case. This function is nowadays only a thin wrapper
around `git init`, which by default prints a message to stdout that the
repository has been initialized. The resulting output may thus confuse
TAP parsers.

Refactor these users to instead create the repository in a "setup" test
case so that we don't explicitly have to silence them. There's one
exception in t1007: we use `push_repo()` and its `pop_repo()` equivalent
multiple times, so to reduce the noise introduced by this patch we
instead silence this invocation.

While at it, convert callsites to use git-init(1) directly as the
`test_create_repo()` function has been deprecated in f0d4d398e28
(test-lib: split up and deprecate test_create_repo(), 2021-05-10).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 weeks agot: stop announcing prereqs
Patrick Steinhardt [Mon, 2 Jun 2025 06:44:41 +0000 (08:44 +0200)] 
t: stop announcing prereqs

We have a couple of cases where our tests end up announcing that a
certain prerequisite is or isn't fulfilled. While this is supposed to
help the developer it has the downside that it breaks the TAP format.

We could convert these cases to just have a "#" prefix, but it feels
rather unlikely that these are generally useful in the first place. We
already do announce why a specific test is being skipped, so we should
try to use this mechanism to the best extent possible.

Stop announcing these prereqs to fix the TAP format. Where possible,
convert the tests to rely on the prerequisites themselves to announce
why a test ran or didn't ran.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 weeks agoThe sixteenth batch
Junio C Hamano [Mon, 19 May 2025 22:32:53 +0000 (15:32 -0700)] 
The sixteenth batch

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

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

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

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

Leakfix.

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

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

Code cleanup.

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

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

Test update.

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

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

Leakfix.

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

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

Build performance fix.

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

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

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

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

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

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

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

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

Use-after-free fix in the sequencer.

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

5 weeks agoThe fifteenth batch
Junio C Hamano [Fri, 16 May 2025 00:27:23 +0000 (17:27 -0700)] 
The fifteenth batch

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

Workaround for older macOS ld.

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

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

Test fix.

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

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

Meson-based build framework update.

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

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

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

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

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

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

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

6 weeks agoThe fourteenth batch
Junio C Hamano [Tue, 13 May 2025 21:05:18 +0000 (14:05 -0700)] 
The fourteenth batch

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

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

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

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

Docfixes.

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

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

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

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

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

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

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

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

Doc update.

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

6 weeks agoThe thirteenth batch
Junio C Hamano [Mon, 12 May 2025 21:22:59 +0000 (14:22 -0700)] 
The thirteenth batch

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

Meson-based build framework update.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agoreftable: fix perf regression when reading blocks of unwanted type
Patrick Steinhardt [Mon, 12 May 2025 15:15:56 +0000 (17:15 +0200)] 
reftable: fix perf regression when reading blocks of unwanted type

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Work around false positive given by CodeQL.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Here are some examples of valid and invalid labels:

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 weeks agogit-gui: treat the message template file as a built file
Johannes Sixt [Tue, 24 Dec 2024 13:47:08 +0000 (14:47 +0100)] 
git-gui: treat the message template file as a built file

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

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

   make ALL_POFILES=po/xx.po update-po

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

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

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

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

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

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

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

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

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

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

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

Remove those variables.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This patch fixes the following test failure:

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

FreeBSD has the same issue for EMLINK instead of EFTYPE.

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

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

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

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

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

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

Code clean-up for meson-based build infrastructure.

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

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

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

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

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

Update to arm64 Windows port.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 weeks agodir.c: literal match with wildcard in pathspec should still glob
K Jayatheerth [Sat, 3 May 2025 06:07:36 +0000 (11:37 +0530)] 
dir.c: literal match with wildcard in pathspec should still glob

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

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

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

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

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

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

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

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 weeks agobuiltin/mv: bail out when trying to move child and its parent
Patrick Steinhardt [Wed, 30 Apr 2025 12:44:57 +0000 (14:44 +0200)] 
builtin/mv: bail out when trying to move child and its parent

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

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

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

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

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

CI fix.

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

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

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

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

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

A test fix.

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

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

Code clean-up.

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

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

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

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

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

Overhaul of the reftable API.

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

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

Fix for scheduled maintenance tasks on platforms using launchctl.

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

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

Code clean-up.

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

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

Typofix.

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

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

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

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

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

Developer support fix..

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

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

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

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

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

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

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

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

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

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

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

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