Commit Graph

64374 Commits

Author SHA1 Message Date
Johannes Schindelin
cf0b4c272a Merge 'git-gui-add-2nd-line' into HEAD 2016-10-25 18:09:57 +02:00
Johannes Schindelin
4a7edc4b0d Merge pull request #620 from sidecut/sidecut-gitk-list-references-window-width
Make the "list references" default window width wider
2016-10-25 18:09:57 +02:00
Johannes Schindelin
54e1b971e3 Merge branch 'gitk-cursor-keys'
This patch needs to be contributed to gitk proper, of course.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 18:09:57 +02:00
Johannes Schindelin
a44cee8efe 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>
2016-10-25 18:09:57 +02:00
Johannes Schindelin
cd86280ecd 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>
2016-10-25 18:09:57 +02:00
Johannes Schindelin
bb4722b9bc Merge 'unc-alternates' into HEAD 2016-10-25 18:09:57 +02:00
Johannes Schindelin
148e5bfacd Merge pull request #552 from duncansmart/fix-vcproj-gen
Fix Visual Studio .sln/.vcproj generation.
2016-10-25 18:09:57 +02:00
Johannes Schindelin
328657adf2 Merge pull request #773 from jeffhostetler/vs2015
Build with VS2015
2016-10-25 18:09:56 +02:00
Johannes Schindelin
d4b7423aa7 Merge pull request #305 from dscho/msysgit_issues_182
Allow `add -p` and `add -i` with a large number of files
2016-10-25 18:09:56 +02:00
Johannes Schindelin
19c3a9ffbb Merge pull request #246 from uecasm/patch-1
Verify memoized files can be reloaded before using them
2016-10-25 18:09:56 +02:00
Johannes Schindelin
989f3e7483 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>
2016-10-25 18:09:56 +02:00
Johannes Schindelin
f08cc25306 Merge pull request #159 from dscho/vagrant
Add Vagrant support (easy Linux VM setup)
2016-10-25 18:09:56 +02:00
Johannes Schindelin
9a5300d26a Merge 'mingw-getcwd' into HEAD 2016-10-25 18:09:56 +02:00
Johannes Schindelin
46bc7b7c12 Merge pull request #443 from kblees/kb/nanosecond-file-times-v2.5.3
nanosecond file times for v2.5.3
2016-10-25 18:09:56 +02:00
Johannes Schindelin
cdfb15a241 Merge pull request #156 from kblees/kb/symlinks
Symlink support
2016-10-25 18:09:56 +02:00
Johannes Schindelin
df00a08bb3 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>
2016-10-25 18:09:56 +02:00
Johannes Schindelin
72c925e96b Merge 'fix-is-exe' into HEAD 2016-10-25 18:09:55 +02:00
Johannes Schindelin
28d9fe875d Merge 'fix-externals' into HEAD 2016-10-25 18:09:55 +02:00
Johannes Schindelin
7eb0a1cbb6 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>
2016-10-25 18:09:55 +02:00
Johannes Schindelin
988c1bd72b Merge 'win-tests-fixes' into HEAD 2016-10-25 18:09:55 +02:00
Johannes Schindelin
a72162e3ea Merge 'msys2' into HEAD
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 18:09:55 +02:00
Johannes Schindelin
4403db041d 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>
2016-10-25 18:09:53 +02:00
Johannes Schindelin
2c9e8689cf 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>
2016-10-25 18:09:53 +02:00
Johannes Schindelin
4a29a05f7b msvc: use libiconv
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 18:09:53 +02:00
Jeff Hostetler
bd5039ef5c 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>
2016-10-25 18:09:53 +02:00
Johannes Schindelin
6999049b3e msvc: respect the quiet-by-default output
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 18:09:53 +02:00
Jeff Hostetler
89a6eeddf2 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>
2016-10-25 18:09:53 +02:00
Jeff Hostetler
93a8ba217d msvc: fix setvbuf() call
The VS2015 version of the CRT asserts when you
pass a zero buffer length and request line buffering.
This fix sets it to the default BUFSIZ.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-25 18:09:53 +02:00
Jeff Hostetler
cd3c9f07ea 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>
2016-10-25 18:09:53 +02:00
Jeff Hostetler
1f4867cde1 msvc: fix isatty()
The hack that works in MINGW does not work with MSVC's CRT. Add MSVC
versions of isatty() and swap_osfhnd().

The MINGW versions attempt to replace the underlying OS HANDLE in an
existing file descriptor (fd) by writing to some undocumented fields in
the "ioinfo" structures inside the CRT. These structures changed size
and shape with the new UCRT in VS2015. The new MSVC versions of these
routines work without touching private fields. In theory, we should be
able to replace the ming versions with
this one.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-25 18:09:53 +02:00
Jeff Hostetler
f60cb74b5f msvc: define ftello()
It is just called different in MSVC's headers.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-25 18:09:53 +02:00
Jeff Hostetler
7aca6716fd msvc: do not re-declare the timespec struct
VS2015's headers already declare that struct.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-25 18:09:53 +02:00
Johannes Schindelin
20904fc1b0 Clarify the location of the Windows-specific ProgramData config
On Windows, there is no (single) `/etc/` directory. To address that, in
conjunction with the libgit2 project, Git for Windows introduced yet
another level of system-wide config files, located in C:\ProgramData
(and the equivalent on Windows XP).

Let's spell this out in the documentation.

