Commit Graph

75451 Commits

Author SHA1 Message Date
Johannes Schindelin
ab4fa8f029 Merge 'git-gui-add-2nd-line' into HEAD 2017-08-10 17:35:53 +02:00
Johannes Schindelin
d89dedf2d2 Merge branch 'clean-long-paths'
This addresses https://github.com/git-for-windows/git/issues/521

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:52 +02:00
Johannes Schindelin
1182a39673 Merge 'aslr' into HEAD
Address Space Layout Randomization (ASLR) allows executables' memory
layout to change at random between runs, and therefore offers a quite
decent protection against many attacks.

We enable ASLR because MSYS2's C compiler offers support for ASLR, and
whatever performance impact it has is neglible, according to
https://insights.sei.cmu.edu/cert/2014/02/differences-between-aslr-on-windows-and-linux.html

This merges the part of https://github.com/git-for-windows/git/pull/612
that does not break Git ;-)

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:51 +02:00
Johannes Schindelin
97f56a314f Merge pull request #552 from duncansmart/fix-vcproj-gen
Fix Visual Studio .sln/.vcproj generation.
2017-08-10 17:35:50 +02:00
Johannes Schindelin
8225ead085 Merge pull request #773 from jeffhostetler/vs2015
Build with VS2015
2017-08-10 17:35:49 +02:00
Johannes Schindelin
f0e27d71e1 Merge pull request #305 from dscho/msysgit_issues_182
Allow `add -p` and `add -i` with a large number of files
2017-08-10 17:35:48 +02:00
Johannes Schindelin
82848b02e8 Merge branch 'program-data-config'
This branch introduces support for reading the "Windows-wide" Git
configuration from `%PROGRAMDATA%\Git\config`. As these settings are
intended to be shared between *all* Git-related software, that config
file takes an even lower precedence than `$(prefix)/etc/gitconfig`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:47 +02:00
Johannes Schindelin
44567b1544 Merge 'mingw-getcwd' into HEAD 2017-08-10 17:35:46 +02:00
Johannes Schindelin
415bb2b9a2 Merge pull request #443 from kblees/kb/nanosecond-file-times-v2.5.3
nanosecond file times for v2.5.3
2017-08-10 17:35:46 +02:00
Johannes Schindelin
6502803f38 Merge pull request #156 from kblees/kb/symlinks
Symlink support
2017-08-10 17:35:45 +02:00
Johannes Schindelin
03ab402054 Merge 'sideband-bug' into HEAD
This works around the push-over-git-protocol issues pointed out in
https://github.com/msysgit/git/issues/101.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:44 +02:00
Johannes Schindelin
8ac03b4d0a Merge 'fix-externals' into HEAD 2017-08-10 17:35:43 +02:00
Johannes Schindelin
f730119e2e Merge 'remote-hg-prerequisites' into HEAD
These fixes were necessary for Sverre Rabbelier's remote-hg to work,
but for some magic reason they are not necessary for the current
remote-hg. Makes you wonder how that one gets away with it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:42 +02:00
Johannes Schindelin
b5c3a18851 Merge 'win-tests-fixes' into HEAD 2017-08-10 17:35:41 +02:00
Johannes Schindelin
4daab06a11 Merge 'msys2' into HEAD
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:40 +02:00
Johannes Schindelin
6ba6df4e35 Merge 'resource-version' into HEAD 2017-08-10 17:35:39 +02:00
Johannes Schindelin
c650c8452f Merge 'jberezanski/wincred-sso-r2' into HEAD 2017-08-10 17:35:38 +02:00
Johannes Schindelin
58f2c6a727 Merge 'gitk' into HEAD 2017-08-10 17:35:37 +02:00
Johannes Schindelin
20c48632f5 Merge branch 'msys2-git-gui'
This topic branch addresses the bug where Git for Windows 2.x' Git GUI
failed to generate a working shortcut via Repository>Create Desktop
Shortcut.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:36 +02:00
Johannes Schindelin
3f19c3d6e3 Merge 'git-gui' into HEAD 2017-08-10 17:35:35 +02:00
Johannes Schindelin
c7f8cb025f Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:35 +02:00
Johannes Schindelin
ef1c478839 Merge branch 'redirect-std-handles'
This topic branch introduces a highly-experimental feature allowing to
override stdin/stdout/stderr by setting environment variables e.g. to
named pipes, solving a problem in highly multi-threaded applications
where inheritable handles could cause blocked Git operations.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:34 +02:00
Johannes Schindelin
e458d383c2 git gui: fix staging a second line to a 1-line file
When a 1-line file is augmented by a second line, and the user tries to
stage that single line via the "Stage Line" context menu item, we do not
want to see "apply: corrupt patch at line 5".

