]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
5 months agoA few more before -rc1
Junio C Hamano [Mon, 3 Mar 2025 16:52:50 +0000 (08:52 -0800)] 
A few more before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'ps/build-meson-fixes'
Junio C Hamano [Mon, 3 Mar 2025 16:53:03 +0000 (08:53 -0800)] 
Merge branch 'ps/build-meson-fixes'

CI fix.

* ps/build-meson-fixes:
  gitlab-ci: fix "msvc-meson" test job succeeding despite test failures

5 months agoMerge branch 'ps/meson-contrib-bits'
Junio C Hamano [Mon, 3 Mar 2025 16:53:02 +0000 (08:53 -0800)] 
Merge branch 'ps/meson-contrib-bits'

Update meson-based build procedure to cover contrib/ and other
places as well.

* ps/meson-contrib-bits:
  ci: exercise credential helpers
  ci: fix propagating UTF-8 test locale in musl-based Meson job
  meson: wire up static analysis via Coccinelle
  meson: wire up git-contacts(1)
  meson: wire up credential helpers
  contrib/credential: fix compilation of "osxkeychain" helper
  contrib/credential: fix compiling "libsecret" helper
  contrib/credential: fix compilation of wincred helper with MSVC
  contrib/credential: fix "netrc" tests with out-of-tree builds
  GIT-BUILD-OPTIONS: propagate project's source directory

5 months agoMerge branch 'ms/merge-recursive-string-list-micro-optimization'
Junio C Hamano [Mon, 3 Mar 2025 16:53:02 +0000 (08:53 -0800)] 
Merge branch 'ms/merge-recursive-string-list-micro-optimization'

Rename processing in the recursive merge backend has seen a micro
optimization.

* ms/merge-recursive-string-list-micro-optimization:
  merge-recursive: optimize time complexity for process_renames

5 months agoMerge branch 'lo/doc-merge-submodule-update'
Junio C Hamano [Mon, 3 Mar 2025 16:53:02 +0000 (08:53 -0800)] 
Merge branch 'lo/doc-merge-submodule-update'

What happens to submodules during merge has been documented in a
bit more detail.

* lo/doc-merge-submodule-update:
  merge-strategies.adoc: detail submodule merge

5 months agoMerge branch 'ps/build-meson-fixes-0130'
Junio C Hamano [Mon, 3 Mar 2025 16:53:01 +0000 (08:53 -0800)] 
Merge branch 'ps/build-meson-fixes-0130'

Assorted fixes and improvements to the build procedure based on
meson.

* ps/build-meson-fixes-0130:
  gitlab-ci: restrict maximum number of link jobs on Windows
  meson: consistently use custom program paths to resolve programs
  meson: fix overwritten `git` variable
  meson: prevent finding sed(1) in a loop
  meson: improve handling of `sane_tool_path` option
  meson: improve PATH handling
  meson: drop separate version library
  meson: stop linking libcurl into all executables
  meson: introduce `libgit_curl` dependency
  meson: simplify use of the common-main library
  meson: inline the static 'git' library
  meson: fix OpenSSL fallback when not explicitly required
  meson: fix exec path with enabled runtime prefix

5 months agoMerge branch 'dk/test-aggregate-results-paste-fix'
Junio C Hamano [Mon, 3 Mar 2025 16:53:01 +0000 (08:53 -0800)] 
Merge branch 'dk/test-aggregate-results-paste-fix'

The use of "paste" command for aggregating the test results have
been corrected.

* dk/test-aggregate-results-paste-fix:
  t/aggregate-results: fix paste(1) invocation

5 months agoA bit more post -rc0
Junio C Hamano [Thu, 27 Feb 2025 23:22:47 +0000 (15:22 -0800)] 
A bit more post -rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'jc/3.0-branches-remotes-update'
Junio C Hamano [Thu, 27 Feb 2025 23:23:01 +0000 (15:23 -0800)] 
Merge branch 'jc/3.0-branches-remotes-update'

Removal of ".git/branches" and ".git/remotes" support in the
BreakingChanges document has been further clarified.

* jc/3.0-branches-remotes-update:
  BreakingChanges: clarify branches/ and remotes/

5 months agoMerge branch 'bc/http-push-auth-netrc-fix'
Junio C Hamano [Thu, 27 Feb 2025 23:23:01 +0000 (15:23 -0800)] 
Merge branch 'bc/http-push-auth-netrc-fix'

The netrc support (via the cURL library) for the HTTP transport has
been re-enabled.

* bc/http-push-auth-netrc-fix:
  http: allow using netrc for WebDAV-based HTTP protocol

5 months agoMerge branch 'rs/clear-commit-marks-optim'
Junio C Hamano [Thu, 27 Feb 2025 23:23:00 +0000 (15:23 -0800)] 
Merge branch 'rs/clear-commit-marks-optim'

A micro-optimization.

* rs/clear-commit-marks-optim:
  commit: avoid parent list buildup in clear_commit_marks_many()

5 months agoMerge branch 'pw/rebase-i-ff-empty-commit'
Junio C Hamano [Thu, 27 Feb 2025 23:23:00 +0000 (15:23 -0800)] 
Merge branch 'pw/rebase-i-ff-empty-commit'

"git rebase -i" failed to allow rewording an empty commit that has
been fast-forwarded.

* pw/rebase-i-ff-empty-commit:
  rebase -i: reword empty commit after fast-forward

5 months agoMerge branch 'kn/ref-migrate-skip-reflog'
Junio C Hamano [Thu, 27 Feb 2025 23:23:00 +0000 (15:23 -0800)] 
Merge branch 'kn/ref-migrate-skip-reflog'

"git refs migrate" can optionally be told not to migrate the reflog.

* kn/ref-migrate-skip-reflog:
  builtin/refs: add '--no-reflog' flag to drop reflogs

5 months agoMerge branch 'ua/os-version-capability'
Junio C Hamano [Thu, 27 Feb 2025 23:22:59 +0000 (15:22 -0800)] 
Merge branch 'ua/os-version-capability'

The value of "uname -s" is by default sent over the wire as a part
of the "version" capability.

* ua/os-version-capability:
  agent: advertise OS name via agent capability
  t5701: add setup test to remove side-effect dependency
  version: extend get_uname_info() to hide system details
  version: refactor get_uname_info()
  version: refactor redact_non_printables()
  version: replace manual ASCII checks with isprint() for clarity

5 months agogitlab-ci: fix "msvc-meson" test job succeeding despite test failures
Patrick Steinhardt [Thu, 27 Feb 2025 13:39:22 +0000 (14:39 +0100)] 
gitlab-ci: fix "msvc-meson" test job succeeding despite test failures

We have recently noticed that the "msvc-meson" test job in GitLab CI
succeeds even if there are failures. This is somewhat puzzling because
we use exactly the same command as we do on GitHub Actions, and there
the jobs fail as exected.

As it turns out, this is another weirdness of the GitLab CI hosted
runner for Windows [1]: by default, even successful commands will not
make the job fail. Interestingly though, this depends on what exactly
the command is that you're running -- the MinGW-based job for example
works alright and does fail as expected.

