Commit Graph

64223 Commits

Author SHA1 Message Date
Johannes Schindelin
fbc2d3ab70 Merge 'gitk' into HEAD 2016-10-25 17:59:27 +02:00
Johannes Schindelin
45c5493384 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>
2016-10-25 17:59:27 +02:00
Johannes Schindelin
658236ee82 Merge 'git-gui' into HEAD 2016-10-25 17:14:53 +02:00
Johannes Schindelin
ab74e0a638 Merge 'unicode' into HEAD 2016-10-25 17:14:53 +02:00
Johannes Schindelin
43b827b5a5 Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 17:14:53 +02:00
Thomas Klaeger
09bbef6752 git-gui (Windows): use git-bash.exe if it is available
Git for Windows 2.x ships with an executable that starts the Git Bash
with all the environment variables and what not properly set up. It is
also adjusted according to the Terminal emulator option chosen when
installing Git for Windows (while `bash.exe --login -i` would always
launch with Windows' default console).

So let's use that executable (usually C:\Program Files\Git\git-bash.exe)
instead of `bash.exe --login -i` if its presence was detected.

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

Signed-off-by: Thomas Kläger <thomas.klaeger@10a.ch>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 17:14:51 +02:00
Sebastian Schuberth
9184730fad gitk: Use an external icon file on Windows
Git for Windows now ships with the new Git icon from git-scm.com. Use that
icon file if it exists instead of the old procedurally drawn one.

This patch was sent upstream but so far no decision on its inclusion was
made, so commit it to our fork.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2016-10-25 17:14:44 +02:00
Johannes Schindelin
0d43cd213a git gui: set GIT_ASKPASS=git-gui--askpass if not set yet
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 17:14:44 +02:00
Karsten Blees
a7b0617578 git-gui:handle the encoding of Git's output correctly
If we use 'eval exec $opt $cmdp $args' to execute git command,
tcl engine will convert the output of the git comand with the rule
system default code page to unicode.

But cp936 -> unicode conversion implicitly done by exec is not reversible.
So we have to use git_read instead.

Bug report and an original reproducer by Cloud Chou:
https://github.com/msysgit/git/issues/302

Karsten Blees writes this code patch.
Cloud Chou find the reason of the bug.

Thanks-to: dscho
Thanks-to: patthoyts
Signed-off-by: Karsten Blees <blees@dcon.de>
Original-test-by: Cloud Chou <515312382@qq.com>
Signed-off-by: Cloud Chou <515312382@qq.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 17:14:44 +02:00
Chris West (Faux)
4cdb020497 Fix another invocation of git from gitk with an overly long command-line
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2016-10-25 17:14:44 +02:00
Heiko Voigt
8db44d2236 git-gui: provide question helper for retry fallback on Windows
Make use of the new environment variable GIT_ASK_YESNO to support the
recently implemented fallback in case unlink, rename or rmdir fail for
files in use on Windows. The added dialog will present a yes/no question
to the the user which will currently be used by the windows compat layer
to let the user retry a failed file operation.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
2016-10-25 17:14:44 +02:00
Karsten Blees
20133310f4 Unicode file name support (gitk and git-gui)
Assumes file names in git tree objects are UTF-8 encoded.

On most unix systems, the system encoding (and thus the TCL system
encoding) will be UTF-8, so file names will be displayed correctly.

On Windows, it is impossible to set the system encoding to UTF-8. Changing
the TCL system encoding (via 'encoding system ...', e.g. in the startup
code) is explicitly discouraged by the TCL docs.

Change gitk and git-gui functions dealing with file names to always convert
from and to UTF-8.

Signed-off-by: Karsten Blees <blees@dcon.de>
2016-10-25 17:14:44 +02:00
Johannes Schindelin
7a332f422a Work around the command line limit on Windows
On Windows, there are dramatic problems when a command line grows
beyond PATH_MAX, which is restricted to 8191 characters on XP and
later (according to http://support.microsoft.com/kb/830473).

Work around this by just cutting off the command line at that length
(actually, at a space boundary) in the hope that only negative
refs are chucked: gitk will then do unnecessary work, but that is
still better than flashing the gitk window and exiting with exit
status 5 (which no Windows user is able to make sense of).

The first fix caused Tcl to fail to compile the regexp, see msysGit issue
427. Here is another fix without using regexp, and using a more relaxed
command line length limit to fix the original issue 387.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 17:14:44 +02:00
Heiko Voigt
a6ce12f3d0 Revert "git-gui: set GIT_DIR and GIT_WORK_TREE after setup"
This reverts commit a9fa11fe5b.
2016-10-25 17:14:44 +02:00
Brendan Forster
2cc5257b82 Add an issue template
With improvements by Clive Chan and Adric Norris.

Signed-off-by: Clive Chan <cc@clive.io>
Signed-off-by: Adric Norris <landstander668@gmail.com>
Signed-off-by: Brendan Forster <brendan@github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 17:14:43 +02:00
Johannes Schindelin
0b714ebb61 README.md: Add a Windows-specific preamble
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-10-25 17:14:43 +02:00
Johannes Schindelin
0ece3875a7 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>
2016-10-25 17:14:43 +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