Commit Graph

89308 Commits

Author SHA1 Message Date
Brendan Forster
a67fd95daf squash! http: add support for disabling SSL revocation checks in cURL
http: add support for disabling SSL revocation checks in cURL

This adds support for a new http.schannelCheckRevoke config value.

This config value is only used if http.sslBackend is set to "schannel",
which forces cURL to use the Windows Certificate Store when validating
server certificates associated with a remote server.

This config value should only be set to "false" if you are in an
environment where revocation checks are blocked by the network, with
no alternative options.

This is only supported in cURL 7.44 or later.

Note: originally, we wanted to call the config setting
`http.schannel.checkRevoke`. This, however, does not work: the `http.*`
config settings can be limited to specific URLs via `http.<url>.*`
(and this feature would mistake `schannel` for a URL).

Helped by Agustín Martín Barbero.

Signed-off-by: Brendan Forster <github@brendanforster.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 11:18:40 +01:00
Johannes Schindelin
18dab43c05 squash! http: add support for selecting SSL backends at runtime
http: add support for selecting SSL backends at runtime

As of version 7.56.0, curl supports being compiled with multiple SSL
backends.

This patch adds the Git side of that feature: by setting http.sslBackend
to "openssl" or "schannel", Git for Windows can now choose the SSL
backend at runtime.

This comes in handy on Windows because Secure Channel ("schannel") is
the native solution, accessing the Windows Credential Store, thereby
allowing for enterprise-wide management of certificates. For historical
reasons, Git for Windows needs to support OpenSSL still, as it has
previously been the only supported SSL backend in Git for Windows for
almost a decade.

The patch has been carried in Git for Windows for over a year, and is
considered mature.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 11:18:28 +01:00
Johannes Schindelin
69eadfb835 fixup! http: add support for selecting SSL backends at runtime
Revert this in preparation for applying the latest iteration of the
patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 11:15:51 +01:00
Johannes Schindelin
a36e5dca52 fixup! http: add support for disabling SSL revocation checks in cURL
Revert this in preparation for applying the latest iteration of the
patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 11:15:41 +01:00
Johannes Schindelin
17719e683f fixup! http: when using Secure Channel, ignore sslCAInfo by default
Revert this in preparation for applying the latest iteration of the
patch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 11:15:14 +01:00
Johannes Schindelin
cbea143773 http: when using Secure Channel, ignore sslCAInfo by default
As of cURL v7.60.0, the Secure Channel backend can use the certificate
bundle provided via `http.sslCAInfo`, but that would override the
Windows Certificate Store. Since this is not desirable by default, let's
tell Git to not ask cURL to use that bundle by default when the `schannel`
backend was configured via `http.sslBackend`, unless
`http.schannelUseSSLCAInfo` overrides this behavior.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-11 13:43:08 +02:00
Brendan Forster
b913a7056c http: add support for disabling SSL revocation checks in cURL
This adds support for a new http.schannelCheckRevoke config value.

This config value is only used if http.sslBackend is set to "schannel",
which forces cURL to use the Windows Certificate Store when validating
server certificates associated with a remote server.

This config value should only be set to "false" if you are in an
environment where revocation checks are blocked by the network, with
no alternative options.

This is only supported in cURL 7.44 or later.

Note: an earlier iteration tried to use the config setting
http.schannel.checkRevoke, but the http.* config settings can be limited
to specific URLs via http.<url>.* (which would mistake `schannel` for a
URL).

Helped by Agustín Martín Barbero.

Signed-off-by: Brendan Forster <github@brendanforster.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-11 13:43:08 +02:00
Johannes Schindelin
20703d78c3 http: add support for selecting SSL backends at runtime
The Pull Request at https://github.com/curl/curl/pull/1601 adds support
for choosing the SSL backend at runtime to cURL, and will hopefully be
merged before version 7.56.0 comes out.