The root cause here seems to be specific behaviour of PowerShell. The
invocation of `ForEach-Object` does not bubble up any errors in case the
invocation of `meson test` fails, and thus we don't notice the error.
This is specific to executing the command in a loop: other build steps
where we execute commands directly fail as expected.

This is because the specific version of PowerShell that we use in the
runner does not know about `PSNativeCommandUseErrorActionPreference`
yet, which controls whether native commands like "meson.exe" honor the
`ErrorActionPreference` variable. The preference has been introduced
with PowerShell 7.3 and is default-enabled since PowerShell 7.4, but
GitLab's hosted runners still seem to use PowerShell 5.1. Consequently,
when tests fail, we won't bubble up the error at all from the loop and
thus the job doesn't fail. This isn't an issue in other cases though
where we execute native commands directly, as the GitLab runner knows to
check the last error code after every command.

The same thing doesn't seem to be an issue on GitHub Actions, most
likely because it uses PowerShell 7.4. Curiously, the preference for
`PSNativeCommandUseErrorActionPreference` is disabled there, but the
jobs fail as expected regardless of that. It's puzzling, but I do not
have enough PowerShell expertise to give a definitive answer as to why
it works there.

In any case, Meson 1.8 will likely get support for slicing tests [1], so
we can eventually get rid of the whole PowerShell script. For now, work
around the issue by explicitly exiting out of the loop with a non-zero
error code if we see that Meson has failed.

[1]: https://github.com/mesonbuild/meson/pull/14092

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agogitlab-ci: restrict maximum number of link jobs on Windows
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:23 +0000 (09:22 +0100)] 
gitlab-ci: restrict maximum number of link jobs on Windows

The hosted Windows runners on GitLab.com only have 7.5GB of RAM. Given
that "link.exe" provided by Microsoft Visual Studio is multi-threaded by
itself already and thus quite memory hungry this can quickly lead to
memory starvation, out-of-memory situations and thus failed CI jobs.

Fix the issue by limiting the number of concurrent linker jobs. The same
issue hasn't been observed on GitHub Actions yet, probably because it
got more than twice the amount of RAM with 16GB.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: consistently use custom program paths to resolve programs
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:22 +0000 (09:22 +0100)] 
meson: consistently use custom program paths to resolve programs

The calls to `find_program()` in our documentation don't use our custom
program path. This variable gets populated on Windows with the location
of Git for Windows so that we can use it to provide our build tools.
Consequently, we may not be able to find all necessary binaries on
Windows.

Adapt the calls to use the program path to fix this. While at it, drop
`required: true` arguments, which are the default anyway.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: fix overwritten `git` variable
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:21 +0000 (09:22 +0100)] 
meson: fix overwritten `git` variable

We're assigning the `git` variable in three places:

  - In "meson.build" to store the external Git executable.

  - In "meson.build" to store the compiled Git executable.

  - In "Documentation/meson.build" to store the external Git executable,
    a second time.

The last case is only needed because we overwrite the original variable
with the built version. Rename the variable used for the built Git
executable so that we don't have to resolve the external Git executable
multiple times.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: prevent finding sed(1) in a loop
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:20 +0000 (09:22 +0100)] 
meson: prevent finding sed(1) in a loop

We're searching for the sed(1) executable in a loop, which will make us
try to find it multiple times. Starting with the preceding commit we
already declare a variable for that program in the top-level build file.
Use it so that we only need to search for the program once.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: improve handling of `sane_tool_path` option
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:19 +0000 (09:22 +0100)] 
meson: improve handling of `sane_tool_path` option

The `sane_tool_path` option can be used to override the PATH variable
from which the build process, tests and ultimately Git will end up
picking programs from. It is currently lacking though because we only
use it to populate the PATH environment variable for executed scripts
and for the `BROKEN_PATH_FIX` mechanism, but we don't use it to find
programs used in the build process itself.

Fix this issue by treating it similar to the Windows-specific paths,
which will make us use it both to find programs and to populate the PATH
environment variable.

To help with this fix, change the type of the option to be an array of
paths, which makes the handling a bit easier for us. It's also the
correct thing to do as the input indeed is a list of paths.

Furthermore, the option now overrides the default behaviour on Windows,
which si to pick up tools from Git for Windows. This is done so that it
becomes easier to override that default behaviour in case it's not
desired.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: improve PATH handling
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:18 +0000 (09:22 +0100)] 
meson: improve PATH handling

When locating programs required for the build we give some special
treatment to Windows systems so that we know to also look up tools
provided by a Git for Windows installation. This ensures that the build
doesn't have any prerequisites other than Microsoft Visual Studio, Meson
and Git for Windows.

Consequently, some of the programs returned by `find_program()` may not
be found via PATH, but via these extra directories. But while Meson can
use these tools directly without any special treatment, any scripts that
we execute may not be able to find those programs. To help them we thus
prepend the directories of a subset of the found programs to PATH.

This doesn't make much sense though: we don't need to prepend PATH for
any program that was found via PATH, but we really only need to do so
for programs located via the extraneous Windows-specific paths. So
instead of prepending all programs paths, we really only need to prepend
the Windows-specific paths.

Adapt the code accordingly by only prepeding Windows-specific paths to
PATH, which both simplifies the code and clarifies intent.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: drop separate version library
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:17 +0000 (09:22 +0100)] 
meson: drop separate version library

When building `libgit.a` we link it against a `libgit_version.a` library
that contains the version information that we inject at build time. The
intent of this is to avoid rebuilding all of `libgit.a` whenever the
version changes. But that wouldn't happen in the first place, as we know
to just rebuild the files that depend on the generated "version-def.h"
file.

This is an artifact of an earlier version of the Meson build infra that
didn't ultimately land. We didn't yet have "version-def.h", and instead
injected the version via preprocessor directives. And here we would have
rebuilt all of `libgit.a` indeed in case the version changes, because
the preprocessor directive applied to all files.

Stop building the separate library and instead add "version-def.h" to
the list of source files directly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: stop linking libcurl into all executables
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:16 +0000 (09:22 +0100)] 
meson: stop linking libcurl into all executables

We set up libcurl via the `libgit_dependencies` variable, which gets
propagated into every user of the `libgit` dependency. This is not
necessary though, as most of our executables aren't even supposed to
link against libcurl.

Fix this by only propagating include directories as a libgit dependency
and propagating the full curl dependency via `libgit_curl`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: introduce `libgit_curl` dependency
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:15 +0000 (09:22 +0100)] 
meson: introduce `libgit_curl` dependency

We've got a set of common source files that we use for those executables
that link against libcurl. The setup is somewhat repetitive though.
Simplify it by declaring a `libgit_curl` dependency that bundles all of
it together.

Note that we don't include curl itself as a dependency. This is because
we already pull it in transitively via the libgit dependency, which is
unfortunate because libgit itself shouldn't actually link against curl
in the first place. This will get fixed in the next commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: simplify use of the common-main library
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:14 +0000 (09:22 +0100)] 
meson: simplify use of the common-main library

The "common-main.c" file is used by multiple executables. In order to
make it easy to set it up we have created a separate library that these
executables can link against. All of these executables also want to link
against `libgit.a` though, which makes it necessary to specify both of
these as dependencies for every executable.

