Commit Graph

176653 Commits

Author SHA1 Message Date
Johannes Schindelin
ba774ef039 http: disallow NTLM authentication by default
NTLM authentication is relatively weak. This is the case even with the
default setting of modern Windows versions, where NTLMv1 and LanManager
are disabled and only NTLMv2 is enabled: NTLMv2 hashes of even
reasonably complex 8-character passwords can be broken in a matter of
days, given enough compute resources.

Even worse: On Windows, NTLM authentication uses Security Support
Provider Interface ("SSPI"), which provides the credentials without
requiring the user to type them in.

Which means that an attacker could talk an unsuspecting user into
cloning from a server that is under the attacker's control and extracts
the user's NTLMv2 hash without their knowledge.

For that reason, let's disallow NTLM authentication by default.

NTLM authentication is quite simple to set up, though, and therefore
there are still some on-prem Azure DevOps setups out there whose users
and/or automation rely on this type of authentication. To give them an
escape hatch, introduce the `http.<url>.allowNTLMAuth` config setting
that can be set to `true` to opt back into using NTLM for a specific
remote repository.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-10 18:48:07 +00:00
Johannes Schindelin
59840308ea t5563: verify that NTLM authentication works
Although NTLM authentication is considered weak (extending even to
NTLMv2, which purportedly allows brute-forcing reasonably complex
8-character passwords in a matter of days, given ample compute
resources), it _is_ one of the authentication methods supported by
libcurl.

Note: The added test case *cannot* reuse the existing `custom_auth`
facility. The reason is that that facility is backed by an NPH script
("No Parse Headers"), which does not allow handling the 3-phase NTLM
authentication correctly (in my hands, the NPH script would not even be
called upon the Type 3 message, a "200 OK" would be returned, but no
headers, let alone the `git http-backend` output as payload). Having a
separate NTLM authentication script makes the exact workings clearer and
more readable, anyway.

Co-authored-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-10 18:48:07 +00:00
Johannes Schindelin
49bb92ab2c Merge branch 'fixes-from-the-git-mailing-list'
These fixes have been sent to the Git mailing list but have not been
picked up by the Git project yet.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-10 18:48:05 +00:00
Johannes Schindelin
50f6ccaf61 unix-socket: avoid leak when initialization fails
When a Unix socket is initialized, the current directory's path is
stored so that the cleanup code can `chdir()` back to where it was
before exit.

If the path that needs to be stored exceeds the default size of the
`sun_path` attribute of `struct sockaddr_un` (which is defined as a
108-sized byte array on Linux), a larger buffer needs to be allocated so
that it can hold the path, and it is the responsibility of the
`unix_sockaddr_cleanup()` function to release that allocated memory.

In Git's CI, this stack allocation is not necessary because the code is
checked out to `/home/runner/work/git/git`. Concatenate the path
`t/trash directory.t0301-credential-cache/.cache/git/credential/socket`
and a terminating NUL, and you end up with 96 bytes, 12 shy of the
default `sun_path` size.

However, I use worktrees with slightly longer paths:
`/home/me/projects/git/yes/i/nest/worktrees/to/organize/them/` is more
in line with what I have. When I recently tried to locally reproduce a
failure of the `linux-leaks` CI job, this t0301 test failed (where it
had not failed in CI).

The reason: When `credential-cache` tries to reach its daemon initially
by calling `unix_sockaddr_init()`, it is expected that the daemon cannot
be reached (the idea is to spin up the daemon in that case and try
again). However, when this first call to `unix_sockaddr_init()` fails,
the code returns early from the `unix_stream_connect()` function
_without_ giving the cleanup code a chance to run, skipping the
deallocation of above-mentioned path.

The fix is easy: do not return early but instead go directly to the
cleanup code.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-10 18:48:05 +00:00
Jeff King
3e02baaeb8 grep: prevent ^$ false match at end of file
In some implementations, `regexec_buf()` assumes that it is fed lines;
Without `REG_NOTEOL` it thinks the end of the buffer is the end of a
line. Which makes sense, but trips up this case because we are not
feeding lines, but rather a whole buffer. So the final newline is not
the start of an empty line, but the true end of the buffer.

