Commit Graph

64207 Commits

Author SHA1 Message Date
Adric Norris
b2ecdc178c Preliminary support for reporting build platform
Add preliminary support for detection of the build plaform, and reporting
of same with the `git version --build-options' command. This can be useful
for bug reporting, to distinguish between 32 and 64-bit builds for
example.

The current implementation can only distinguish between x86 and x86_64.
This will be extended in future patches. In addition, all 32-bit variants
(i686, i586, etc.) are collapsed into `x86'. An example of the output is:

   $ git version --build-options
   git version 2.9.3.windows.2.826.g06c0f2f
   sizeof-long: 4
   machine: x86_64

The label of `machine' was chosen so the new information will approximate
the output of `uname -m'.

Signed-off-by: Adric Norris <landstander668@gmail.com>
2016-10-25 17:46:29 +02:00
Johannes Schindelin
07d122372e Start the merging-rebase to junio/maint
This commit starts the rebase of 62f3116 to 23415c2

This is just an intermediate rebase, used as an excuse for a little bit
of cleanup:

- a patch was moved from win-test-fixes to remote-hg-prerequisites,
  where it really belongs

- the interactive-rebase branch thicket and the status-v2-porcelain
  patch series have been updated to their newest respective iterations.

- rebased jeffhostetler/vs2015 to make it easier to upstream the
  patches.

- the "use OpenSSL's SHA-1 routines for a nice speedup" patch got an
  updated commit message and was moved to the msys2 patches.

- the cat-file-filters branch was updated to its latest iteration.

- the mingw/default-ident patch series was moved closer to the front, so
  that it can be upstreamed before the more complicated patch series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 17:14:28 +02:00
Philip Oakley
a11637f390 doc: fix the 'revert a faulty merge' ASCII art tab spacing
The asciidoctor doc-tool stack does not always respect the 'tab = 8 spaces' rule
expectation, particularly for the Git-for-Windows generated html pages. This
follows on from the 'doc: fix merge-base ASCII art tab spacing' fix.

Use just spaces within the block of the ascii art.

All other *.txt ascii art containing three dashes has been checked.
Asciidoctor correctly formats the other art blocks that do contain tabs.

Signed-off-by: Philip Oakley <philipoakley@iee.org
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 13:54:02 +02:00
Johannes Schindelin
86b471426e fixup! help: correct behavior for is_executable on Windows 2016-10-25 13:53:53 +02:00
Johannes Schindelin
dba99713e9 Merge pull request #773 from jeffhostetler/vs2015
Build with VS2015
2016-10-25 10:39:17 +02:00
Johannes Schindelin
c0abebad2c 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-24 15:48:41 -04:00
Johannes Schindelin
be11f2da2c 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-24 15:48:41 -04:00
Johannes Schindelin
b24dff6b65 msvc: use libiconv
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-24 15:48:40 -04:00
Jeff Hostetler
026e29f280 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-24 15:48:40 -04:00
Johannes Schindelin
1af1417f56 msvc: respect the quiet-by-default output
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-24 15:48:40 -04:00
Jeff Hostetler
ace8bd636c 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-24 15:46:49 -04:00
Jeff Hostetler
4f0579e160 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-24 09:06:01 -07:00
Jeff Hostetler
46d84bb04e 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-24 09:06:01 -07:00
Jeff Hostetler
b9a0f8e268 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-24 09:06:01 -07:00
Jeff Hostetler
69b6ea107b msvc: define ftello()
It is just called different in MSVC's headers.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-24 09:06:01 -07:00
Jeff Hostetler
8a1aac480d 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-24 09:06:00 -07:00
Jeff Hostetler
1e5cef4c5d 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-24 09:06:00 -07:00
Jeff Hostetler
07db451564 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-24 09:06:00 -07:00
Jeff Hostetler
b9eaf91e32 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-24 09:05:59 -07:00
Jeff Hostetler
e9fe955af2 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-24 09:05:59 -07:00
Philip Oakley
077e076d67 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-24 17:52:33 +02:00
Philip Oakley
9062230350 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-24 17:52:33 +02:00
Philip Oakley
a29a15dba9 msvc: include sigset_t definition
On MSVC (VS2008) sigset_t is not defined.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2016-10-24 17:52:33 +02:00
Jeff Hostetler
7388541120 msvc: update Makefile and compiler settings for VS2015
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-24 17:52:33 +02:00
Jeff Hostetler
657fbde25c 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-24 17:52:33 +02:00
Jeff Hostetler
0e3819ae03 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-24 17:52:33 +02:00
Jeff Hostetler
eb37e16718 msvc: ignore VS2015 trash files
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-20 06:37:24 -07:00
Johannes Schindelin
2103fc66e2 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-20 06:37:23 -07:00
Junio C Hamano
23415c26fe Merge tag 'l10n-2.10.0-rnd2.4' of git://github.com/git-l10n/git-po into maint
l10n-2.10.0-rnd2.4