Simplify this a bit by declaring the library as a source dependency:
instead of creating a static library, we now instead compile the common
set of files into each executable separately.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: inline the static 'git' library
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:13 +0000 (09:22 +0100)] 
meson: inline the static 'git' library

When setting up `libgit.a` we first create the static library itself,
and then declare it as part of a dependency such that compile arguments,
include directories and transitive dependencies get propagated to the
users of that library. As such, the static library isn't expected to be
used by anything but the declared dependency.

Inline the static library so that we don't even use a separate variable
for it. This avoids any kind of confusion that may arise and clarifies
how the library is supposed to be used.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: fix OpenSSL fallback when not explicitly required
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:12 +0000 (09:22 +0100)] 
meson: fix OpenSSL fallback when not explicitly required

When OpenSSL isn't provided by the system we know to fall back to the
subproject wrapper. This is especially helpful on Windows systems, where
you typically don't have OpenSSL available, in order to reduce the
number of required dependencies.

The fallback is broken though when the OpenSSL backend is set to 'auto'
as we end up calling `dependency('openssl', required: false)` in that
case, which implicitly disables falling back to the wrapper.

Fix the issue by re-allowing the fallback in case either OpenSSL is
required or in case the backend is set to 'auto'. While at it, fix
reporting of the backend in case the user asked us to pick no HTTPS
backend at all.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: fix exec path with enabled runtime prefix
Patrick Steinhardt [Wed, 26 Feb 2025 08:22:11 +0000 (09:22 +0100)] 
meson: fix exec path with enabled runtime prefix

When the runtime prefix option is enabled, Git is built such that it
knows to locate its binaries relative to the directory a binary is being
executed from. This requires us to figure out relative paths, which is
handled in `system_prefix()` by trying to strip a couple of well-known
paths.

One of these paths, GIT_EXEC_PATH, is expected to be absolute when
runtime prefixes are enabled, but relative otherwise. And while our
Makefile gets this correctly, in Meson we always wire up the absolute
path, which may result in us not being able to find binaries.

Fix this by conditionally injecting the paths depending on whether or
not the `runtime_prefix` option is enabled.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoGit 2.49-rc0 v2.49.0-rc0
Junio C Hamano [Wed, 26 Feb 2025 16:55:18 +0000 (08:55 -0800)] 
Git 2.49-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'jk/check-mailmap-wo-name-fix'
Junio C Hamano [Wed, 26 Feb 2025 16:51:00 +0000 (08:51 -0800)] 
Merge branch 'jk/check-mailmap-wo-name-fix'

"git check-mailmap" segfault fix.

* jk/check-mailmap-wo-name-fix:
  mailmap: fix check-mailmap with full mailmap line

5 months agoMerge branch 'ek/mingw-rename-symlink'
Junio C Hamano [Wed, 26 Feb 2025 16:50:37 +0000 (08:50 -0800)] 
Merge branch 'ek/mingw-rename-symlink'

Symlink renaming fix.

* ek/mingw-rename-symlink:
  compat/mingw: rename the symlink, not the target

5 months agomerge-strategies.adoc: detail submodule merge
Lucas Seiki Oshiro [Tue, 25 Feb 2025 16:18:00 +0000 (13:18 -0300)] 
merge-strategies.adoc: detail submodule merge

Submodule merges are, in general, similar to other merges based on oid
three-way-merge. When a conflict happens, however, Git has two special
cases (introduced in 68d03e4a6e44) on handling the conflict before
yielding it to the user. From the merge-ort and merge-recursive sources:

- "Case #1: a is contained in b or vice versa": both strategies try to
perform a fast-forward in the submodules if the commit referred by the
conflicted submodule is descendant of another;

- "Case #2: There are one or more merges that contain a and b in the
submodule.  If there is only one, then present it as a suggestion to the
user, but leave it marked unmerged so the user needs to confirm the
resolution."

Add a small paragraph on merge-strategies.adoc describing this behavior.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoBreakingChanges: clarify branches/ and remotes/
Junio C Hamano [Tue, 25 Feb 2025 23:45:42 +0000 (15:45 -0800)] 
BreakingChanges: clarify branches/ and remotes/

As we have created an empty .git/branches/ hierarchy until fairly
recently, these directories may be found in modern repositories, but
it is highly unlikely that they are being used.

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoThe fourteenth batch
Junio C Hamano [Tue, 25 Feb 2025 19:54:57 +0000 (11:54 -0800)] 
The fourteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'po/meson-perl-fix'
Junio C Hamano [Tue, 25 Feb 2025 22:19:37 +0000 (14:19 -0800)] 
Merge branch 'po/meson-perl-fix'

Upgrade the minimum Perl version enforced by meson-based build to
match what Makefile-based build uses.

* po/meson-perl-fix:
  meson: fix Perl version check for Meson versions before 1.7.0
  meson: bump minimum required Perl version to 5.26.0

5 months agoMerge branch 'ms/rename-match-name-with-pattern'
Junio C Hamano [Tue, 25 Feb 2025 22:19:36 +0000 (14:19 -0800)] 
Merge branch 'ms/rename-match-name-with-pattern'

Code renaming.

* ms/rename-match-name-with-pattern:
  refspec: clarify function naming and documentation

5 months agoMerge branch 'ad/set-default-target-in-makefiles'
Junio C Hamano [Tue, 25 Feb 2025 22:19:36 +0000 (14:19 -0800)] 
Merge branch 'ad/set-default-target-in-makefiles'

Correct the default target in Documentation/Makefile, and
future-proof all Makefiles from similar breakages by declaring the
default target (which happens to be "all") upfront.

* ad/set-default-target-in-makefiles:
  Makefile: set default goals in makefiles

5 months agoMerge branch 'pw/merge-tree-stdin-deadlock-fix'
Junio C Hamano [Tue, 25 Feb 2025 22:19:36 +0000 (14:19 -0800)] 
Merge branch 'pw/merge-tree-stdin-deadlock-fix'

"git merge-tree --stdin" has been improved (including a workaround
for a deadlock).

* pw/merge-tree-stdin-deadlock-fix:
  merge-tree: fix link formatting in html docs
  merge-tree: improve docs for --stdin
  merge-tree: only use basic merge config
  merge-tree: remove redundant code
  merge-tree --stdin: flush stdout to avoid deadlock

5 months agoMerge branch 'mh/doc-commit-title-not-subject'
Junio C Hamano [Tue, 25 Feb 2025 22:19:36 +0000 (14:19 -0800)] 
Merge branch 'mh/doc-commit-title-not-subject'

The documentation of "git commit" and "git rebase" now refer to
commit titles as such, not "subject".

* mh/doc-commit-title-not-subject:
  doc: use 'title' consistently

5 months agoMerge branch 'bc/diff-reject-empty-arg-to-pickaxe'
Junio C Hamano [Tue, 25 Feb 2025 22:19:35 +0000 (14:19 -0800)] 
Merge branch 'bc/diff-reject-empty-arg-to-pickaxe'

The -G/-S options to the "diff" family of commands caused us to hit
a BUG() when they get no values; they have been corrected.

* bc/diff-reject-empty-arg-to-pickaxe:
  diff: don't crash with empty argument to -G or -S

5 months agoMerge branch 'tb/new-make-fix'
Junio C Hamano [Tue, 25 Feb 2025 22:19:35 +0000 (14:19 -0800)] 
Merge branch 'tb/new-make-fix'

