Commit Graph

131512 Commits

Author SHA1 Message Date
Victoria Dye
c14ffc9c2b subtree: update contrib/subtree test target
The intention of this change is to align with how the top-level git
`Makefile` defines its own test target (which also internally calls
`$(MAKE) -C t/ all`). This change also ensures the consistency of
`make -C contrib/subtree test` with other testing in CI executions
(which rely on `$DEFAULT_TEST_TARGET` being defined as `prove`).

Signed-off-by: Victoria Dye <vdye@github.com>
2022-04-18 08:29:42 -07:00
Victoria Dye
f38a3880ac Start the merging-rebase to v2.36.0-rc2
This commit starts the rebase of 9c975963d6 to f19a303fdf
2022-04-18 08:29:40 -07:00
Derrick Stolee
56cb39bb4a Merge pull request #3791: Various fixes around safe.directory
The first three commits are rebased versions of those in gitgitgadget/git#1215. These allow the following:

1. Fix `git config --global foo.bar <path>` from allowing the `<path>`. As a bonus, users with a config value starting with `/` will not get a warning about "old-style" paths needing a "`%(prefix)/`".

2. When in WSL, the path starts with `/` so it needs to be interpolated properly. Update the warning to include `%(prefix)/` to get the right value for WSL users. (This is specifically for using Git for Windows from Git Bash, but in a WSL directory.)

3. When using WSL, the ownership check fails and reports an error message. This is noisy, and happens even if the user has marked the path with `safe.directory`. Remove that error message.
2022-04-13 17:41:49 -04:00
Derrick Stolee
109ae350a0 compat/mingw.c: do not warn when failing to get owner
In the case of Git for Windows (say, in a Git Bash window) running in a
Windows Subsystem for Linux (WSL) directory, the GetNamedSecurityInfoW()
call in is_path_owned_By_current_side() returns an error code other than
ERROR_SUCCESS. This is consistent behavior across this boundary.

In these cases, the owner would always be different because the WSL
owner is a different entity than the Windows user.

The change here is to suppress the error message that looks like this:

  error: failed to get owner for '//wsl.localhost/...' (1)

Before this change, this warning happens for every Git command,
regardless of whether the directory is marked with safe.directory.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-04-13 15:55:10 -04:00
Derrick Stolee
e64daf281c setup: properly use "%(prefix)/" when in WSL
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-04-13 15:55:10 -04:00
Derrick Stolee
93310f0ac0 setup: opt-out of check with safe.directory=*
With the addition of the safe.directory in 8959555ce
(setup_git_directory(): add an owner check for the top-level directory,
2022-03-02) released in v2.35.2, we are receiving feedback from a
variety of users about the feature.

Some users have a very large list of shared repositories and find it
cumbersome to add this config for every one of them.

In a more difficult case, certain workflows involve running Git commands
within containers. The container boundary prevents any global or system
config from communicating `safe.directory` values from the host into the
container. Further, the container almost always runs as a different user
than the owner of the directory in the host.

To simplify the reactions necessary for these users, extend the
definition of the safe.directory config value to include a possible '*'
value. This value implies that all directories are safe, providing a
single setting to opt-out of this protection.

Note that an empty assignment of safe.directory clears all previous
values, and this is already the case with the "if (!value || !*value)"
condition.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-04-13 15:55:10 -04:00
Matheus Valadares
5d60f3c4e1 setup: fix safe.directory key not being checked
It seems that nothing is ever checking to make sure the safe directories
in the configs actually have the key safe.directory, so some unrelated
config that has a value with a certain directory would also make it a
safe directory.

Signed-off-by: Matheus Valadares <me@m28.io>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-04-13 14:49:53 -04:00
Derrick Stolee
1bdb9e35c0 t0033: add tests for safe.directory
It is difficult to change the ownership on a directory in our test
suite, so insert a new GIT_TEST_ASSUME_DIFFERENT_OWNER environment
variable to trick Git into thinking we are in a differently-owned
directory. This allows us to test that the config is parsed correctly.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-04-13 14:49:53 -04:00
Derrick Stolee
3f8d16356f Merge pull request #3790: Include trailing slash in prefix migration instructions
After attempting to add directory on a network share to the `safe.directory` configuration with, for example:

```
git config --global --add safe.directory //servername/repos/myrepo
```

The warning about an outdated path style:

```
warning: encountered old-style '//servername/repos/myrepo' that should be '%(prefix)//servername/repos/myrepo'
```

However, the warning is missing a trailing `/` behind the prefix.

This PR fixes the warning such that the resulting configuration works.


Also see https://stackoverflow.com/a/71859164/4473230

Closes #3786
2022-04-13 14:33:19 -04:00
Michael Osthege
16f733a03e Include trailing slash in prefix instructions
Closes https://github.com/git-for-windows/git/issues/3786

Signed-off-by: Michael Osthege <michael.osthege@outlook.com>
2022-04-13 16:48:35 +02:00
Victoria Dye
fa8edb885d Merge tag 'v2.35.2.windows.1'
Git for Windows v2.35.2

Changes since Git for Windows v2.35.1(2) (February 1st 2022)

This version addresses CVE-2022-24765 and CVE-2022-24767.

New Features

  * Comes with Git v2.35.2.

Bug Fixes

  * The uninstaller was hardened to avoid a vulnerability when running
    under the SYSTEM account, addressing CVE-2022-24767.

Signed-off-by: Victoria Dye <vdye@github.com>
2022-04-12 11:25:04 -07:00
Junio C Hamano
11cfe55261 Git 2.36-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-04-11 21:27:02 -07:00
Junio C Hamano
33159949d2 Merge branch 'ja/i18n-fix-for-2.36'
Fixes to some localizable strings.

* ja/i18n-fix-for-2.36:
  i18n: fix some badly formatted i18n strings
2022-04-11 16:45:17 -07:00
Junio C Hamano
f1b50ec6f8 Merge tag 'v2.35.2' 2022-04-11 16:44:45 -07:00
Jean-Noël Avila
af15f84da7 i18n: fix some badly formatted i18n strings
String in submodule--helper is not correctly formatting
placeholders. The string in git-send-email is partial.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-04-11 14:13:46 -07:00
Derrick Stolee
00388b6efa Merge pull request #3783: fixup! fsmonitor: reintroduce core.useBuiltinFSMonitor
This change to warn about core.useBuiltinFSMonitor is a good one, but it
is too aggressive. If a user has set core.useBuiltinFSMonitor=false,
then that warning shows up.

Perhaps there is value in warning users that their explicit disabling of
the feature will stop working. However, VFS for Git does this
assignment, so all users on those enlistments will start getting
warnings after upgrading Git. This situation is probably much more
likely than a typical user disabling the experimental feature
themselves.

Putting in this fix is easier than rereleasing VFS for Git.
2022-04-11 14:56:50 -04:00
Derrick Stolee
0231a90991 fixup! fsmonitor: reintroduce core.useBuiltinFSMonitor
This change to warn about core.useBuiltinFSMonitor is a good one, but it
is too aggressive. If a user has set core.useBuiltinFSMonitor=false,
then that warning shows up.

Perhaps there is value in warning users that their explicit disabling of
the feature will stop working. However, VFS for Git does this
assignment, so all users on those enlistments will start getting
warnings after upgrading Git. This situation is probably much more
likely than a typical user disabling the experimental feature
themselves.

Putting in this fix is easier than rereleasing VFS for Git.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
2022-04-11 14:03:07 -04:00
Johannes Schindelin
48a6fa90e5 Merge pull request #3708 from PhilipOakley/die_preserve
Update the die() preserve-merges messages to help some users
v2.36.0-rc1.windows.1
2022-04-08 14:34:31 -07:00
Johannes Schindelin
c77e448aeb Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:31 -07:00
Philip Oakley
6cabbcb05a rebase: preserve is also a pull option, tell dying users
The `--preserve-merges` option was removed by v2.35.0. However
users may not be aware that it is also a Pull option, and it is
still offered by major IDE vendors such as Visual Studio.

