Commit Graph

73317 Commits

Author SHA1 Message Date
Johannes Schindelin
ce15f370d9 Merge pull request #773 from jeffhostetler/vs2015
Build with VS2015
2017-06-26 11:09:30 +02:00
Johannes Schindelin
0a31e2c67e Merge pull request #305 from dscho/msysgit_issues_182
Allow `add -p` and `add -i` with a large number of files
2017-06-26 11:09:29 +02:00
Johannes Schindelin
24a829d685 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-06-26 11:09:27 +02:00
Johannes Schindelin
46591d9760 Merge 'mingw-getcwd' into HEAD 2017-06-26 11:09:25 +02:00
Johannes Schindelin
8c2e7cc6f7 Merge pull request #443 from kblees/kb/nanosecond-file-times-v2.5.3
nanosecond file times for v2.5.3
2017-06-26 11:09:23 +02:00
Johannes Schindelin
3f62166ff3 Merge pull request #156 from kblees/kb/symlinks
Symlink support
2017-06-26 11:09:22 +02:00
Johannes Schindelin
0fe02540c2 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-06-26 11:09:20 +02:00
Johannes Schindelin
c502562238 Merge 'fix-externals' into HEAD 2017-06-26 11:09:18 +02:00
Johannes Schindelin
30d971f39e 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-06-26 11:09:17 +02:00
Johannes Schindelin
91a4103051 Merge 'win-tests-fixes' into HEAD 2017-06-26 11:09:15 +02:00
Johannes Schindelin
644d9e8a75 Merge 'msys2' into HEAD
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-06-26 11:09:14 +02:00
Johannes Schindelin
34b4657283 Merge 'resource-version' into HEAD 2017-06-26 11:09:12 +02:00
Johannes Schindelin
10a534a140 Merge 'jberezanski/wincred-sso-r2' into HEAD 2017-06-26 11:09:10 +02:00
Johannes Schindelin
9baa78f561 Merge 'gitk' into HEAD 2017-06-26 11:09:09 +02:00
Johannes Schindelin
cc9c14dda6 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-06-26 11:09:07 +02:00
Johannes Schindelin
11b3017ce6 Merge 'git-gui' into HEAD 2017-06-26 11:09:05 +02:00
Johannes Schindelin
ca2eb550ab Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-06-26 11:09:04 +02:00
Johannes Schindelin
feee611963 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-06-26 11:09:02 +02:00
Johannes Schindelin
29a5e669e0 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-06-26 11:03:43 +02:00
Jeff Hostetler
fb9fff4678 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-06-26 11:03:43 +02:00
Jeff Hostetler
9625bba6dd 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-06-26 11:03:43 +02:00
Jeff Hostetler
009a1017c7 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-06-26 11:03:43 +02:00
Johannes Schindelin
c4004f9d8d 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-06-26 11:03:43 +02:00
Johannes Schindelin
41530eff75 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-06-26 11:03:43 +02:00
Johannes Schindelin
807f6e0afe msvc: use libiconv
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-06-26 11:03:43 +02:00
Jeff Hostetler
4dc421b452 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-06-26 11:03:43 +02:00
Johannes Schindelin
88856af6ff msvc: respect the quiet-by-default output
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-06-26 11:03:43 +02:00
Jeff Hostetler
aecd730f1f 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-06-26 11:03:43 +02:00
Jeff Hostetler
c951d56b7a 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-06-26 11:03:43 +02:00
Johannes Schindelin
62a5b244e0 msvc: fix detect_msys_tty()
The ntstatus.h header is only available in MINGW.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-06-26 11:03:43 +02:00
Jeff Hostetler
907f488967 msvc: define ftello()
It is just called different in MSVC's headers.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-06-26 11:03:43 +02:00
Jeff Hostetler
c67aecae07 msvc: do not re-declare the timespec struct
VS2015's headers already declare that struct.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-06-26 11:03:43 +02:00
Johannes Schindelin
2e0f43a2a1 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-06-26 11:03:43 +02:00
Jeff Hostetler
d0703dc228 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-06-26 11:03:43 +02:00
Jeff Hostetler
7f28d30197 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-06-26 11:03:43 +02:00
Jeff Hostetler
ae5145c242 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-06-26 11:03:42 +02:00
Philip Oakley
f39076abfe 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-06-26 11:03:42 +02:00
Philip Oakley
47fca62cb9 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-06-26 11:03:42 +02:00
Philip Oakley
0d028394c9 msvc: include sigset_t definition
On MSVC (VS2008) sigset_t is not defined.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2017-06-26 11:03:42 +02:00
Jeff Hostetler
cef333cf9a msvc: update Makefile and compiler settings for VS2015
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-06-26 11:03:42 +02:00
Jeff Hostetler
69ea22dc36 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>
2017-06-26 11:03:42 +02:00
Jeff Hostetler
fd807ec25e 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
packages.  So, I'm skipping that for now.