Workaround the overly picky HT/SP rule in newer GNU Make.

* tb/new-make-fix:
  Makefile: remove accidental recipe prefix in conditional

5 months agoMerge branch 'da/xdiff-w-sign-compare-workaround'
Junio C Hamano [Tue, 25 Feb 2025 22:19:35 +0000 (14:19 -0800)] 
Merge branch 'da/xdiff-w-sign-compare-workaround'

Noises from "-Wsign-compare" in the borrowed xdiff code has been
squelched.

* da/xdiff-w-sign-compare-workaround:
  xdiff: avoid signed vs. unsigned comparisons in xutils.c
  xdiff: avoid signed vs. unsigned comparisons in xpatience.c
  xdiff: avoid signed vs. unsigned comparisons in xhistogram.c
  xdiff: avoid signed vs. unsigned comparisons in xemit.c
  xdiff: avoid signed vs. unsigned comparisons in xdiffi.c
  xdiff: move sign comparison warning guard into each file

5 months agot/aggregate-results: fix paste(1) invocation
D. Ben Knoble [Mon, 24 Feb 2025 19:26:02 +0000 (14:26 -0500)] 
t/aggregate-results: fix paste(1) invocation

When running `make test`, when missing prereqs the following is emitted:

    make aggregate-results
    usage: paste [-s] [-d delimiters] file ...
    fixed   1
    success 30066
    failed  0
    broken  218
    total   31274

POSIX says that `paste` requires a file operand; stdin was clearly
intended by 49da404070 (test-lib: show missing prereq summary,
2021-11-20). Use it.

Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agocommit: avoid parent list buildup in clear_commit_marks_many()
René Scharfe [Sun, 23 Feb 2025 08:26:04 +0000 (09:26 +0100)] 
commit: avoid parent list buildup in clear_commit_marks_many()

clear_commit_marks_1() clears the marks of the first parent and its
first parent and so on, and saves the higher numbered parents in a list
for later.  There is no benefit in keeping that list growing with each
handled commit.  Clear it after each run to reduce peak memory usage.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agohttp: allow using netrc for WebDAV-based HTTP protocol
brian m. carlson [Sun, 23 Feb 2025 01:53:31 +0000 (01:53 +0000)] 
http: allow using netrc for WebDAV-based HTTP protocol

For an extended period of time, we've enabled libcurl's netrc
functionality, which will read credentials from the netrc file if none
are provided.  Unfortunately, we have also not documented this fact or
written any tests for it, but people have come to rely on it.

In 610cbc1dfb ("http: allow authenticating proactively", 2024-07-10), we
accidentally broke the ability of users to use the netrc file for the
WebDAV-based HTTP protocol.  Notably, it works on the initial request
but does not work on subsequent requests, which causes failures because
that version of the protocol will necessarily make multiple requests.

This happens because curl_empty_auth_enabled never returns -1, only 0 or
1, and so if http.proactiveAuth is not enabled, the username and
password are always set to empty credentials, which prevents libcurl's
fallback to netrc from working.  However, in other cases, the server
continues to get a 401 response and the credential helper is invoked,
which is the normal behavior, so this was not noticed earlier.

To fix this, change the condition to check for enabling empty auth and
also not having proactive auth enabled, which should result in the
username and password not being set to a single colon in the typical
case, and thus the netrc file being used.

Reported-by: Peter Georg <peter.georg@physik.uni-regensburg.de>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomailmap: fix check-mailmap with full mailmap line
Jacob Keller [Fri, 21 Feb 2025 23:47:58 +0000 (15:47 -0800)] 
mailmap: fix check-mailmap with full mailmap line

I recently had reported to me a crash from a coworker using the recently
added sendemail mailmap support:

  3724814 Segmentation fault      (core dumped) git check-mailmap "bugs@company.xx"

This appears to happen because of the NULL pointer name passed into
map_user(). Fix this by passing "" instead of NULL so that we have a
valid pointer.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoThe thirteenth batch
Junio C Hamano [Fri, 21 Feb 2025 18:35:39 +0000 (10:35 -0800)] 
The thirteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'ac/doc-http-ssl-type-config'
Junio C Hamano [Fri, 21 Feb 2025 18:35:53 +0000 (10:35 -0800)] 
Merge branch 'ac/doc-http-ssl-type-config'

Two configuration variables about SSL authentication material that
weren't mentioned in the documentations are now mentioned.

* ac/doc-http-ssl-type-config:
  docs: indicate http.sslCertType and sslKeyType

5 months agoMerge branch 'en/doc-renormalize'
Junio C Hamano [Fri, 21 Feb 2025 18:35:53 +0000 (10:35 -0800)] 
Merge branch 'en/doc-renormalize'

Doc updates.

* en/doc-renormalize:
  doc: clarify the intent of the renormalize option in the merge machinery

5 months agoMerge branch 'jc/doc-boolean-synonyms'
Junio C Hamano [Fri, 21 Feb 2025 18:35:53 +0000 (10:35 -0800)] 
Merge branch 'jc/doc-boolean-synonyms'

Doc updates.

* jc/doc-boolean-synonyms:
  doc: centrally document various ways tospell `true` and `false`

5 months agoMerge branch 'ua/update-server-info-sans-the-repository'
Junio C Hamano [Fri, 21 Feb 2025 18:35:52 +0000 (10:35 -0800)] 
Merge branch 'ua/update-server-info-sans-the-repository'

Code clean-up.

* ua/update-server-info-sans-the-repository:
  builtin/update-server-info: remove the_repository global variable

5 months agocompat/mingw: rename the symlink, not the target
Eliah Kagan [Fri, 21 Feb 2025 12:01:36 +0000 (12:01 +0000)] 
compat/mingw: rename the symlink, not the target

Since 183ea3ea (Merge branch 'ps/mingw-rename', 2024-11-13),
a new technique is used on Windows to rename files, where supported.
The first step of this technique is to open the file with
`CreateFileW`. At that time, `FILE_ATTRIBUTE_NORMAL` was passed as
the value of the `dwFlagsAndAttributes` argument. In b30404df [2], this
was improved by passing `FILE_FLAG_BACKUP_SEMANTICS`, to support
directories as well as regular files.

However, neither value of `dwFlagsAndAttributes` is sufficient to open
a symbolic link with the correct semantics to rename it. Symlinks on
Windows are reparse points. Attempting to open a reparse point with
`CreateFileW` dereferences the reparse point and opens the target
instead, unless `FILE_FLAG_OPEN_REPARSE_POINT` is included in
`dwFlagsAndAttributes`. This is documented for that flag and in the
"Symbolic Link Behavior" section of the `CreateFileW` docs [3].

This produces a regression where attempting to rename a symlink on
Windows renames its target to the intended new name and location of the
symlink. For example, if `symlink` points to `file`, then running

    git mv symlink symlink-renamed

leaves `symlink` in place and unchanged, but renames `file` to
`symlink-renamed` [4].