This causes an interesting bug:

  $ echo content >file.txt
  $ git grep --no-index -n '^$' file.txt
  file.txt:2:

This bug is fixed by making the end of the buffer consistently the end
of the final line.

The patch was applied from
https://lore.kernel.org/git/20250113062601.GD767856@coredump.intra.peff.net/

Reported-by: Olly Betts <olly@survex.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-10 18:48:05 +00:00
Git for Windows Build Agent
503891a1b5 Start the merging-rebase to upstream/next
This commit starts the rebase of b799490507 to 75896fcff7
2026-04-10 18:48:03 +00:00
Junio C Hamano
75896fcff7 Sync with 'master' 2026-04-10 10:09:02 -07:00
Junio C Hamano
779546e6a3 Merge branch 'jc/no-writev-does-not-work' into next
We used writev() in limited code paths and supplied emulation for
platforms without working writev(), but the emulation was too
faithful to the spec to make the result useless to send even 64kB;
revert the topic and plan to restart the effort later.

* jc/no-writev-does-not-work:
  Revert "compat/posix: introduce writev(3p) wrapper"
  Revert "wrapper: introduce writev(3p) wrappers"
  Revert "sideband: use writev(3p) to send pktlines"
  Revert "cmake: use writev(3p) wrapper as needed"
2026-04-10 10:08:51 -07:00
Junio C Hamano
cd412a4962 Merge branch 'ps/archive-prefix-doc'
Doc update.

* ps/archive-prefix-doc:
  archive: document --prefix handling of absolute and parent paths
2026-04-10 10:05:33 -07:00
Junio C Hamano
8d0cfa0397 Merge branch 'bc/ref-storage-default-doc-update'
Doc update.

* bc/ref-storage-default-doc-update:
  docs: correct information about reftable
2026-04-10 10:05:32 -07:00
Junio C Hamano
d3b7a9b63d rust: we are way beyond 2.53
Earlier we timelined that we'd tune our build procedures to build
with Rust by default in Git 2.53, but we are already in prerelease
freeze for 2.54 now.  Update the BreakingChanges document to delay
it until Git 2.55 (slated for the end of June 2026).

Noticed-by: brian m. carlson <sandals@crustytoothpaste.net>
Helped-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-10 08:14:20 -07:00
Junio C Hamano
bfedc73f86 writev: retract the topic until we have a better emulation
The emulation layer we added for writev(3p) tries to be too faithful
to the spec that on systems with SSIZE_MAX set to lower than 64kB to
fit a single sideband packet would fail just like the real system
writev(), which makes our use of writev() for sideband messages
unworkable.

Let's revert them and reboot the effort after the release.  The
reverted commits are:

    $ git log -Swritev --oneline 8023abc632^..v2.52.0-rc1
    89152af176 cmake: use writev(3p) wrapper as needed
    26986f4cba sideband: use writev(3p) to send pktlines
    1970fcef93 wrapper: introduce writev(3p) wrappers
    3b9b2c2a29 compat/posix: introduce writev(3p) wrapper

8023abc632 is the merge of ps/upload-pack-buffer-more-writes topic to
the mainline.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-09 15:07:12 -07:00
Junio C Hamano
7798034171 Revert "compat/posix: introduce writev(3p) wrapper"
This reverts commit 3b9b2c2a29a1d529ca9884fa0a6529f6e2496abe; let's
not use writev() for now.
2026-04-09 14:48:24 -07:00
Junio C Hamano
dc1b8b2cc8 Revert "wrapper: introduce writev(3p) wrappers"
This reverts commit 1970fcef93adcc5a35f6468d00a5a634d5af2b3c; let's
not use writev() for now.
2026-04-09 14:48:09 -07:00
Junio C Hamano
74fbd8a571 Revert "sideband: use writev(3p) to send pktlines"
This reverts commit 26986f4cbaf38d84a82b0b35da211389ce49552c; let's
not use writev() for now.
2026-04-09 14:47:51 -07:00
Junio C Hamano
9c30dddefd Revert "cmake: use writev(3p) wrapper as needed"
This reverts commit 89152af176ea94ea8f3249115b6e00827fbbeb70; let's
not use writev() for now.
2026-04-09 14:47:28 -07:00
Junio C Hamano
0fbf48f4d6 Sync with 'master' 2026-04-09 11:24:12 -07:00
Junio C Hamano
ed6aa0e448 Merge branch 'ps/archive-prefix-doc' into next
Doc update.