We need to be very precise when specifying NuGet package versions: while
nuget.exe auto-completes a version, say, 1.0.2 to 1.0.2.0, we will want
to parse packages.config ourselves, to generate the Visual Studio
solution, and there we need the exact version number to be able to
generate the exact path to the correct .targets file.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-06-26 11:03:42 +02:00
Jeff Hostetler
65417b8a87 msvc: ignore VS2015 trash files
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-06-26 11:03:42 +02:00
Johannes Schindelin
16789efaec 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>
2017-06-26 11:03:42 +02:00
Johannes Schindelin
67c66d2299 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-06-26 11:03:40 +02:00
Johannes Schindelin
843340568c t3701: verify that we can add *lots* of files interactively
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-06-26 11:03:39 +02:00
Johannes Schindelin
fae6fd78b1 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>
2017-06-26 11:03:39 +02:00
Kelly Heller
08f86a4163 Allow add -p and add -i with a large number of files
This fixes https://github.com/msysgit/git/issues/182.

Inspired by Pull Request 218 using code from @PhilipDavis.

[jes: simplified code quite a bit]

Signed-off-by: Kelly Heller <kkheller@cedrus.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-06-26 11:03:39 +02:00
Johannes Schindelin
e4b52c9278 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>
2017-06-26 11:03:39 +02:00
Anton Serbulov
6228d84d7b mingw: fix getcwd when the parent directory cannot be queried
`GetLongPathName()` function may fail when it is unable to query
the parent directory of a path component to determine the long name
for that component. It happens, because of it uses `FindFirstFile()`
function for each next short part of path. The `FindFirstFile()`
requires `List Directory` and `Synchronize` desired access for a calling
process.

In case of lacking such permission for some part of path,
the `GetLongPathName()` returns 0 as result and `GetLastError()`
returns ERROR_ACCESS_DENIED.

`GetFinalPathNameByHandle()` function can help in such cases, because
it requires `Read Attributes` and `Synchronize` desired access to the
target path only.

The `GetFinalPathNameByHandle()` function was introduced on
`Windows Server 2008/Windows Vista`. So we need to load it dynamically.

`CreateFile()` parameters:
    `lpFileName` = path to the current directory
    `dwDesiredAccess` = 0 (it means `Read Attributes` and `Synchronize`)
    `dwShareMode` = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
                    (it prevents `Sharing Violation`)
    `lpSecurityAttributes` = NULL (default security attributes)
    `dwCreationDisposition` = OPEN_EXISTING
                              (required to obtain a directory handle)
    `dwFlagsAndAttributes` = FILE_FLAG_BACKUP_SEMANTICS
                             (required to obtain a directory handle)
    `hTemplateFile` = NULL (when opening an existing file or directory,
                            `CreateFile` ignores this parameter)

The string that is returned by `GetFinalPathNameByHandle()` function
uses the \\?\ syntax. To skip the prefix and convert backslashes
to slashes, the `normalize_ntpath()` mingw function will be used.

Note: `GetFinalPathNameByHandle()` function returns a final path.
It is the path that is returned when a path is fully resolved.
For example, for a symbolic link named "C:\tmp\mydir" that points to
"D:\yourdir", the final path would be "D:\yourdir".

Signed-off-by: Anton Serbulov <aserbulov@plesk.com>
2017-06-26 11:03:37 +02:00