Commit Graph

47325 Commits

Author SHA1 Message Date
Thomas Braun
1e0473a198 t1508: Be more clever than msys path substitution
A string of the form "@/abcd" is considered a file path
by the msys layer and therefore translated to a windows path.

Here the trick is to double the slashes.

The msys patch translation can be studied with the following
test program:

 #include <stdio.h>
 #include <stdlib.h>

 int main(int argc, char** argv)
 {
 unsigned int i;
 for(i=1; i < argc; i++)
 	printf("argv[%d]=%s\n",i, argv[i]);

 exit(0);
 }

Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
2014-10-13 17:33:38 +02:00
Thomas Braun
0c03fcc97f t5503: Mark flaky tests as known breakages
As non reliable tests are nasty.

Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
2014-10-13 17:33:38 +02:00
Thomas Braun
5a37902769 t2025: Tell tail explicitly to read from stdin
Our current version of bash 3.1.17(5) can not parse the following snippet
correctly
p=abcd
abspath=/$p
subdir="x$(echo "$p" | tail -c $((253 - ${#abspath})))"
as it returns
tail: cannot open `253' for reading: No such file or directory

This is fixed in bash 3.1.20(4), I did not check earlier versions.

Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
2014-10-13 17:33:38 +02:00
Thomas Braun
232ce5fc3a t5000: Fix CRLF vs LF issue
All CRLF vs LF errors are introduced by the tr tool.

Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
2014-10-13 17:33:37 +02:00
Thomas Braun
c3051dfbd6 Merge pull request #2 from t-b/tb_more_use_of_test_cmp_bin
t9300: use test_cmp_bin instead of test_cmp to compare binary files
2014-10-13 17:33:36 +02:00
Johannes Sixt
0f77827492 t9300: use test_cmp_bin instead of test_cmp to compare binary files
test_cmp is intended to produce diff output for human consumption. The
input in one instance in t9300-fast-import.sh are binary files, however.
Use test_cmp_bin to compare the files.

This was noticed because on Windows we have a special implementation of
test_cmp in pure bash code (to ignore differences due to intermittent CR
in actual output), and bash runs into an infinite loop due to the binary
nature of the input.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-10-13 17:33:35 +02:00
Thomas Braun
ccb6a7ac5c Merge pull request #1 from t-b/new-sdk-fixes
Fixes for the new SDK
2014-10-13 17:33:34 +02:00
Sebastian Schuberth
0f2f24589e Makefile: Set htmldir to match the default HTML docs location under MSYS
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2014-10-13 17:33:33 +02:00
Sebastian Schuberth
895849c943 MinGW: Use MakeMaker to build the Perl libraries
This way the libraries get properly installed into the "site_perl"
directory and we just have to move them out of the "mingw" directory.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2014-10-13 17:33:33 +02:00
Thomas Braun
7d0d5cf4f3 Merge pull request #239 from sschuberth/taskkill
git-gui/gitk: Do not use a Cygwin-specific kill flag on Windows
2014-10-13 17:33:32 +02:00
Sebastian Schuberth
d0243ad1a5 git-gui/gitk: Do not use a Cygwin-specific kill flag on Windows
Windows does not necessarily mean Cygwin, it could also be MSYS. The
latter ships with a version of "kill" that does not understand "-f". In
msysgit this was addressed shipping Cygwin's version of kill.

Properly fix this by using the stock Windows "taskkill" command instead,
which is available since Windows XP Professional.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
2014-10-13 17:33:31 +02:00
Thomas Braun
672abffbd1 Merge pull request #231 from kblees/kb/msysgit-2.1.0
Rebasing merge to Git v2.1.0
2014-10-13 17:33:29 +02:00
Thomas Braun
53ee2b9a6e Merge pull request #122 from kblees/kb/long-paths-v2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-10-13 17:33:28 +02:00
Thomas Braun
52591b9f2a Merge remote-tracking branch 'kblees/kb/fscache-v4-tentative-1.8.5' into thicket-1.8.5.2 2014-10-13 17:33:27 +02:00
Thomas Braun
c9ff21bb3f Merge pull request #181 from kasal/tests-no-posix
Revert "test: fix t7001 cp to use POSIX options"
2014-10-13 17:33:27 +02:00
Thomas Braun
6c5514542f Merge remote-tracking branch 't-b/sideband-bug'
This will allow us to work around the push issues pointed out in
https://github.com/msysgit/git/issues/101.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-10-13 17:33:27 +02:00
Thomas Braun
0ac7ef04d4 Merge pull request #115 from msysgit/tip4commit
Mention tip4commit
2014-10-13 17:33:26 +02:00
Thomas Braun
3d7d03e6b8 Merge 'fix-is-exe' into HEAD 2014-10-13 17:33:26 +02:00
Thomas Braun
99a56399f9 Merge 'fix-externals' into HEAD 2014-10-13 17:33:25 +02:00
Thomas Braun
167d538ac8 Merge 'http-msys-paths' into HEAD 2014-10-13 17:33:25 +02:00
Thomas Braun
01c5df714a 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>
2014-10-13 17:33:24 +02:00
Thomas Braun
d8ce1ae1e9 Merge 'win-tests-fixes' into HEAD 2014-10-13 17:33:24 +02:00
Thomas Braun
88cae5885e Merge branch 'some-CR-fixes'
This branch contains some hacks so that Git produces less CR, and then
some tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-10-13 17:33:23 +02:00
Thomas Braun
9d5839de34 Merge 'pull-rebase-interactive' into HEAD 2014-10-13 17:33:23 +02:00
Thomas Braun
abbd3499b4 Merge 'jberezanski/wincred-sso-r2' into HEAD 2014-10-13 17:33:22 +02:00
Thomas Braun
ddd114f905 Merge 'gitweb-syntax' into HEAD 2014-10-13 17:33:22 +02:00
Thomas Braun
06039426d1 Merge 'gitk' into HEAD 2014-10-13 17:33:22 +02:00
Thomas Braun
a3f4eb96c3 Merge 'git-gui' into HEAD 2014-10-13 17:33:21 +02:00
Thomas Braun
90f2fa804d Merge 'deny-current-branch' into HEAD 2014-10-13 17:33:21 +02:00
Thomas Braun
d82080f91a Merge 'criss-cross-merge' into HEAD 2014-10-13 17:33:20 +02:00
Thomas Braun
e16decf0b8 Merge 'am-submodules' into HEAD 2014-10-13 17:33:20 +02:00
Thomas Braun
411e946374 Merge 'hide-dotgit' into HEAD 2014-10-13 17:33:19 +02:00
Thomas Braun
3075a93e44 Merge 'unicode' into HEAD 2014-10-13 17:33:19 +02:00
Thomas Braun
584641d9b0 Merge 'refs/rewritten/junio/notyet' into HEAD 2014-10-13 17:33:19 +02:00
Karsten Blees
15166c554f Win32: fix 'lstat("dir/")' with long paths
Use a suffciently large buffer to strip the trailing slash.

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-10-13 17:33:17 +02:00
Karsten Blees
db2f8a3186 Win32: support long paths
Windows paths are typically limited to MAX_PATH = 260 characters, even
though the underlying NTFS file system supports paths up to 32,767 chars.
This limitation is also evident in Windows Explorer, cmd.exe and many
other applications (including IDEs).

Particularly annoying is that most Windows APIs return bogus error codes
if a relative path only barely exceeds MAX_PATH in conjunction with the
current directory, e.g. ERROR_PATH_NOT_FOUND / ENOENT instead of the
infinitely more helpful ERROR_FILENAME_EXCED_RANGE / ENAMETOOLONG.

Many Windows wide char APIs support longer than MAX_PATH paths through the
file namespace prefix ('\\?\' or '\\?\UNC\') followed by an absolute path.
Notable exceptions include functions dealing with executables and the
current directory (CreateProcess, LoadLibrary, Get/SetCurrentDirectory) as
well as the entire shell API (ShellExecute, SHGetSpecialFolderPath...).

Introduce a handle_long_path function to check the length of a specified
path properly (and fail with ENAMETOOLONG), and to optionally expand long
paths using the '\\?\' file namespace prefix. Short paths will not be
modified, so we don't need to worry about device names (NUL, CON, AUX).

Contrary to MSDN docs, the GetFullPathNameW function doesn't seem to be
limited to MAX_PATH (at least not on Win7), so we can use it to do the
heavy lifting of the conversion (translate '/' to '\', eliminate '.' and
'..', and make an absolute path).

Add long path error checking to xutftowcs_path for APIs with hard MAX_PATH
limit.

Add a new MAX_LONG_PATH constant and xutftowcs_long_path function for APIs
that support long paths.

While improved error checking is always active, long paths support must be
explicitly enabled via 'core.longpaths' option. This is to prevent end
users to shoot themselves in the foot by checking out files that Windows
Explorer, cmd/bash or their favorite IDE cannot handle.

Test suite:
Test the case is when the full pathname length of a dir is close
to 260 (MAX_PATH).
Bug report and an original reproducer by Andrey Rogozhnikov:
https://github.com/msysgit/git/pull/122#issuecomment-43604199

Thanks-to: Martin W. Kirst <maki@bitkings.de>
Thanks-to: Doug Kelly <dougk.ff7@gmail.com>
Signed-off-by: Karsten Blees <blees@dcon.de>
Original-test-by: Andrey Rogozhnikov <rogozhnikov.andrey@gmail.com>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-10-13 17:33:17 +02:00
Doug Kelly
b2d06e4714 Add a test demonstrating a problem with long submodule paths
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-10-13 17:33:16 +02:00
Karsten Blees
a9d97f2d75 fscache: load directories only once
If multiple threads access a directory that is not yet in the cache, the
directory will be loaded by each thread. Only one of the results is added
to the cache, all others are leaked. This wastes performance and memory.

On cache miss, add a future object to the cache to indicate that the
directory is currently being loaded. Subsequent threads register themselves
with the future object and wait. When the first thread has loaded the
directory, it replaces the future object with the result and notifies
waiting threads.

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-10-13 17:33:15 +02:00
Karsten Blees
07e8f3a55e Win32: add a cache below mingw's lstat and dirent implementations
Checking the work tree status is quite slow on Windows, due to slow lstat
emulation (git calls lstat once for each file in the index). Windows
operating system APIs seem to be much better at scanning the status
of entire directories than checking single files.

Add an lstat implementation that uses a cache for lstat data. Cache misses
read the entire parent directory and add it to the cache. Subsequent lstat
calls for the same directory are served directly from the cache.

Also implement opendir / readdir / closedir so that they create and use
directory listings in the cache.

The cache doesn't track file system changes and doesn't plug into any
modifying file APIs, so it has to be explicitly enabled for git functions
that don't modify the working copy.

Note: in an earlier version of this patch, the cache was always active and
tracked file system changes via ReadDirectoryChangesW. However, this was
much more complex and had negative impact on the performance of modifying
git commands such as 'git checkout'.

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-10-13 17:33:15 +02:00
Karsten Blees
74f168c593 add infrastructure for read-only file system level caches
Add a macro to mark code sections that only read from the file system,
along with a config option and documentation.

This facilitates implementation of relatively simple file system level
caches without the need to synchronize with the file system.

Enable read-only sections for 'git status' and preload_index.

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-10-13 17:33:14 +02:00
Karsten Blees
56cb254381 Win32: make the lstat implementation pluggable
Emulating the POSIX lstat API on Windows via GetFileAttributes[Ex] is quite
slow. Windows operating system APIs seem to be much better at scanning the
status of entire directories than checking single files. A caching
implementation may improve performance by bulk-reading entire directories
or reusing data obtained via opendir / readdir.

Make the lstat implementation pluggable so that it can be switched at
runtime, e.g. based on a config option.

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-10-13 17:33:14 +02:00
Karsten Blees
04daa4d877 Win32: Make the dirent implementation pluggable
Emulating the POSIX dirent API on Windows via FindFirstFile/FindNextFile is
pretty staightforward, however, most of the information provided in the
WIN32_FIND_DATA structure is thrown away in the process. A more
sophisticated implementation may cache this data, e.g. for later reuse in
calls to lstat.

Make the dirent implementation pluggable so that it can be switched at
runtime, e.g. based on a config option.

Define a base DIR structure with pointers to readdir/closedir that match
the opendir implementation (i.e. similar to vtable pointers in OOP).
Define readdir/closedir so that they call the function pointers in the DIR
structure. This allows to choose the opendir implementation on a
call-by-call basis.

Move the fixed sized dirent.d_name buffer to the dirent-specific DIR
structure, as d_name may be implementation specific (e.g. a caching
implementation may just set d_name to point into the cache instead of
copying the entire file name string).

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-10-13 17:33:14 +02:00
Karsten Blees
58300dd95d Win32: dirent.c: Move opendir down
Move opendir down in preparation for the next patch.

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-10-13 17:33:13 +02:00
Karsten Blees
33a107845c Win32: make FILETIME conversion functions public
Signed-off-by: Karsten Blees <blees@dcon.de>
2014-10-13 17:33:13 +02:00
Stepan Kasal
9233472fd7 Revert "test: fix t7001 cp to use POSIX options"
This reverts commit 00764ca1, as our ancient version of "cp" has
problems about the "new" POSIX option "-P" (yields exit code 1).
2014-10-13 17:33:12 +02:00
Thomas Braun
4b04f46787 Config option to disable side-band-64k for transport
Since commit 0c499ea60f the send-pack builtin uses the side-band-64k
capability if advertised by the server.

Unfortunately this breaks pushing over the dump git protocol if used
over a network connection.

The detailed reasons for this breakage are (by courtesy of Jeff Preshing,
quoted from ttps://groups.google.com/d/msg/msysgit/at8D7J-h7mw/eaLujILGUWoJ):
----------------------------------------------------------------------------
MinGW wraps Windows sockets in CRT file descriptors in order to mimic the
functionality of POSIX sockets. This causes msvcrt.dll to treat sockets as
Installable File System (IFS) handles, calling ReadFile, WriteFile,
DuplicateHandle and CloseHandle on them. This approach works well in simple
cases on recent versions of Windows, but does not support all usage patterns.
In particular, using this approach, any attempt to read & write concurrently
on the same socket (from one or more processes) will deadlock in a scenario
where the read waits for a response from the server which is only invoked after
the write. This is what send_pack currently attempts to do in the use_sideband
codepath.
----------------------------------------------------------------------------

The new config option "sendpack.sideband" allows to override the side-band-64k
capability of the server, and thus makes the dump git protocol work.

Other transportation methods like ssh and http/https still benefit from
the sideband channel, therefore the default value of "sendpack.sideband"
is still true.

Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
2014-10-13 17:33:11 +02:00
Johannes Schindelin
28441fa7a5 Add a README.md
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-10-13 17:33:09 +02:00
Heiko Voigt
3f1b12b455 help: correct behavior for is_executable on Windows
The previous implementation said that the filesystem information on
Windows is not reliable to determine whether a file is executable.
To find gather this information it was peeking into the first two bytes
of a file to see whether it looks executable.
Apart from the fact that on Windows executables are usually defined as
such by their extension it lead to slow opening of help file in some
situations.

When you have virus scanner running calling open on an executable file
is a potentially expensive operation. See the following measurements (in
seconds) for example.

With virus scanner running (coldcache):

$ ./a.exe /libexec/git-core/
before open (git-add.exe): 0.000000
after open (git-add.exe): 0.412873
before open (git-annotate.exe): 0.000175
after open (git-annotate.exe): 0.397925
before open (git-apply.exe): 0.000243
after open (git-apply.exe): 0.399996
before open (git-archive.exe): 0.000147
after open (git-archive.exe): 0.397783
before open (git-bisect--helper.exe): 0.000160
after open (git-bisect--helper.exe): 0.397700
before open (git-blame.exe): 0.000160
after open (git-blame.exe): 0.399136
...

With virus scanner running (hotcache):

$ ./a.exe /libexec/git-core/
before open (git-add.exe): 0.000000
after open (git-add.exe): 0.000325
before open (git-annotate.exe): 0.000229
after open (git-annotate.exe): 0.000177
before open (git-apply.exe): 0.000167
after open (git-apply.exe): 0.000150
before open (git-archive.exe): 0.000154
after open (git-archive.exe): 0.000156
before open (git-bisect--helper.exe): 0.000132
after open (git-bisect--helper.exe): 0.000180
before open (git-blame.exe): 0.000718
after open (git-blame.exe): 0.000724
...

This test did just list the given directory and open() each file in it.

With this patch I get:

$ time git help git
Launching default browser to display HTML ...

real    0m8.723s
user    0m0.000s
sys     0m0.000s

and without

$ time git help git
Launching default browser to display HTML ...

real    1m37.734s
user    0m0.000s
sys     0m0.031s

both tests with cold cache and giving the machine some time to settle
down after restart.

Signed-off-by: Heiko Voigt <heiko.voigt@mahr.de>
2014-10-13 17:33:08 +02:00
Adam Roben
fe56854658 Make non-.exe externals work again
7ebac8cb94 made launching of .exe
externals work when installed in Unicode paths. But it broke launching
of non-.exe externals, no matter where they were installed. We now
correctly maintain the UTF-8 and UTF-16 paths in tandem in lookup_prog.

This fixes t5526, among others.

Signed-off-by: Adam Roben <adam@roben.org>
2014-10-13 17:33:07 +02:00
Adam Roben
74ea9784ff Fix launching of externals from Unicode paths
If Git were installed in a path containing non-ASCII characters,
commands such as git-am and git-submodule, which are implemented as
externals, would fail to launch with the following error:

> fatal: 'am' appears to be a git command, but we were not
> able to execute it. Maybe git-am is broken?

This was due to lookup_prog not being Unicode-aware. It was somehow
missed in 2ee5a1a14a.

Note that the only problem in this function was calling
GetFileAttributes instead of GetFileAttributesW. The calls to access()
were fine because access() is a macro which resolves to mingw_access,
which already handles Unicode correctly. But I changed lookup_prog to
use _waccess directly so that we only convert the path to UTF-16 once.

Signed-off-by: Adam Roben <adam@roben.org>
2014-10-13 17:33:06 +02:00