Git for Windows will ship with those patches backported to 7.54.1 (and
come August 9th, 2017, 7.55.0 and later).

This patch adds the Git side of that feature: by setting http.sslBackend
to "openssl" or "schannel", Git for Windows can now choose the SSL
backend at runtime.

This comes in handy because Secure Channel ("schannel") is the native
Windows solution, accessing the Windows Credential Store, thereby
allowing for enterprise-wide management of certificates. For historical
reasons, Git for Windows needs to support OpenSSL still, as it has
previously been the only supported SSL backend in Git for Windows for
almost a decade.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-11 13:43:08 +02:00
Johannes Schindelin
0d438c7f4e Start the merging-rebase to f0badda8d7
This merging-rebase does not change anything in the code, just in the
commit structure of Git for Windows' branch thicket.

The motivation for this is that we have accumulated tons and tons of
patches in various stages of readiness to be contributed to core Git,
but there is no clear picture which patches are the most ready.

So here we use the calmer post-release days to organize our existing
branches into a more coherent structure, reordering them in order of
priority, and we also take the opportunity to merge branches (e.g.
misc-vs-fixes-extra into misc-vs-fixes) as well as patches (e.g. "The
stat() function should be independent of core.symlinks" really wanted to
be a fixup! commit for "Win32: implement stat() with symlink support").

This commit starts the rebase of f0badda8d7 to f0badda8d7

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-11 13:35:20 +02:00
Johannes Schindelin
9331a7cc08 fixup! Support Vagrant: quick & easy Linux virtual machine setup
It is a pain to maintain the .gitignore changes required to support
Vagrant. And we have had no indication whatsoever, at least since 2015,
that anybody was using it.

So let's drop it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-11 11:46:43 +02:00
Johannes Schindelin
b85dc5cd7c Merge pull request #1816 from csware/init-variable
Don't use uninitialized variable
2018-10-11 09:50:26 +02:00
Johannes Schindelin
11a3092e18 Merge pull request #1853 from dscho/fix-gc-segfault
Fix occasional segmentation fault in `git gc`
2018-10-04 21:56:10 +02:00
Johannes Schindelin
f13d7bb2cd Merge pull request #1827 from benpeart/fscache_refresh_index
Enable the filesystem cache (fscache) in refresh_index().
2018-10-04 21:56:10 +02:00
Johannes Schindelin
b867ed17d0 pack-objects (mingw): initialize packing_data mutex in the correct spot
In 9ac3f0e5b3 (pack-objects: fix performance issues on packing large
deltas, 2018-07-22), a mutex was introduced that is used to guard the
call to set the delta size. This commit even added code to initialize
it, but at an incorrect spot: in `init_threaded_search()`, while the
call to `oe_set_delta_size()` (and hence to `packing_data_lock()`) can
happen in the call chain `check_object()` <- `get_object_details()` <-
`prepare_pack()` <- `cmd_pack_objects()`, which is long before the
`prepare_pack()` function calls `ll_find_deltas()` (which initializes
the threaded search).

Another tell-tale that the mutex was initialized in an incorrect spot is
that the function to initialize it lives in builtin/, while the code
that uses the mutex is defined in a libgit.a header file.

Let's use a more appropriate function: `prepare_packing_data()`, which
not only lives in libgit.a, but *has* to be called before the
`packing_data` struct is used that contains that mutex.

This fixes https://github.com/git-for-windows/git/issues/1839.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:56:10 +02:00
Jameson Miller
d28c5cf539 Merge pull request #1837 from git-for-windows/azure-pipelines
Set up CI with Azure Pipelines
2018-10-04 21:56:10 +02:00
Johannes Schindelin
0f48dae3b3 pack-objects (mingw): demonstrate a segmentation fault with large deltas
There is a problem in the way 9ac3f0e5b3 (pack-objects: fix
performance issues on packing large deltas, 2018-07-22) initializes that
mutex in the `packing_data` struct. The problem manifests in a
segmentation fault on Windows, when a mutex (AKA critical section) is
accessed without being initialized. (With pthreads, you apparently do
not really have to initialize them?)