This regression is detectable by existing tests in `t7001-mv.sh`, but
the tests must be run by a Windows user with the ability to create
symlinks, and the `ln -s` command used to create the initial symlink
must also be able to create a real symlink (such as by setting the
`MSYS` environment variable to `winsymlinks:nativestrict`). Then
these two tests fail if the regression is present, and pass otherwise:

    38 - git mv should overwrite file with a symlink
    39 - check moved symlink

Let's fix this, so that renaming a symlink again renames the symlink
itself and leaves the target unchanged, by passing

    FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT

as the `dwFlagsAndAttributes` argument. This is sufficient (and safe)
because including `FILE_FLAG_OPEN_REPARSE_POINT` causes no harm even
when used to open a file or directory that is not a reparse point. In
that case, as noted in [3], this flag is simply ignored.

[1]: https://github.com/git-for-windows/git/commit/183ea3eabf81822506d2cd3aa1dc0727099ebccd
[2]: https://github.com/git-for-windows/git/commit/b30404dfc04a4b087b630aea4ab88a51cd3a7459
[3]: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew
[4]: https://github.com/git-for-windows/git/issues/5436

Signed-off-by: Eliah Kagan <eliah.kagan@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agobuiltin/refs: add '--no-reflog' flag to drop reflogs
Karthik Nayak [Fri, 21 Feb 2025 10:04:23 +0000 (11:04 +0100)] 
builtin/refs: add '--no-reflog' flag to drop reflogs

The "git refs migrate" subcommand converts the backend used for ref
storage. It always migrates reflog data as well as refs. Introduce an
option to exclude reflogs from migration, allowing them to be discarded
when they are unnecessary.

This is particularly useful in server-side repositories, where reflogs
are typically not expected. However, some repositories may still have
them due to historical reasons, such as bugs, misconfigurations, or
administrative decisions to enable reflogs for debugging. In such
repositories, it would be optimal to drop reflogs during the migration.

To address this, introduce the '--no-reflog' flag, which prevents reflog
migration. When this flag is used, reflogs from the original reference
backend are migrated. Since only the new reference backend remains in
the repository, all previous reflogs are permanently discarded.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoci: exercise credential helpers
Patrick Steinhardt [Tue, 18 Feb 2025 07:46:00 +0000 (08:46 +0100)] 
ci: exercise credential helpers

Wire up credential helpers in our CI runs so that we can rest assured
that they compile and (if tests are available) function correctly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoci: fix propagating UTF-8 test locale in musl-based Meson job
Patrick Steinhardt [Tue, 18 Feb 2025 07:45:59 +0000 (08:45 +0100)] 
ci: fix propagating UTF-8 test locale in musl-based Meson job

The musl-based Meson job is supposed to explicitly specify the UTF-8
locale used for testing, which has been introduced with 84bb5eeace7 (ci:
switch linux-musl to use Meson, 2025-01-28). That commit had two issues
though:

  - We continue to refer to "linux-musl", even though the job has been
    renamed in the same commit to "linux-musl-meson".

  - We use the wrong option name to specify the locale. This was not
    noticed though due to the first issue.

Fix both of these issues by fixing both the job and option naems.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'master' of https://github.com/j6t/gitk
Junio C Hamano [Thu, 20 Feb 2025 13:59:56 +0000 (05:59 -0800)] 
Merge branch 'master' of https://github.com/j6t/gitk

* 'master' of https://github.com/j6t/gitk:
  gitk: introduce support for the Meson build system
  gitk: extract script to build executable
  gitk: make the "list references" default window width wider
  gitk: fix arrow keys in input fields with Tcl/Tk >= 8.6
  gitk: Use an external icon file on Windows
  gitk: Unicode file name support
  gitk(Windows): avoid inadvertently calling executables in the worktree

5 months agoMerge branch 'pks-meson-support' of https://github.com/pks-t/gitk
Johannes Sixt [Thu, 20 Feb 2025 09:54:37 +0000 (10:54 +0100)] 
Merge branch 'pks-meson-support' of https://github.com/pks-t/gitk

* 'pks-meson-support' of https://github.com/pks-t/gitk:
  gitk: introduce support for the Meson build system
  gitk: extract script to build executable

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
5 months agoMerge branch 'g4w-gitk' of https://github.com/dscho/gitk
Johannes Sixt [Thu, 20 Feb 2025 09:53:53 +0000 (10:53 +0100)] 
Merge branch 'g4w-gitk' of https://github.com/dscho/gitk

* 'g4w-gitk' of https://github.com/dscho/gitk:
  gitk: make the "list references" default window width wider
  gitk: fix arrow keys in input fields with Tcl/Tk >= 8.6
  gitk: Use an external icon file on Windows
  gitk: Unicode file name support
  gitk(Windows): avoid inadvertently calling executables in the worktree

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
5 months agogitk: introduce support for the Meson build system
Patrick Steinhardt [Wed, 19 Feb 2025 12:42:50 +0000 (13:42 +0100)] 
gitk: introduce support for the Meson build system

Upstream Git has introduced support for the Meson build system.
Introduce support for Meson into gitk, as well, so that Git can easily
build its vendored copy of Gitk via a `subproject()` directive. The
instructions can be set up as follows:

  $ meson setup build
  $ meson compile -C build
  $ meson install -C build

Specific options, like for example where Gitk shall be installed to, can
be specified at setup time via `-D`. Available options can be discovered
by running `meson configure` either in the source or build directory.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
5 months agogitk: extract script to build executable
Patrick Steinhardt [Wed, 19 Feb 2025 12:34:30 +0000 (13:34 +0100)] 
gitk: extract script to build executable

Extract the scrip that "builds" Gitk from our Makefile so that we can
reuse it in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
5 months agoagent: advertise OS name via agent capability
Usman Akinyemi [Sat, 15 Feb 2025 15:50:52 +0000 (21:20 +0530)] 
agent: advertise OS name via agent capability

As some issues that can happen with a Git client can be operating system
specific, it can be useful for a server to know which OS a client is
using. In the same way it can be useful for a client to know which OS
a server is using.

Our current agent capability is in the form of "package/version" (e.g.,
"git/1.8.3.1"). Let's extend it to include the operating system name (os)
i.e in the form "package/version-os" (e.g., "git/1.8.3.1-Linux").

Including OS details in the agent capability simplifies implementation,
maintains backward compatibility, avoids introducing a new capability,
encourages adoption across Git-compatible software, and enhances
debugging by providing complete environment information without affecting
functionality. The operating system name is retrieved using the 'sysname'
field of the `uname(2)` system call or its equivalent.

However, there are differences between `uname(1)` (command-line utility)
and `uname(2)` (system call) outputs on Windows. These discrepancies
complicate testing on Windows platforms. For example:
  - `uname(1)` output: MINGW64_NT-10.0-20348.3.4.10-87d57229.x86_64\
  .2024-02-14.20:17.UTC.x86_64
  - `uname(2)` output: Windows.10.0.20348

On Windows, uname(2) is not actually system-supplied but is instead
already faked up by Git itself. We could have overcome the test issue
on Windows by implementing a new `uname` subcommand in `test-tool`
using uname(2), but except uname(2), which would be tested against
itself, there would be nothing platform specific, so it's just simpler
to disable the tests on Windows.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: fix Perl version check for Meson versions before 1.7.0
Peter Oliver [Tue, 18 Feb 2025 15:30:43 +0000 (15:30 +0000)] 
meson: fix Perl version check for Meson versions before 1.7.0