* tag 'l10n-2.10.0-rnd2.4' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 260 new messages
  l10n: de.po: fix translation of autostash
  l10n: ru.po: update Russian translation
2016-10-17 13:27:38 -07:00
Jiang Xin
4dc2ce92fa Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ru
* 'russian-l10n' of https://github.com/DJm00n/git-po-ru:
  l10n: ru.po: update Russian translation
2016-10-16 20:11:41 +08:00
Johannes Schindelin
6a6c0e8472 Merge branch 'reset-stdin'
This topic branch adds the (experimental) --stdin/-z options to `git
reset`. Those patches are still under review in the upstream Git project,
but are already merged in their experimental form into Git for Windows'
`master` branch, in preparation for a MinGit-only release.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:29:11 +02:00
Johannes Schindelin
f4a3a150e4 Merge pull request #915 from jeffhostetler/jeffhostetler/g4w_use_openssl_sha1
sha1: use openssl sha1 routines on mingw
2016-10-13 14:28:08 +02:00
Jeff Hostetler
1e2ce1ddbe sha1: Use OpenSSL SHA1 routines on MINGW
Use OpenSSL SHA1 routines rather than builtin block-sha1 routines.
This improves performance on SHA1 operations on Intel processors.

OpenSSL 1.0.2 has made considerable performance improvements and
support the Intel hardware acceleration features.  See:
https://software.intel.com/en-us/articles/improving-openssl-performance
https://software.intel.com/en-us/articles/intel-sha-extensions

To test this I added/staged a single file in a gigantic
repository having a 450MB index file.  The code in read-cache.c
verifies the header SHA as it reads the index and computes a new
header SHA as it writes out the new index.  Therefore, in this test
the SHA code must process 900MB of data.  Testing was done on an
Intel I7-4770 CPU @ 3.40GHz (Intel64, Family 6, Model 60) CPU.

The block-sha1 version averaged 5.27 seconds.
The OpenSSL    version averaged 4.50 seconds.

================================================================

$ echo xxx >> project.mk
$ time /e/blk_sha/bin/git.exe add project.mk

real    0m5.207s
user    0m0.000s
sys     0m0.250s

$ echo xxx >> project.mk
$ time /e/blk_sha/bin/git.exe add project.mk

real    0m5.362s
user    0m0.015s
sys     0m0.234s

$ echo xxx >> project.mk
$ time /e/blk_sha/bin/git.exe add project.mk

real    0m5.300s
user    0m0.016s
sys     0m0.250s

$ echo xxx >> project.mk
$ time /e/blk_sha/bin/git.exe add project.mk

real    0m5.216s
user    0m0.000s
sys     0m0.250s

================================================================
$ echo xxx >> project.mk
$ time /e/openssl/bin/git.exe add project.mk

real    0m4.431s
user    0m0.000s
sys     0m0.250s

$ echo xxx >> project.mk
$ time /e/openssl/bin/git.exe add project.mk

real    0m4.478s
user    0m0.000s
sys     0m0.265s

$ echo xxx >> project.mk
$ time /e/openssl/bin/git.exe add project.mk

real    0m4.690s
user    0m0.000s
sys     0m0.250s

$ echo xxx >> project.mk
$ time /e/openssl/bin/git.exe add project.mk

real    0m4.420s
user    0m0.000s
sys     0m0.234s

================================================================

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2016-10-13 14:28:07 +02:00
Johannes Schindelin
a2f4fef441 Merge branch 'pt/git4win-mods' of https://github.com/patthoyts/git-gui
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:28:06 +02:00
Johannes Schindelin
bfca8ed51a Merge branch 'mingw-strftime'
This topic branch works around an out-of-memory bug when the user
specified a format via --date=format:<format> that strftime() does
not like.

Reported by Stefan Naewe.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:28:05 +02:00
Johannes Schindelin
707394e699 Unbreak interactive GPG prompt upon signing
With the recent update in efee955 (gpg-interface: check gpg signature
creation status, 2016-06-17), we ask GPG to send all status updates to
stderr, and then catch the stderr in an strbuf.

But GPG might fail, and send error messages to stderr. And we simply
do not show them to the user.

Even worse: this swallows any interactive prompt for a passphrase. And
detaches stderr from the tty so that the passphrase cannot be read.