The reason for this error was that the hunk header looks like this:

	@@ -1 +1,2 @@

but the existing code expects the original range always to contain a
comma. This problem is easily fixed by cutting the string "1 +1,2"
(that Git GUI formerly mistook for the starting line) at the space.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:31 +02:00
Johannes Schindelin
27f5eac69e t7300: git clean -dfx must show an error with long paths
In particular on Windows, where the default maximum path length is quite
small, but there are ways to circumvent that limit in many cases, it is
very important that users be given an indication why their command
failed because of too long paths when it did.

This test case makes sure that a warning is issued that would have
helped the user who reported Git for Windows' issue 521:

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:29 +02:00
Johannes Schindelin
2075a54963 remove_dirs: do not swallow error when stat() failed
Without an error message when stat() failed, e.g. `git clean` would
abort without an error message, leaving the user quite puzzled.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:29 +02:00
İsmail Dönmez
ef4d3d0605 Enable DEP and ASLR
Enable DEP (Data Execution Prevention) and ASLR (Address Space Layout
Randomization) support. This applies to both 32bit and 64bit builds
and makes it substantially harder to exploit security holes in Git by
offering a much more unpredictable attack surface.

ASLR interferes with GDB's ability to set breakpoints. A similar issue
holds true when compiling with -O2 (in which case single-stepping is
messed up because GDB cannot map the code back to the original source
code properly). Therefore we simply enable ASLR only when an
optimization flag is present in the CFLAGS, using it as an indicator
that the developer does not want to debug in GDB anyway.

Signed-off-by: İsmail Dönmez <ismail@i10z.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:28 +02:00
İsmail Dönmez
887a6a2362 Don't let ld strip relocations
This is the first step for enabling ASLR (Address Space Layout
Randomization) support. We want to enable ASLR for better protection
against exploiting security holes in Git.

The problem fixed by this commit is that `ld.exe` seems to be stripping
relocations which in turn will break ASLR support. We just make sure
it's not stripping the main executable entry.

Signed-off-by: İsmail Dönmez <ismail@i10z.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:28 +02:00
Philip Oakley
f40d6a6322 engine.pl: ignore invalidcontinue.obj which is known to MSVC
Commit 4b623d8 (MSVC: link in invalidcontinue.obj for better
POSIX compatibility, 2014-03-29) introduced invalidcontinue.obj
into the Makefile output, which was not parsed correctly by the
buildsystem. Ignore it, as it is known to Visual Studio and,
there is no matching source file.

Only substitute filenames ending with .o when generating the
source .c filename, otherwise a .cbj file may be expected.

Split the .o and .obj processing; 'make' does not produce .obj
files.

In the future there may be source files that produce .obj files
so keep the two issues (.obj files with & without source files)
separate.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Duncan Smart <duncan.smart@gmail.com>

(cherry picked from commit d01d71fe1aed67f4e3a5ab80eeadeaf525ad0846)
2017-08-10 17:35:26 +02:00
Johannes Schindelin
ff072ad3b9 compat/vcbuild: possibly reuse Git for Windows' SDK's NuGet
In Git for Windows' SDK, there is already a script to package Git for
Windows as a NuGet package, downloading nuget.exe if needed.

Let's just fall back to using that executable (if it is there) if
nuget.exe was not found in the PATH.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:25 +02:00
Jeff Hostetler
977db0109a vs2015: remove todo list item from README_vs2015.txt
Remove todo list item for vs2015 build notes regarding
the third party DLLs.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:25 +02:00
Jeff Hostetler
5c15ef3a54 vs2015: teach 'make clean' to delete PDBs
Teach main Makefile to also delete the generated PDB files
as well as the PDB files for the various EXE files during
"make MSVC=1 clean".

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:25 +02:00
Jeff Hostetler
1e8f834d3b vs2015: turn on optimize-for-speed in release build
Set -O2 (maximize speed) rather than -Os (favor small code)
for non-debug builds.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:25 +02:00
Johannes Schindelin
e61c1905b2 t7800: fix quoting
When passing a command-line to call an external diff command to the
difftool, we must be prepared for paths containing special characters,
e.g. backslashes in the temporary directory's path on Windows.

This has been caught by running the test suite with an MSVC-built Git:
in contrast to the MINGW one, it does not rewrite `$TMP` to use forward
slashes instead of backslashes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:25 +02:00
Johannes Schindelin
336955427b msvc: work around iconv() not setting errno
When compiling with MSVC, we rely on NuPkgs to provide the binaries of
dependencies such as libiconv. The libiconv 1.14.0.11 package available
from https://www.nuget.org/packages/libiconv seems to have a bug where
it does not set errno (when we would expect it to be E2BIG).