Extend the `--preserve-merges` die message to direct users to
this option and it's locations.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
2022-04-08 14:34:31 -07:00
Johannes Schindelin
7caf081873 Merge pull request #2837 from dscho/monitor-component-updates
Start monitoring updates of Git for Windows' component in the open
2022-04-08 14:34:31 -07:00
Philip Oakley
ccfd176ed7 rebase: help user when dying with preserve-merges`
Git will die if a "rebase --preserve-merges" is in progress.
Users cannot --quit, --abort or --continue the rebase.

This sceario can occur if the user updates their Git, or switches
to another newer version, after starting a preserve-merges rebase,
commonly via the pull setting.

One trigger is an unexpectedly difficult to resolve conflict, as
reported on the `git-users` group.
(https://groups.google.com/g/git-for-windows/c/3jMWbBlXXHM)

Tell the user the cause, i.e. the existence of the directory.
The problem must be resolved manually, `git rebase --<option>`
commands will die, or the user must downgrade. Also, note that
the deleted options are no longer shown in the documentation.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
2022-04-08 14:34:31 -07:00
Johannes Schindelin
698eacdb5b Merge branch 'deprecate-old-runtime-prefix-path-interpolation'
Previously, we interpolated paths in config variables that start with a
forward-slash as relative to the runtime prefix. This was not portable
and has been replaced with `%(prefix)/`.

Let's warn users when they use the now-deprecated form.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:31 -07:00
Johannes Schindelin
b4f4744069 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>
2022-04-08 14:34:31 -07:00
Johannes Schindelin
a26181cafd Merge pull request #1354 from dscho/phase-out-show-ignored-directory-gracefully
Phase out `--show-ignored-directory` gracefully
2022-04-08 14:34:30 -07:00
Johannes Schindelin
d807c99559 Merge branch 'status-no-lock-index'
This branch allows third-party tools to call `git status
--no-lock-index` to avoid lock contention with the interactive Git usage
of the actual human user.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:30 -07:00
Johannes Schindelin
0efdda71b2 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>
2022-04-08 14:34:30 -07:00
Victoria Dye
95b2d573b7 Merge pull request #3492 from dscho/ns/batched-fsync
Switch to batched fsync by default
2022-04-08 14:34:30 -07:00
Johannes Schindelin
6fd2bb263e 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>
2022-04-08 14:34:30 -07:00
Johannes Schindelin
47647a4d5d Merge branch 'busybox-w32'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:30 -07:00
Johannes Schindelin
ea1454e7e9 Merge pull request #1897 from piscisaureus/symlink-attr
Specify symlink type in .gitattributes
2022-04-08 14:34:30 -07:00
Johannes Schindelin
3c296f028a 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>
2022-04-08 14:34:30 -07:00
Johannes Schindelin
c5554a2c13 Merge branch 'kblees/kb/symlinks' 2022-04-08 14:34:30 -07:00
Johannes Schindelin
87652594f4 Merge branch 'msys2' 2022-04-08 14:34:30 -07:00
Jeff Hostetler
1e5d76a521 Merge branch 'fix-v4-fsmonitor-long-paths' into try-v4-fsmonitor 2022-04-08 14:34:30 -07:00
Johannes Schindelin
046a47824e Merge branch 'long-paths' 2022-04-08 14:34:30 -07:00
Johannes Schindelin
dd4cf6b9ad 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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
55f50876b0 Add a GitHub workflow to monitor component updates
Rather than using private IFTTT Applets that send mails to this
maintainer whenever a new version of a Git for Windows component was
released, let's use the power of GitHub workflows to make this process
publicly visible.

This workflow monitors the Atom/RSS feeds, and opens a ticket whenever a
new version was released.

Note: Bash sometimes releases multiple patched versions within a few
minutes of each other (i.e. 5.1p1 through 5.1p4, 5.0p15 and 5.0p16). The
MSYS2 runtime also has a similar system. We can address those patches as
a group, so we shouldn't get multiple issues about them.

Note further: We're not acting on newlib releases, OpenSSL alphas, Perl
release candidates or non-stable Perl releases. There's no need to open
issues about them.

Co-authored-by: Matthias Aßhauer <mha1993@live.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
4d05d15043 mingw: deprecate old-style runtime-prefix handling in interpolate_path()
On Windows, an absolute POSIX path needs to be turned into a Windows
one. We used to interpret paths starting with a single `/` as relative
to the runtime-prefix, but now these need to be prefixed with
`%(prefix)/`. Let's warn for now, but still handle it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
d9a68f4d83 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.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
c10896df1c status: reinstate --show-ignored-directory as a deprecated option
It was a bad idea to just remove that option from Git for Windows
v2.15.0, as early users of that (still experimental) option would have
been puzzled what they are supposed to do now.

So let's reintroduce the flag, but make sure to show the user good
advice how to fix this going forward.

We'll remove this option in a more orderly fashion when we're certain
that the option is no longer used (previous Visual Studio versions
relied on it).

The option is deprecated now, therefore we make sure that keeps saying
so until we finally remove it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
1ee9a0f9e7 status: carry the --no-lock-index option for backwards-compatibility
When a third-party tool periodically runs `git status` in order to keep
track of the state of the working tree, it is a bad idea to lock the
index: it might interfere with interactive commands executed by the
user, e.g. when the user wants to commit files.

Git for Windows introduced the `--no-lock-index` option a long time ago
to fix that (it made it into Git for Windows v2.9.2(3)) by simply
avoiding to write that file.

The downside is that the periodic `git status` calls will be a little
bit more wasteful because they may have to refresh the index repeatedly,
only to throw away the updates when it exits. This cannot really be
helped, though, as tools wanting to get a periodic update of the status
have no way to predict when the user may want to lock the index herself.

Sadly, a competing approach was submitted (by somebody who apparently
has less work on their plate than this maintainer) that made it into
v2.15.0 but is *different*: instead of a `git status`-only option, it is
an option that comes *before* the Git command and is called differently,
too.

Let's give previous users a chance to upgrade to newer Git for Windows
versions by handling the `--no-lock-index` option, still, though with a
big fat warning.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
cf0ccbdd42 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>
2022-04-08 14:34:29 -07:00
Neeraj K. Singh
8e543ce79c mingw: do not call xutftowcs_path in mingw_mktemp
The `xutftowcs_path` function canonicalizes absolute paths using GetFullPathNameW.
This canonicalization may change the length of the string (e.g. getting rid of \.\),
which breaks callers that pass the template string in a strbuf and expect the
length of the string to remain the same.

In my particular case, the tmp-objdir code is passing a strbuf to mkdtemp and is
breaking since the strbuf.len is no longer synchronized with strlen(strbuf.buf).

Signed-off-by: Neeraj K. Singh <neerajsi@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
e6aa5a9729 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>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
ecf35c9286 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>
2022-04-08 14:34:29 -07:00
Alejandro Barreto
bd1397bfc0 Document how $HOME is set on Windows
Git documentation refers to $HOME and $XDG_CONFIG_HOME often, but does not specify how or where these values come from on Windows where neither is set by default. The new documentation reflects the behavior of setup_windows_environment() in compat/mingw.c.

Signed-off-by: Alejandro Barreto <alejandro.barreto@ni.com>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
8fb7ef4861 mingw: kill child processes in a gentler way
The TerminateProcess() function does not actually leave the child
processes any chance to perform any cleanup operations. This is bad
insofar as Git itself expects its signal handlers to run.

A symptom is e.g. a left-behind .lock file that would not be left behind
if the same operation was run, say, on Linux.

To remedy this situation, we use an obscure trick: we inject a thread
into the process that needs to be killed and to let that thread run the
ExitProcess() function with the desired exit status. Thanks J Wyman for
describing this trick.

The advantage is that the ExitProcess() function lets the atexit
handlers run. While this is still different from what Git expects (i.e.
running a signal handler), in practice Git sets up signal handlers and
atexit handlers that call the same code to clean up after itself.

In case that the gentle method to terminate the process failed, we still
fall back to calling TerminateProcess(), but in that case we now also
make sure that processes spawned by the spawned process are terminated;
TerminateProcess() does not give the spawned process a chance to do so
itself.

Please note that this change only affects how Git for Windows tries to
terminate processes spawned by Git's own executables. Third-party
software that *calls* Git and wants to terminate it *still* need to make
sure to imitate this gentle method, otherwise this patch will not have
any effect.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Johannes Schindelin
522bc12edb .github: Add configuration for the Sentiment Bot
The sentiment bot will help detect when things get too heated.
Hopefully.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-04-08 14:34:29 -07:00
Philip Oakley
34fe20f683 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>
2022-04-08 14:34:29 -07:00