This was reported in https://github.com/git-for-windows/git/issues/1839.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:56:10 +02:00
Johannes Schindelin
d1d4fc39b1 Fix typo 'detla' -> 'delta'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:56:10 +02:00
Johannes Schindelin
825ac15528 Merge branch 'readme'
This also replaces the links to the VSTS badges by the new Azure DevOps
ones.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:56:08 +02:00
Johannes Schindelin
bd5a9f636b Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:52:25 +02:00
Jameson Miller
18a869b96b Merge 'builtin-stash-rebase-v3'
This trick was performed by rebasing the builtin-stash-rebase-v2 branch
thicket via `git rebase -ki --rebase-merges=rebase-cousins v2.19.1`,
replacing all branches that made it into `pu` by their current versions
(and also the builtin-stash by the newest iteration as of ungps/git),
labeling the branch as `builtin-stash-rebase-v3` and then replacing it
in the `merge` command in the todo list.

We did have to rebase the "cousins" because the initial merge of a
merging-rebase will confuse the merge-base logic (and hence the changes
would be dropped when we try to merge them "again").

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:52:25 +02:00
Jeff Hostetler
e48201f403 Merge pull request #1766 from jeffhostetler/gfw-msvc-bin-dir
find_vs_env.bat: Fix bin dir path used by msys
2018-10-04 21:52:25 +02:00
Philip Oakley
26d0382bdb 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>
2018-10-04 21:51:22 +02:00
Brendan Forster
7e14357153 Add an issue template
With improvements by Clive Chan, Adric Norris, Ben Bodenmiller and
Philip Oakley.

Signed-off-by: Clive Chan <cc@clive.io>
Signed-off-by: Adric Norris <landstander668@gmail.com>
Signed-off-by: Ben Bodenmiller <bbodenmiller@hotmail.com>
Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Brendan Forster <brendan@github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:51:22 +02:00
Johannes Schindelin
07d8f35160 README.md: Add a Windows-specific preamble
Includes touch-ups by Philip Oakley.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:51:22 +02:00
Derrick Stolee
34a895b2fb 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>
2018-10-04 21:49:11 +02:00
Johannes Schindelin
b00b6016de Add a Code of Conduct
It is better to state clearly expectations and intentions than to assume
quietly that everybody agrees.

This Code of Conduct is the Open Code of Conduct as per
http://todogroup.org/opencodeofconduct/ (the only modifications are the
adjustments to reflect that there is no "response team" in addition to the
Git for Windows maintainer, and the addition of the link to the Open Code
of Conduct itself).

[Completely revamped, based on the Covenant 1.4 by Brendan Forster]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:58 +02:00
Johannes Schindelin
86a21f5753 Merge pull request #1679 from telezhnaya/win
vcxproj: change build logic
2018-10-04 21:34:26 +02:00
Jeff Hostetler
b3208420c0 find_vs_env.bat: Fix bin dir path used by msys
Completely convert the pathname expoted in the %msvc_bin_dir_msys%
variable to MSYS format with forward slashes rather than a mixture
of forward and back slashes.

This solves an obscure problem observed by some developers:

    [...]
    http-push.c
        CC remote-curl.o
    remote-curl.c
        * new script parameters
        GEN git-instaweb
    sed: -e expression #7, char 155: invalid reference \2 on `s' command's RHS
    make: *** [Makefile:2023: git-instaweb] Error 1

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2018-10-04 21:34:26 +02:00
Olga Telezhnaia
bfca44f4e1 vcxproj: change build logic
Add new condition to invoke vcpkg_install.bat: it's not enough to check
the presence of folder vcpkg. We need to check the presence of some
header files because this is one of the main goals of this script.
Previous build attempt could be aborted, so the folder will exist but
the project will not be built properly.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
2018-10-04 21:34:26 +02:00
Johannes Schindelin
7296665763 Merge pull request #1645 from ZCube/master
Support windows container.
2018-10-04 21:34:25 +02:00
Johannes Schindelin
01e61804d3 Merge branch 'ctrl-c'
This is part two of the Ctrl+C story, where part one is
https://github.com/git-for-windows/MSYS2-packages/commit/f4fda0f30aa.