Command `perl --version` says, e.g., “This is perl 5, version 26,
subversion 0 (v5.26.0)”, which older versions of Meson interpret as
version 26.

This will be fixed in Meson 1.7.0, but at the time of writing that isn’t
yet released.

If we run `perl -V:version` we get the unambiguous response
“version='5.26.0';”, but we need at least Meson 1.5.0 to be able to do that.

Note that Perl are seriously considering dropping the leading 5 entirely
in the near future (https://perl.github.io/PPCs/ppc0025-perl-version/),
but that shouldn’t affect us.

Signed-off-by: Peter Oliver <git@mavit.org.uk>
Co-authored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: bump minimum required Perl version to 5.26.0
Peter Oliver [Tue, 18 Feb 2025 15:30:42 +0000 (15:30 +0000)] 
meson: bump minimum required Perl version to 5.26.0

Commit 702d8c1f3b (Require Perl 5.26.0, 2024-10-23) dropped support
for Perl versions older than 5.26.0. The Meson build system, which
has been developed in parallel to that commit, hasn't been bumped
accordingly and thus still requires Perl 5.8.1 or newer.

Fix this by requiring Perl 5.26.0 or newer with Meson.

Signed-off-by: Peter Oliver <git@mavit.org.uk>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoThe twelfth batch
Junio C Hamano [Tue, 18 Feb 2025 23:02:31 +0000 (15:02 -0800)] 
The twelfth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'bc/contrib-thunderbird-patch-inline-fix'
Junio C Hamano [Tue, 18 Feb 2025 23:30:33 +0000 (15:30 -0800)] 
Merge branch 'bc/contrib-thunderbird-patch-inline-fix'

A thunderbird helper script lost its bashism.

* bc/contrib-thunderbird-patch-inline-fix:
  thunderbird-patch-inline: avoid bashism

5 months agoMerge branch 'lo/t7603-path-is-file-update'
Junio C Hamano [Tue, 18 Feb 2025 23:30:33 +0000 (15:30 -0800)] 
Merge branch 'lo/t7603-path-is-file-update'

Test clean-up.

* lo/t7603-path-is-file-update:
  t7603: replace test -f by test_path_is_file

5 months agoMerge branch 'da/difftool-sans-the-repository'
Junio C Hamano [Tue, 18 Feb 2025 23:30:32 +0000 (15:30 -0800)] 
Merge branch 'da/difftool-sans-the-repository'

"git difftool" code clean-up.

* da/difftool-sans-the-repository:
  difftool: eliminate use of USE_THE_REPOSITORY_VARIABLE
  difftool: eliminate use of the_repository
  difftool: eliminate use of global variables

5 months agoMerge branch 'jt/rev-list-missing-print-info'
Junio C Hamano [Tue, 18 Feb 2025 23:30:32 +0000 (15:30 -0800)] 
Merge branch 'jt/rev-list-missing-print-info'

"git rev-list --missing=" learned to accept "print-info" that gives
known details expected of the missing objects, like path and type.

* jt/rev-list-missing-print-info:
  rev-list: extend print-info to print missing object type
  rev-list: add print-info action to print missing object path

5 months agoMerge branch 'ps/send-pack-unhide-error-in-atomic-push'
Junio C Hamano [Tue, 18 Feb 2025 23:30:32 +0000 (15:30 -0800)] 
Merge branch 'ps/send-pack-unhide-error-in-atomic-push'

"git push --atomic --porcelain" used to ignore failures from the
other side, losing the error status from the child process, which
has been corrected.

* ps/send-pack-unhide-error-in-atomic-push:
  send-pack: gracefully close the connection for atomic push
  t5543: atomic push reports exit code failure
  send-pack: new return code "ERROR_SEND_PACK_BAD_REF_STATUS"
  t5548: add porcelain push test cases for dry-run mode
  t5548: add new porcelain test cases
  t5548: refactor test cases by resetting upstream
  t5548: refactor to reuse setup_upstream() function
  t5504: modernize test by moving heredocs into test bodies

5 months agoMerge branch 'ds/backfill'
Junio C Hamano [Tue, 18 Feb 2025 23:30:31 +0000 (15:30 -0800)] 
Merge branch 'ds/backfill'

Lazy-loading missing files in a blobless clone on demand is costly
as it tends to be one-blob-at-a-time.  "git backfill" is introduced
to help bulk-download necessary files beforehand.

* ds/backfill:
  backfill: assume --sparse when sparse-checkout is enabled
  backfill: add --sparse option
  backfill: add --min-batch-size=<n> option
  backfill: basic functionality and tests
  backfill: add builtin boilerplate

5 months agomeson: wire up static analysis via Coccinelle
Patrick Steinhardt [Tue, 18 Feb 2025 07:45:56 +0000 (08:45 +0100)] 
meson: wire up static analysis via Coccinelle

Wire up static analysis via Coccinelle via a new test target
"coccicheck". This target can be executed via `meson compile coccicheck`
and generates the semantic patch for us.

Note that we don't hardcode the list of source and header files that
shall be analyzed, and instead use git-ls-files(1) to find them for us.
This is because we also want to analyze files that may not get built on
the current platform, so finding all sources at configure time is easier
than introducing a new variable that tracks all sources, including those
which aren't being built.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: wire up git-contacts(1)
Patrick Steinhardt [Tue, 18 Feb 2025 07:45:55 +0000 (08:45 +0100)] 
meson: wire up git-contacts(1)

Wire up the build for git-contacts(1) in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomeson: wire up credential helpers
Patrick Steinhardt [Tue, 18 Feb 2025 07:45:54 +0000 (08:45 +0100)] 
meson: wire up credential helpers

We've got a couple of credential helpers in "contrib/credential", all
of which aren't yet wired up via Meson. Do so.

Note that ideally, we'd also wire up t0303 to be executed with each of
the credential helpers to verify their functionality. Unfortunately
though, none of them pass the test suite right now, so this is left for
a future change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agocontrib/credential: fix compilation of "osxkeychain" helper
Patrick Steinhardt [Tue, 18 Feb 2025 07:45:53 +0000 (08:45 +0100)] 
contrib/credential: fix compilation of "osxkeychain" helper

The "osxkeychain" helper does not compile due to a warning generated by
the unused `argc` parameter. Fix the warning by checking for the minimum
number of required arguments explicitly in the least restrictive way
possible.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agocontrib/credential: fix compiling "libsecret" helper
Patrick Steinhardt [Tue, 18 Feb 2025 07:45:52 +0000 (08:45 +0100)] 
contrib/credential: fix compiling "libsecret" helper

The "libsecret" credential helper does not compile when developer
warnings are enabled due to three warnings:

    - contrib/credential/libsecret/git-credential-libsecret.c:78:1:
      missing initializer for field ‘reserved’ of ‘SecretSchema’
      [-Werror=missing-field-initializers]. This issue is fixed by using
      designated initializers.

    - contrib/credential/libsecret/git-credential-libsecret.c:171:43:
      comparison of integer expressions of different signedness: ‘int’
      and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]. This
      issue is fixed by using an unsigned variable to iterate through
      the string vector.

    - contrib/credential/libsecret/git-credential-libsecret.c:420:14:
      unused parameter ‘argc’ [-Werror=unused-parameter]. This issue is
      fixed by checking the number of arguments, but in the least
      restrictive way possible.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agocontrib/credential: fix compilation of wincred helper with MSVC