So while the first problem could be fixed (by printing the captured
stderr upon error), the second problem cannot be easily fixed, and
presents a major regression.

So let's just revert commit efee9553a4.

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

Cc: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:28:05 +02:00
Johannes Schindelin
82838bc945 Merge pull request #866 from landstander668/add_platform
Add reporting of build platform
2016-10-13 14:28:04 +02:00
Johannes Schindelin
6cc1881470 Merge branch 'interactive-rebase'
This series of branches introduces the git-rebase--helper, a builtin
helping to accelerate the interactive rebase dramatically.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:28:04 +02:00
Pat Thoyts
235860a368 git-gui (Windows): use git-gui.exe in Create Desktop Shortcut
When calling `Repository>Create Desktop Shortcut`, Git GUI assumes
that it is okay to call `wish.exe` directly on Windows. However, in
Git for Windows 2.x' context, that leaves several crucial environment
variables uninitialized, resulting in a shortcut that does not work.

To fix those environment variable woes, Git for Windows comes with a
convenient `git-gui.exe`, so let's just use it when it is available.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:28:02 +02:00
Pat Thoyts
00ff9dd1c0 git-gui: fix detection of Cygwin
MSys2 might *look* like Cygwin, but it is *not* Cygwin... Unless it
is run with `MSYSTEM=MSYS`, that is.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:28:02 +02:00
Johannes Schindelin
575e5b33f8 mingw: abort on invalid strftime formats
On Windows, strftime() does not silently ignore invalid formats, but
warns about them and then returns 0 and sets errno to EINVAL.

Unfortunately, Git does not expect such a behavior, as it disagrees
with strftime()'s semantics on Linux. As a consequence, Git
misinterprets the return value 0 as "I need more space" and grows the
buffer. As the larger buffer does not fix the format, the buffer grows
and grows and grows until we are out of memory and abort.

Ideally, we would switch off the parameter validation just for
strftime(), but we cannot even override the invalid parameter handler
via _set_thread_local_invalid_parameter_handler() using MINGW because
that function is not declared. Even _set_invalid_parameter_handler(),
which *is* declared, does not help, as it simply does... nothing.

So let's just bite the bullet and override strftime() for MINGW and
abort on an invalid format string. While this does not provide the
best user experience, it is the best we can do.

See https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx for more
details.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:28:01 +02:00
Adric Norris
e6ad043f16 Preliminary support for reporting build platform
Add preliminary support for detection of the build plaform, and reporting
of same with the `git version --build-options' command. This can be useful
for bug reporting, to distinguish between 32 and 64-bit builds for
example.

The current implementation can only distinguish between x86 and x86_64.
This will be extended in future patches. In addition, all 32-bit variants
(i686, i586, etc.) are collapsed into `x86'. An example of the output is:

   $ git version --build-options
   git version 2.9.3.windows.2.826.g06c0f2f
   sizeof-long: 4
   machine: x86_64

The label of `machine' was chosen so the new information will approximate
the output of `uname -m'.

Signed-off-by: Adric Norris <landstander668@gmail.com>
2016-10-13 14:28:00 +02:00
Johannes Schindelin
3f947ce113 Merge 'cat-file-filters'
This topic branch adds the support for --filters (TAFKA --smudge) and
--path (TAFKA --use-path).

While at it, we also add support for --filters/--textconv in --batch mode
(the input lines now need to contain the path in addition to the object
name, separated by a single white space character).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:27:59 +02:00
Johannes Schindelin
dcc67c3dad Merge branch 'unhidden-git'
It has been reported that core.hideDotFiles=false stopped working...
This topic branch fixes it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:27:59 +02:00
Johannes Schindelin
e113139ba3 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>
2016-10-13 14:27:58 +02:00
Johannes Schindelin
fa425b3d2a Merge 'jh/status-v2-porcelain'
Backported onto `maint` by me...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:27:57 +02:00
Johannes Schindelin
65ecf93111 Merge pull request #797 from glhez/master
`git bundle create <bundle>` leaks handle the revlist is empty.
2016-10-13 14:27:56 +02:00
Johannes Schindelin
2a52dff983 Merge 'release-gc-repack' into HEAD 2016-10-13 14:27:56 +02:00
Johannes Schindelin
ce2eaf3334 Merge pull request #726 from orgads/git-gui-preserve-author-windows
git-gui: Do not reset author details on amend
2016-10-13 14:27:55 +02:00
Johannes Schindelin
55bdf4f9ad Merge branch 'spawn-with-spaces'
This change lets us spawn .bat scripts whose paths contain spaces.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-13 14:27:54 +02:00