Part one took care of extending the signal handling in the MSYS2 runtime
such that non-MSYS2 processes "receive" a SIGINT by injecting a remote
thread that runs kernel32!CtrlRoutine as if GenerateConsoleCtrlHandler()
had been called (but in contrast to the latter, only one process is
targeted at a time, not every process attached to the same Console) into
the process that needs to be interrupted as well as into all of the
spawned child processes.

Part two now takes care of removing the misguided "kill all spawned
children" atexit() handler, and it also installs a ConsoleCtrl handler
to run Git's SIGINT handlers, such as the one waiting for the pager to
exit.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:25 +02:00
Johannes Schindelin
0f32e2e12f mingw: Windows Docker volumes are *not* symbolic links
... even if they may look like them.

As looking up the target of the "symbolic link" (just to see whether it
starts with `/ContainerMappedDirectories/`) is pretty expensive, we
do it when we can be *really* sure that there is a possibility that this
might be the case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: JiSeop Moon <zcube@zcube.kr>
2018-10-04 21:34:25 +02:00
Johannes Schindelin
610865d72b 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>
2018-10-04 21:34:25 +02:00
JiSeop Moon
e0e855454d mingw: move the file_attr_to_st_mode() function definition
In preparation for making this function a bit more complicated (to allow
for special-casing the `ContainerMappedDirectories` in Windows
containers, which look like a symbolic link, but are not), let's move it
out of the header.

Signed-off-by: JiSeop Moon <zcube@zcube.kr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:25 +02:00
JiSeop Moon
407fb72c98 mingw: when running in a Windows container, try to rename() harder
It is a known issue that a rename() can fail with an "Access denied"
error at times, when copying followed by deleting the original file
works. Let's just fall back to that behavior.

Signed-off-by: JiSeop Moon <zcube@zcube.kr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:25 +02:00
JiSeop Moon
9d0d9ec064 mingw: introduce code to detect whether we're inside a Windows container
This will come in handy in the next commit.

Signed-off-by: JiSeop Moon <zcube@zcube.kr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:25 +02:00
Johannes Schindelin
133d6d86fc Merge pull request #1548 from alejandro5042/master
Document how $HOME is set on Windows
2018-10-04 21:34:24 +02:00
Johannes Schindelin
83e1aceaef Merge branch 'fix-unc-buffer-overflow'
This fixes `git status` in a Git worktree at the top of a file share.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:24 +02:00
Alejandro Barreto
eea3fb02a2 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>
2018-10-04 21:34:24 +02:00
Johannes Schindelin
eb22157718 Merge pull request #1468 from atetubou/fscache_checkout_flush
checkout.c: enable fscache for checkout again
2018-10-04 21:34:24 +02:00
Johannes Schindelin
962d74929d setup_git_directory(): handle UNC root paths correctly
When working in the root directory of a file share (this is only
possible in Git Bash and Powershell, but not in CMD), the current
directory is reported without a trailing slash.

This is different from Unix and standard Windows directories: both / and
C:\ are reported with a trailing slash as current directories.

If a Git worktree is located there, Git is not quite prepared for that:
while it does manage to find the .git directory/file, it returns as
length of the top-level directory's path *one more* than the length of
the current directory, and setup_git_directory_gently() would then
return an undefined string as prefix.

In practice, this undefined string usually points to NUL bytes, and does
not cause much harm. Under rare circumstances that are really involved
to reproduce (and not reliably so), the reported prefix could be a
suffix string of Git's exec path, though.