M Hickford [Tue, 18 Feb 2025 07:45:51 +0000 (08:45 +0100)] 
contrib/credential: fix compilation of wincred helper with MSVC

The git-credential-wincred helper does not compile on Windows with
Microsoft Visual Studio because of our use of `__attribute__()`, which
its compiler doesn't support. While the rest of our codebase would know
to handle this because we redefine the macro in "compat/msvc.h", this
stub isn't available here because we don't include "git-compat-util.h"
in the first place.

Fix the issue by making the attribute depend on the `_MSC_VER`
preprocessor macro.

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agocontrib/credential: fix "netrc" tests with out-of-tree builds
Patrick Steinhardt [Tue, 18 Feb 2025 07:45:50 +0000 (08:45 +0100)] 
contrib/credential: fix "netrc" tests with out-of-tree builds

Tests of the "netrc" credential helper aren't prepared to handle
out-of-tree builds:

  - They expect the "test.pl" script to be located relative to the build
    directory, even though it is located in the source directory.

  - They expect the built "git-credential-netrc" helper to be located
    relative to the "test.pl" file, evne though it is loated in the
    build directory.

This works alright as long as source and build directories are the same,
but starts to break apart with Meson.

Fix these first issue by using the new "GIT_SOURCE_DIR" variable to
locate the test script itself. And fix the second issue by introducing a
new environment variable "CREDENTIAL_NETRC_PATH" that can be set for
out-of-tree builds to locate the built credential helper.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoGIT-BUILD-OPTIONS: propagate project's source directory
Patrick Steinhardt [Tue, 18 Feb 2025 07:45:49 +0000 (08:45 +0100)] 
GIT-BUILD-OPTIONS: propagate project's source directory

A couple of our tests require knowledge around where to find the
project's source directory in order to locate files required for the
test itself. Until now we have been wiring these up ad-hoc via new,
specialized variables catered to the specific usecase. This is quite
awkward though, as every test that potentially needs to locate paths
relative to the source directory needs to grow another variable.

Introduce a new "GIT_SOURCE_DIR" variable into GIT-BUILD-OPTIONS to stop
this proliferation. Remove existing variables that can be derived from
it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agodiff: don't crash with empty argument to -G or -S
brian m. carlson [Mon, 17 Feb 2025 17:57:59 +0000 (17:57 +0000)] 
diff: don't crash with empty argument to -G or -S

The pickaxe options, -G and -S, need either a regex or a string to look
through the history for.  An empty value isn't very useful since it
would either match everything or nothing, and what's worse, we presently
crash with a BUG like so when the user provides one:

    BUG: diffcore-pickaxe.c:241: should have needle under -G or -S

Since it's not very nice of us to crash and this wouldn't do anything
useful anyway, let's simply inform the user that they must provide a
non-empty argument and exit with an error if they provide an empty one
instead.

Reported-by: Jared Van Bortel <cebtenzzre@gmail.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agodoc: use 'title' consistently
M Hickford [Sun, 16 Feb 2025 21:02:41 +0000 (21:02 +0000)] 
doc: use 'title' consistently

The first line of a commit message is variously called 'title' or
'subject'.

Prefer 'title' unless discussing email.

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomerge-tree: fix link formatting in html docs
Phillip Wood [Tue, 18 Feb 2025 16:24:39 +0000 (16:24 +0000)] 
merge-tree: fix link formatting in html docs

In the html documentation the link to the "OUTPUT" section is surrounded
by square brackets. Fix this by adding explicit link text to the cross
reference.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomerge-tree: improve docs for --stdin
Phillip Wood [Tue, 18 Feb 2025 16:24:38 +0000 (16:24 +0000)] 
merge-tree: improve docs for --stdin

Add a section for --stdin in the list of options and document that it
implies -z so readers know how to parse the output. Also correct the
merge status documentation for --stdin as if the status is less than
zero "git merge-tree" dies before printing it.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomerge-tree: only use basic merge config
Phillip Wood [Tue, 18 Feb 2025 16:24:37 +0000 (16:24 +0000)] 
merge-tree: only use basic merge config

Commit 9c93ba4d0ae (merge-recursive: honor diff.algorithm, 2024-07-13)
replaced init_merge_options() with init_basic_merge_config() for use in
plumbing commands and init_ui_merge_config() for use in porcelain
commands. As "git merge-tree" is a plumbing command it should call
init_basic_merge_config() rather than init_ui_merge_config(). The merge
ort machinery ignores "diff.algorithm" so the behavior is unchanged by
this commit but it future proofs us against any future changes to
init_ui_merge_config().

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomerge-tree: remove redundant code
Phillip Wood [Tue, 18 Feb 2025 16:24:36 +0000 (16:24 +0000)] 
merge-tree: remove redundant code

real_merge() only ever returns "0" or "1" as it dies if the merge status
is less than zero. Therefore the check for "result < 0" is redundant and
the result variable is not needed. The return value of real_merge() is
ignored because exit status of "git merge-tree --stdin" is "0" for both
successful and conflicted merges (the status of each merge is written to
stdout). The return type of real_merge() is not changed as it is used
for the program's exit status when "--stdin" is not given.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agomerge-tree --stdin: flush stdout to avoid deadlock
Phillip Wood [Tue, 18 Feb 2025 16:24:35 +0000 (16:24 +0000)] 
merge-tree --stdin: flush stdout to avoid deadlock

If a process tries to read the output from "git merge-tree --stdin"
before it closes merge-tree's stdin then it deadlocks. This happens
because merge-tree does not flush its output before trying to read
another line of input and means that it is not possible to cherry-pick a
sequence of commits using "git merge-tree --stdin". Fix this by calling
maybe_flush_or_die() before trying to read the next line of
input. Flushing the output after each merge does not seem to affect the
performance, any difference is lost in the noise even after increasing
the number of runs.

$ git rev-list --merges --parents -n100 origin/master |
sed 's/^[^ ]* //' >/tmp/merges
$ hyperfine -L flush 0,1 --warmup 1 --runs 30 \
'GIT_FLUSH={flush} ./git merge-tree --stdin </tmp/merges'
Benchmark 1: GIT_FLUSH=0 ./git merge-tree --stdin </tmp/merges
  Time (mean ± σ):     546.6 ms ±  11.7 ms    [User: 503.2 ms, System: 40.9 ms]
  Range (min … max):   535.9 ms … 567.7 ms    30 runs

Benchmark 2: GIT_FLUSH=1 ./git merge-tree --stdin </tmp/merges
  Time (mean ± σ):     546.9 ms ±  12.0 ms    [User: 505.9 ms, System: 38.9 ms]
  Range (min … max):   529.8 ms … 570.0 ms    30 runs

Summary
  'GIT_FLUSH=0 ./git merge-tree --stdin </tmp/merges' ran
    1.00 ± 0.03 times faster than 'GIT_FLUSH=1 ./git merge-tree --stdin </tmp/merges'

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agorefspec: clarify function naming and documentation
Meet Soni [Sat, 15 Feb 2025 08:45:39 +0000 (14:15 +0530)] 
refspec: clarify function naming and documentation