This closes https://github.com/git-for-windows/git/pull/470 (because
there was no reaction in three months in that Pull Request).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 18:09:52 +02:00
Jeff Hostetler
b75845087c 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>
2016-10-25 18:09:52 +02:00
Jeff Hostetler
43cd51212a 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>
2016-10-25 18:09:52 +02:00
Jeff Hostetler
c860a102be 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>
2016-10-25 18:09:52 +02:00
Jeff Hostetler
bba8a7cbf1 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>
2016-10-25 18:09:52 +02:00
Philip Oakley
b9c5affddc 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>
2016-10-25 18:09:52 +02:00
Philip Oakley
df1a6d83a7 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>
2016-10-25 18:09:52 +02:00
Philip Oakley
fa5aa1c54c msvc: include sigset_t definition
On MSVC (VS2008) sigset_t is not defined.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2016-10-25 18:09:52 +02:00
Jeff Hostetler
9c0b3987d1 msvc: update Makefile and compiler settings for VS2015
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-25 18:09:52 +02:00
Jeff Hostetler
0aa4818670 msvc: update compile helper for VS2015
Support -Z flags ("specify PDB options"), only include -l args on link
commands, and force PDBs to be created.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-25 18:09:52 +02:00
Jeff Hostetler
9d78395c5c msvc: add NuGet scripts for building with VS2015
This commit contains a GNU Makefile and NuGet configuration
scripts to download and install the various third-party
libraries that we will need to build/link with when using
VS2015 to build Git.

The file "compat/vcbuild/README_VS2015.txt" contains
instructions for using this.

In this commit, "compat/vcbuild/Makefile" contains hard-coded
version numbers of the packages we require.  These are set to
the current versions as of the time of this commit.  We use
"nuget restore" to install them explicitly using a "package.config".
A future improvement would try to use some of the automatic
package management functions and eliminate the need to specify
exact versions.  I tried, but could not get this to work.
NuGet was happy dowload "minimum requirements" rather than
"lastest" for dependencies -- and only look at one package at
a time.  For example, both curl and openssl depend upon zlib
and have different minimums.  It was unclear which version of
zlib would be installed and seemed to be dependent on the order
of the top-level pacakges.  So, I'm skipping that for now.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-25 18:09:52 +02:00
Jeff Hostetler
7edeccb431 msvc: ignore VS2015 trash files
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-25 18:09:52 +02:00
Johannes Schindelin
1a65d78577 msvc: fix dependencies of compat/msvc.c
The file compat/msvc.c includes compat/mingw.c, which means that we have
to recompile compat/msvc.o if compat/mingw.c changes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 18:09:52 +02:00
Karsten Blees
0ceee51e7e Win32: implement nanosecond-precision file times
We no longer use any of MSVCRT's stat-functions, so there's no need to
stick to a CRT-compatible 'struct stat' either.

Define and use our own POSIX-2013-compatible 'struct stat' with nanosecond-
precision file times.

Note: Due to performance issues when using git variants with different file
time resolutions, this patch does *not* yet enable nanosecond precision in
the Makefile (use 'make USE_NSEC=1').

Signed-off-by: Karsten Blees <blees@dcon.de>
2016-10-25 18:09:51 +02:00
lchiocca
831a4ca2da The stat() function should be independent of core.symlinks
The contract for the stat() and lstat() function is:
> stat():  stats the file pointed to by path and fills in buf.
> lstat(): is identical to stat(), except that if path is a symbolic link,
>          then the link itself is stat-ed, not the file that it refers to.

stat() should always return the statistics of the file or directory a
symbolic link is pointing to. The lstat() function is used to get the
stats for the symlink. Hence the check should not be there.

Signed-off-by: Loris Chiocca <loris@chiocca.ch>
2016-10-25 18:09:51 +02:00
Johannes Schindelin
7cfefa7925 Windows: add support for a Windows-wide configuration
Between the libgit2 and the Git for Windows project, there has been a
discussion how we could share Git configuration to avoid duplication (or
worse: skew).

Earlier, libgit2 was nice enough to just re-use Git for Windows'

	C:\Program Files (x86)\Git\etc\gitconfig

but with the upcoming Git for Windows 2.x, there would be more paths to
search, as we will have 64-bit and 32-bit versions, and the
corresponding config files will be in %PROGRAMFILES%\Git\mingw64\etc and
...\mingw32\etc, respectively.

Worse: there are portable Git for Windows versions out there which live
in totally unrelated directories, still.

Therefore we came to a consensus to use `%PROGRAMDATA%\Git\config` as the
location for shared Git settings that are of wider interest than just Git
for Windows.

On XP, there is no %PROGRAMDATA%, therefore we need to use
"%ALLUSERSPROFILE%\Application Data\Git\config" in those setups.

Of course, the configuration in `%PROGRAMDATA%\Git\config` has the
widest reach, therefore it must take the lowest precedence, i.e. Git for
Windows can still override settings in its `etc/gitconfig` file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 18:09:51 +02:00
Karsten Blees
4e88a90514 Win32: replace MSVCRT's fstat() with a Win32-based implementation
fstat() is the only stat-related CRT function for which we don't have a
full replacement yet (and thus the only reason to stick with MSVCRT's
'struct stat' definition).

Fully implement fstat(), in preparation of implementing a POSIX 2013
compatible 'struct stat' with nanosecond-precision file times.

Signed-off-by: Karsten Blees <blees@dcon.de>
2016-10-25 18:09:51 +02:00
Johannes Schindelin
25b05b6fcd mingw: keep trailing slashes for _wchdir() and readlink()
This is needed so that `_wchdir()` can be used with drive root
directories, e.g. C:\ (`_wchdir("C:")` fails to switch the directory
to the root directory).

This fixes https://github.com/msysgit/git/issues/359 (in Git for Windows
2.x only, though).

Likewise, `readlink()`'s semantics require a trailing slash for symbolic
links pointing to directories. Otherwise all checked out symbolic links
pointing to directories would be marked as modified even directly after a
fresh clone.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 18:09:51 +02:00