A careful analysis determined that this bug is unlikely to be
exploitable, therefore we mark this as a regular bug fix.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:24 +02:00
Johannes Schindelin
75d99300c2 Merge branch 'fix-terminal-prompt'
This fixes the issue identified in

	https://github.com/git-for-windows/git/issues/1498

where Git would not fall back to reading credentials from a Win32
Console when the credentials could not be read from the terminal via the
Bash hack (that is necessary to support running in a MinTTY).

Tested in a Powershell window.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:23 +02:00
Takuto Ikuta
8511d83436 checkout.c: enable fscache for checkout again
This is retry of #1419.

I added flush_fscache macro to flush cached stats after disk writing
with tests for regression reported in #1438 and #1442.

git checkout checks each file path in sorted order, so cache flushing does not
make performance worse unless we have large number of modified files in
a directory containing many files.

Using chromium repository, I tested `git checkout .` performance when I
delete 10 files in different directories.
With this patch:
TotalSeconds: 4.307272
TotalSeconds: 4.4863595
TotalSeconds: 4.2975562
Avg: 4.36372923333333

Without this patch:
TotalSeconds: 20.9705431
TotalSeconds: 22.4867685
TotalSeconds: 18.8968292
Avg: 20.7847136

I confirmed this patch passed all tests in t/ with core_fscache=1.

Signed-off-by: Takuto Ikuta <tikuta@chromium.org>
2018-10-04 21:34:23 +02:00
Johannes Schindelin
41ef377058 Merge branch 'fix-vcxproj-generation'
We ran out of GUIDs in the script generating Visual Studio project
files. This topic branch fixes that issue once and for all, by
generating the GUIDs.

For extra goodness, we now generate GUIDs that are not random, but are
generated from the SHA-256 checksums of the target file of the project.
That way, the project<->GUID mapping is stable.

This fixes https://github.com/git-for-windows/git/issues/1507

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:23 +02:00
Johannes Schindelin
93c7196435 mingw (git_terminal_prompt): turn on echo explictly
It turns out that when running in a Powershell window, we need to turn
on ENABLE_ECHO_INPUT because the default would be *not* to echo
anything.

This also ensures that we use the input mode where all input is read
until the user hits the Return key.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:23 +02:00
Johannes Schindelin
d701d5d30b .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>
2018-10-04 21:34:22 +02:00
Johannes Schindelin
57c749de67 buildsystems(Vcproj): auto-generate GUIDs
We ran out GUIDs. Again. But there is no need to: we can generate them
semi-randomly from the target file name of the project.

Note: the Vcproj generator is probably only interesting for historical
reasons; nevertheless, the Vcxproj generator in the Git for Windows
project is based on the Vcproj generator and it is better to backport
the fix than to let Vcproj have the hard-coded list of GUIDs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:22 +02:00
Johannes Schindelin
51d03a7fd5 mingw (git_terminal_prompt): do fall back to CONIN$/CONOUT$ method
To support Git Bash running in a MinTTY, we use a dirty trick to access
the MSYS2 pseudo terminal: we execute a Bash snippet that accesses
/dev/tty.

The idea was to fall back to writing to/reading from CONOUT$/CONIN$ if
that Bash call failed because Bash was not found.

However, we should fall back even in other error conditions, because we
have not successfully read the user input. Let's make it so.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:22 +02:00
Johannes Schindelin
346365d269 add --edit: truncate the patch file
If there is already a .git/ADD_EDIT.patch file, we fail to truncate it
properly, which could result in very funny errors.

Let's just truncate it and not worry about it too much.

Reported by J Wyman.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:22 +02:00
Johannes Schindelin
26b2ac1ffc buildsystems(vcxproj): auto-generate GUIDs
We ran out GUIDs. Again. But there is no need to: we can generate them
semi-randomly from the target file name of the project.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:22 +02:00