Rename `match_name_with_pattern()` to `match_refname_with_pattern()` to
better reflect its purpose and improve documentation comment clarity.
The previous function name and parameter names were inconsistent, making
it harder to understand their roles in refspec matching.

- Rename parameters:
  - `key` -> `pattern` (globbing pattern to match)
  - `name` -> `refname` (refname to check)
  - `value` -> `replacement` (replacement mapping pattern)

Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agot5701: add setup test to remove side-effect dependency
Usman Akinyemi [Sat, 15 Feb 2025 15:50:51 +0000 (21:20 +0530)] 
t5701: add setup test to remove side-effect dependency

Currently, the "test capability advertisement" test creates some files
with expected content which are used by other tests below it.

To remove that side-effect from this test, let's split up part of
it into a "setup"-type test which creates the files with expected content
which gets reused by multiple tests. This will be useful in a following
commit.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoversion: extend get_uname_info() to hide system details
Usman Akinyemi [Sat, 15 Feb 2025 15:50:50 +0000 (21:20 +0530)] 
version: extend get_uname_info() to hide system details

Currently, get_uname_info() function provides the full OS information.
In a following commit, we will need it to provide only the OS name.

Let's extend it to accept a "full" flag that makes it switch between
providing full OS information and providing only the OS name.

We may need to refactor this function in the future if an
`osVersion.format` is added.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoversion: refactor get_uname_info()
Usman Akinyemi [Sat, 15 Feb 2025 15:50:49 +0000 (21:20 +0530)] 
version: refactor get_uname_info()

Some code from "builtin/bugreport.c" uses uname(2) to get system
information.

Let's refactor this code into a new get_uname_info() function, so
that we can reuse it in a following commit.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoversion: refactor redact_non_printables()
Usman Akinyemi [Sat, 15 Feb 2025 15:50:48 +0000 (21:20 +0530)] 
version: refactor redact_non_printables()

The git_user_agent_sanitized() function performs some sanitizing to
avoid special characters being sent over the line and possibly messing
up with the protocol or with the parsing on the other side.

Let's extract this sanitizing into a new redact_non_printables() function,
as we will want to reuse it in a following patch.

For now the new redact_non_printables() function is still static as
it's only needed locally.

While at it, let's use strbuf_detach() to explicitly detach the string
contained by the 'buf' strbuf.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoversion: replace manual ASCII checks with isprint() for clarity
Usman Akinyemi [Sat, 15 Feb 2025 15:50:47 +0000 (21:20 +0530)] 
version: replace manual ASCII checks with isprint() for clarity

Since the isprint() function checks for printable characters, let's
replace the existing hardcoded ASCII checks with it. However, since
the original checks also handled spaces, we need to account for spaces
explicitly in the new check.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMakefile: set default goals in makefiles
Adam Dinwoodie [Sat, 15 Feb 2025 21:19:03 +0000 (21:19 +0000)] 
Makefile: set default goals in makefiles

Explicitly set the default goal at the very top of various makefiles.
This is already present in some makefiles, but not all of them.

In particular, this corrects a regression introduced in a38edab7c8
(Makefile: generate doc versions via GIT-VERSION-GEN, 2024-12-06).  That
commit added some config files as build targets for the Documentation
directory, and put the target configuration in a sensible place.
Unfortunately, that sensible place was above any other build target
definitions, meaning the default goal changed to being those
configuration files only, rather than the HTML and man page
documentation.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Helped-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoThe eleventh batch
Junio C Hamano [Sat, 15 Feb 2025 01:53:32 +0000 (17:53 -0800)] 
The eleventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 months agoMerge branch 'ps/doc-http-upload-archive-service'
Junio C Hamano [Sat, 15 Feb 2025 01:53:49 +0000 (17:53 -0800)] 
Merge branch 'ps/doc-http-upload-archive-service'

Doc update.

* ps/doc-http-upload-archive-service:
  doc: documentation for http.uploadarchive config option

5 months agoMerge branch 'kn/reflog-migration-fix-followup'
Junio C Hamano [Sat, 15 Feb 2025 01:53:48 +0000 (17:53 -0800)] 
Merge branch 'kn/reflog-migration-fix-followup'

Code clean-up.

* kn/reflog-migration-fix-followup:
  reftable: prevent 'update_index' changes after adding records
  refs: use 'uint64_t' for 'ref_update.index'
  refs: mark `ref_transaction_update_reflog()` as static

5 months agoMerge branch 'bf/fetch-set-head-fix'
Junio C Hamano [Sat, 15 Feb 2025 01:53:48 +0000 (17:53 -0800)] 
Merge branch 'bf/fetch-set-head-fix'

Fetching into a bare repository incorrectly assumed it always used
a mirror layout when deciding to update remote-tracking HEAD, which
has been corrected.

* bf/fetch-set-head-fix:
  fetch set_head: fix non-mirror remotes in bare repositories
  fetch set_head: refactor to use remote directly

5 months agoMerge branch 'op/worktree-is-main-bare-fix'
Junio C Hamano [Sat, 15 Feb 2025 01:53:48 +0000 (17:53 -0800)] 
Merge branch 'op/worktree-is-main-bare-fix'

Going into a secondary worktree and asking "is the main worktree
bare?" did not work correctly when per-worktree configuration
option was in use, which has been corrected.

* op/worktree-is-main-bare-fix:
  worktree: detect from secondary worktree if main worktree is bare

5 months agoMerge branch 'tc/clone-single-revision'
Junio C Hamano [Sat, 15 Feb 2025 01:53:47 +0000 (17:53 -0800)] 
Merge branch 'tc/clone-single-revision'

"git clone" learned to make a shallow clone for a single commit
that is not necessarily be at the tip of any branch.

* tc/clone-single-revision:
  builtin/clone: teach git-clone(1) the --revision= option
  parse-options: introduce die_for_incompatible_opt2()
  clone: introduce struct clone_opts in builtin/clone.c
  clone: add tags refspec earlier to fetch refspec
  clone: refactor wanted_peer_refs()
  clone: make it possible to specify --tags
  clone: cut down on global variables in clone.c

5 months agoMerge branch 'bc/doc-adoc-not-txt'
Junio C Hamano [Sat, 15 Feb 2025 01:53:47 +0000 (17:53 -0800)] 
Merge branch 'bc/doc-adoc-not-txt'

All the documentation .txt files have been renamed to .adoc to help
content aware editors.

* bc/doc-adoc-not-txt:
  Remove obsolete ".txt" extensions for AsciiDoc files
  doc: use .adoc extension for AsciiDoc files
  gitattributes: mark AsciiDoc files as LF-only
  editorconfig: add .adoc extension
  doc: update gitignore for .adoc extension

5 months agomerge-recursive: optimize time complexity for process_renames
Meet Soni [Fri, 14 Feb 2025 04:41:29 +0000 (10:11 +0530)] 
merge-recursive: optimize time complexity for process_renames

Avoid O(n^2) complexity in `process_renames()` when building a sorted
`string_list` by constructing it unsorted and sorting it afterward,
reducing the complexity to O(n log n).

Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>