Let's simulate the error condition by taking less than 16 bytes
remaining in the out buffer as an indicator that we ran out of space.
While 16 might seem a bit excessive (when converting from, say, any
encoding to UTF-8, 8 bytes should be fine), it is designed to be a safe
margin.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:24 +02:00
Johannes Schindelin
5c66cc709d msvc: use libiconv
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:24 +02:00
Jeff Hostetler
84677bea96 msvc: use OpenSSL's SHA-1 routines
Just like 1e2ce1d (sha1: Use OpenSSL SHA1 routines on MINGW, 2016-10-12),
we now use OpenSSL's SHA-1 routines instead of Git's own because OpenSSL
is substantially faster as of version 1.0.2: it now uses hardware
acceleration on Intel processors much more effectively.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:24 +02:00
Johannes Schindelin
3fd570e959 msvc: respect the quiet-by-default output
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:24 +02:00
Jeff Hostetler
285b1f5097 msvc: release mode PDBs and library DLLs
Install required third-party DLLs next to EXEs.

Build and install release mode PDBs for git
executables allowing detailed stack traces
in the event of crash.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:24 +02:00
Jeff Hostetler
4c77a890a1 cache-tree.c: avoid reusing the DEBUG constant
In MSVC, the DEBUG constant is set automatically whenever compiling with
debug information.

This is clearly not what was intended in cache-tree.c, so let's use a less
ambiguous constant there.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:24 +02:00
Johannes Schindelin
611d420d6c msvc: fix detect_msys_tty()
The ntstatus.h header is only available in MINGW.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:24 +02:00
Jeff Hostetler
b374c372d7 msvc: define ftello()
It is just called different in MSVC's headers.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:23 +02:00
Jeff Hostetler
ed3b75723c msvc: do not re-declare the timespec struct
VS2015's headers already declare that struct.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:23 +02:00
Johannes Schindelin
80771c6391 msvc: provide a main() wrapper similar to mingw_main()
The MINGW version of the main() wrapper gets away with declaring symbols
that were intentionally not exported. However, some of these symbols do
not actually exist in MSVC's UCRT.

So let's add an MSVC version of the main() wrapper that uses wmain() and
imports the UNICODE argv and environment. While at it, we pass our UTF-8
version of ARGV to the real main -- rather than overwriting __argv as is
done in the MINGW Version.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:23 +02:00
Jeff Hostetler
416d4dd029 msvc: do not pretend to support all signals
This special-cases various signals that are not supported on Windows,
such as SIGPIPE. These cause the UCRT to throw asserts (at least in
debug mode).

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:23 +02:00
Jeff Hostetler
e12b08e01a msvc: mark a variable as non-const
VS2015 complains when using a const pointer in memcpy()/free().

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:23 +02:00
Jeff Hostetler
be2562e62b msvc: convert environment from/to UTF-16 on the fly
This adds MSVC versions of getenv() and friends. These take UTF-8
arguments and return UTF-8 values, but use the UNICODE versions
of the CRT routines.  This avoids the need to write to __environ
(which is only visible if you statically link to the CRT).  This
also avoids the CP_ACP conversions performed inside the CRT.
It also avoids various memory leaks and problems.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:23 +02:00
Philip Oakley
13a2aaa764 msvc: fix the declaration of the _REPARSE_DATA_BUFFER structure
GCC and MSVC disagree about using the GCC extension _ANONYMOUS_UNION.
Simply skip that offending keyword when compiling with MSVC.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:23 +02:00
Philip Oakley
16aadf2535 msvc: define O_ACCMODE
This constant is not defined in MSVC's headers.

In UCRT's fcntl.h, _O_RDONLY, _O_WRONLY and _O_RDWR are defined as 0, 1
and 2, respectively. Yes, that means that UCRT breaks with the tradition
that O_RDWR == O_RDONLY | O_WRONLY.

It is a perfectly legal way to define those constants, though, therefore
we need to take care of defining O_ACCMODE accordingly.

This is particularly important in order to keep our "open() can set
errno to EISDIR" emulation working: it tests that (flags & O_ACCMODE) is
not identical to O_RDONLY before going on to test specifically whether
the file for which open() reported EACCES is, in fact, a directory.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-10 17:35:22 +02:00
Philip Oakley
3c392dc167 msvc: include sigset_t definition
On MSVC (VS2008) sigset_t is not defined.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2017-08-10 17:35:22 +02:00
Jeff Hostetler
d8f1ed0828 msvc: update Makefile and compiler settings for VS2015
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-08-10 17:35:22 +02:00