* ps/archive-prefix-doc:
  archive: document --prefix handling of absolute and parent paths
2026-04-09 11:24:04 -07:00
Junio C Hamano
bb1d626802 Merge branch 'sp/refs-reduce-the-repository' into next
Code clean-up to use the right instance of a repository instance in
calls inside refs subsystem.

* sp/refs-reduce-the-repository:
  refs/reftable-backend: drop uses of the_repository
  refs: remove the_hash_algo global state
  refs: add struct repository parameter in get_files_ref_lock_timeout_ms()
2026-04-09 11:24:04 -07:00
Junio C Hamano
6b423ab8ba Merge branch 'bc/ref-storage-default-doc-update' into next
Doc update.

* bc/ref-storage-default-doc-update:
  docs: correct information about reftable
2026-04-09 11:24:04 -07:00
Junio C Hamano
60f07c4f5c A bit more for -rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-09 11:21:59 -07:00
Junio C Hamano
c343f9cdc2 Merge branch 'ds/rev-list-maximal-only-optim'
"git rev-list --maximal-only" has been optimized by borrowing the
logic used by "git show-branch --independent", which computes the
same kind of information much more efficiently.

* ds/rev-list-maximal-only-optim:
  rev-list: use reduce_heads() for --maximal-only
  p6011: add perf test for rev-list --maximal-only
  t6600: test --maximal-only and --independent
2026-04-09 11:21:59 -07:00
Junio C Hamano
8e04162c18 Merge branch 'kh/doc-config-list'
"git config list" is the official way to spell "git config -l" and
"git config --list".  Use it to update the documentation.

* kh/doc-config-list:
  doc: gitcvs-migration: rephrase “man page”
  doc: replace git config --list/-l with `list`
2026-04-09 11:21:59 -07:00
Junio C Hamano
3eabc358a9 Merge branch 'jk/c23-const-preserving-fixes-more'
Further work to adjust the codebase for C23 that changes functions
like strchr() that discarded constness when they return a pointer into
a const string to preserve constness.

* jk/c23-const-preserving-fixes-more:
  git-compat-util: fix CONST_OUTPARAM typo and indentation
  refs/files-backend: drop const to fix strchr() warning
  http: drop const to fix strstr() warning
  range-diff: drop const to fix strstr() warnings
  pkt-line: make packet_reader.line non-const
  skip_prefix(): check const match between in and out params
  pseudo-merge: fix disk reads from find_pseudo_merge()
  find_last_dir_sep(): convert inline function to macro
  run-command: explicitly cast away constness when assigning to void
  pager: explicitly cast away strchr() constness
  transport-helper: drop const to fix strchr() warnings
  http: add const to fix strchr() warnings
  convert: add const to fix strchr() warnings
2026-04-09 11:21:59 -07:00
Johannes Schindelin
7e509c4476 Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
v2.54.0-rc1.windows.1
2026-04-08 22:05:47 +02:00
Johannes Schindelin
a622b40c35 Merge pull request #2837 from dscho/monitor-component-updates
Start monitoring updates of Git for Windows' component in the open
2026-04-08 22:05:47 +02:00
Johannes Schindelin
f9d2009266 Merge branch 'deprecate-core.useBuiltinFSMonitor'
Originally introduced as `core.useBuiltinFSMonitor` in Git for Windows
and developed, improved and stabilized there, the built-in FSMonitor
only made it into upstream Git (after unnecessarily long hemming and
hawing and throwing overly perfectionist style review sticks into the
spokes) as `core.fsmonitor = true`.

In Git for Windows, with this topic branch, we re-introduce the
now-obsolete config setting, with warnings suggesting to existing users
how to switch to the new config setting, with the intention to
ultimately drop the patch at some stage.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:47 +02:00
Johannes Schindelin
1c46eef87f Merge branch 'phase-out-reset-stdin'
This topic branch re-adds the deprecated --stdin/-z options to `git
reset`. Those patches were overridden by a different set of options in
the upstream Git project before we could propose `--stdin`.

We offered this in MinGit to applications that wanted a safer way to
pass lots of pathspecs to Git, and these applications will need to be
adjusted.

Instead of `--stdin`, `--pathspec-from-file=-` should be used, and
instead of `-z`, `--pathspec-file-nul`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:47 +02:00
Johannes Schindelin
26b5e44954 Merge branch 'un-revert-editor-save-and-reset'
A fix for calling `vim` in Windows Terminal caused a regression and was
reverted. We partially un-revert this, to get the fix again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:46 +02:00
Johannes Schindelin
443fd4cd40 Merge pull request #1170 from dscho/mingw-kill-process
Handle Ctrl+C in Git Bash nicely

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:46 +02:00
Johannes Schindelin
2e4335020c Merge branch 'wsl-file-mode-bits'
This patch introduces support to set special NTFS attributes that are
interpreted by the Windows Subsystem for Linux as file mode bits, UID
and GID.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:46 +02:00
Johannes Schindelin
b1ac73af00 Merge branch 'busybox-w32'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:46 +02:00
Johannes Schindelin
d1f34d3875 Merge pull request #1897 from piscisaureus/symlink-attr
Specify symlink type in .gitattributes
2026-04-08 22:05:46 +02:00
Johannes Schindelin
cf5031e69d mingw: try resetting the read-only bit if rename fails (#4527)
With this patch, Git for Windows works as intended on mounted APFS
volumes (where renaming read-only files would fail).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:46 +02:00
Johannes Schindelin
47175e79d1 SECURITY.md: document Git for Windows' policies
This is the recommended way on GitHub to describe policies revolving around
security issues and about supported versions.

Helped-by: Sven Strickroth <email@cs-ware.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:45 +02:00
Johannes Schindelin
fb6102e619 Merge 'docker-volumes-are-no-symlinks'
This was pull request #1645 from ZCube/master

Support windows container.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:45 +02:00
Philip Oakley
27a847158f Modify the GitHub Pull Request template (to reflect Git for Windows)
Git for Windows accepts pull requests; Core Git does not. Therefore we
need to adjust the template (because it only matches core Git's
project management style, not ours).

Also: direct Git for Windows enhancements to their contributions page,
space out the text for easy reading, and clarify that the mailing list
is plain text, not HTML.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:45 +02:00
Johannes Schindelin
121a16f4c4 Merge branch 'msys2' 2026-04-08 22:05:45 +02:00
Brendan Forster
52b89798a1 Add an issue template
With improvements by Clive Chan, Adric Norris, Ben Bodenmiller and
Philip Oakley.

Helped-by: Clive Chan <cc@clive.io>
Helped-by: Adric Norris <landstander668@gmail.com>
Helped-by: Ben Bodenmiller <bbodenmiller@hotmail.com>
Helped-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Brendan Forster <brendan@github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:45 +02:00
Johannes Schindelin
a9302e6603 Merge branch 'long-paths' 2026-04-08 22:05:45 +02:00
Johannes Schindelin
7157f671db README.md: Add a Windows-specific preamble
Includes touch-ups by 마누엘, Philip Oakley and 孙卓识.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:45 +02:00
Johannes Schindelin
1196f6f746 Merge branch 'gitk-and-git-gui-patches'
These are Git for Windows' Git GUI and gitk patches. We will have to
decide at some point what to do about them, but that's a little lower
priority (as Git GUI seems to be unmaintained for the time being, and
the gitk maintainer keeps a very low profile on the Git mailing list,
too).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:45 +02:00
Derrick Stolee
02208e5211 CONTRIBUTING.md: add guide for first-time contributors
Getting started contributing to Git can be difficult on a Windows
machine. CONTRIBUTING.md contains a guide to getting started, including
detailed steps for setting up build tools, running tests, and
submitting patches to upstream.

[includes an example by Pratik Karki how to submit v2, v3, v4, etc.]

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2026-04-08 22:05:45 +02:00
Johannes Schindelin
8ec31e8f3c Modify the Code of Conduct for Git for Windows
The Git project followed Git for Windows' lead and added their Code of
Conduct, based on the Contributor Covenant v1.4, later updated to v2.0.

We adapt it slightly to Git for Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:45 +02:00
Johannes Schindelin
f54641deb4 Describe Git for Windows' architecture [no ci]
The Git for Windows project has grown quite complex over the years,
certainly much more complex than during the first years where the
`msysgit.git` repository was abusing Git for package management purposes
and the `git/git` fork was called `4msysgit.git`.

Let's describe the status quo in a thorough way.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:45 +02:00
Johannes Schindelin
2d4fafdd9c dependabot: help keeping GitHub Actions versions up to date
See https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot#enabling-dependabot-version-updates-for-actions for details.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:44 +02:00
Victoria Dye
27c9085eaa fsmonitor: reintroduce core.useBuiltinFSMonitor
Reintroduce the 'core.useBuiltinFSMonitor' config setting (originally added
in 0a756b2a25 (fsmonitor: config settings are repository-specific,
2021-03-05)) after its removal from the upstream version of FSMonitor.

Upstream, the 'core.useBuiltinFSMonitor' setting was rendered obsolete by
"overloading" the 'core.fsmonitor' setting to take a boolean value. However,
several applications (e.g., 'scalar') utilize the original config setting,
so it should be preserved for a deprecation period before complete removal:

* if 'core.fsmonitor' is a boolean, the user is correctly using the new
  config syntax; do not use 'core.useBuiltinFSMonitor'.
* if 'core.fsmonitor' is unspecified, use 'core.useBuiltinFSMonitor'.
* if 'core.fsmonitor' is a path, override and use the builtin FSMonitor if
  'core.useBuiltinFSMonitor' is 'true'; otherwise, use the FSMonitor hook
  indicated by the path.

Additionally, for this deprecation period, advise users to switch to using
'core.fsmonitor' to specify their use of the builtin FSMonitor.

Signed-off-by: Victoria Dye <vdye@github.com>
2026-04-08 22:05:44 +02:00
Johannes Schindelin
fd86795aeb reset: reinstate support for the deprecated --stdin option
The `--stdin` option was a well-established paradigm in other commands,
therefore we implemented it in `git reset` for use by Visual Studio.

Unfortunately, upstream Git decided that it is time to introduce
`--pathspec-from-file` instead.

To keep backwards-compatibility for some grace period, we therefore
reinstate the `--stdin` option on top of the `--pathspec-from-file`
option, but mark it firmly as deprecated.

Helped-by: Victoria Dye <vdye@github.com>
Helped-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:44 +02:00
Johannes Schindelin
b128ba4cdb Partially un-revert "editor: save and reset terminal after calling EDITOR"
In e3f7e01b50 (Revert "editor: save and reset terminal after calling
EDITOR", 2021-11-22), we reverted the commit wholesale where the
terminal state would be saved and restored before/after calling an
editor.

The reverted commit was intended to fix a problem with Windows Terminal
where simply calling `vi` would cause problems afterwards.

To fix the problem addressed by the revert, but _still_ keep the problem
with Windows Terminal fixed, let's revert the revert, with a twist: we
restrict the save/restore _specifically_ to the case where `vi` (or
`vim`) is called, and do not do the same for any other editor.

This should still catch the majority of the cases, and will bridge the
time until the original patch is re-done in a way that addresses all
concerns.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:44 +02:00
Johannes Schindelin
893a8e29dc mingw: really handle SIGINT
Previously, we did not install any handler for Ctrl+C, but now we really
want to because the MSYS2 runtime learned the trick to call the
ConsoleCtrlHandler when Ctrl+C was pressed.

With this, hitting Ctrl+C while `git log` is running will only terminate
the Git process, but not the pager. This finally matches the behavior on
Linux and on macOS.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2026-04-08 22:05:44 +02:00