Commit Graph

46049 Commits

Author SHA1 Message Date
Stepan Kasal
44806b02f2 Merge remote-tracking branch 'kblees/kb/fscache-v4-tentative-1.8.5' into thicket-1.8.5.2 2014-05-29 11:09:36 +02:00
Stepan Kasal
0346eed1fe Merge pull request #181 from kasal/tests-no-posix
Revert "test: fix t7001 cp to use POSIX options"
2014-05-29 11:09:35 +02:00
Stepan Kasal
81065695fa 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-05-29 11:09:33 +02:00
Stepan Kasal
8dd46ca5c6 Merge pull request #115 from msysgit/tip4commit
Mention tip4commit
2014-05-29 11:09:32 +02:00
Stepan Kasal
e98b901a56 Merge 'fix-is-exe' into HEAD 2014-05-29 11:09:31 +02:00
Stepan Kasal
eea0cd30b9 Merge 'fix-externals' into HEAD 2014-05-29 11:09:29 +02:00
Stepan Kasal
d7f09b8796 Merge 'http-msys-paths' into HEAD 2014-05-29 11:09:28 +02:00
Stepan Kasal
22f90c0851 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-05-29 11:09:26 +02:00
Stepan Kasal
d9608ecaa2 Merge 'win-tests-fixes' into HEAD 2014-05-29 11:09:25 +02:00
Stepan Kasal
5fc80b71bb 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-05-29 11:09:24 +02:00
Stepan Kasal
8746a0e5f3 Merge 'pull-rebase-interactive' into HEAD 2014-05-29 11:09:22 +02:00
Stepan Kasal
cd247ada61 Merge 'send-email' into HEAD 2014-05-29 11:09:21 +02:00
Stepan Kasal
9dd0c91441 Merge 'jberezanski/wincred-sso-r2' into HEAD 2014-05-29 11:09:19 +02:00
Stepan Kasal
146e000abe Merge 'gitweb-syntax' into HEAD 2014-05-29 11:09:18 +02:00
Stepan Kasal
83d825b573 Merge 'gitk' into HEAD 2014-05-29 11:09:16 +02:00
Stepan Kasal
900f993cb1 Merge 'git-gui' into HEAD 2014-05-29 11:09:15 +02:00
Stepan Kasal
32143d9161 Merge 'deny-current-branch' into HEAD 2014-05-29 11:09:14 +02:00
Stepan Kasal
fb0f5d14bc Merge 'criss-cross-merge' into HEAD 2014-05-29 11:09:12 +02:00
Stepan Kasal
82c8da7c74 Merge 'am-submodules' into HEAD 2014-05-29 11:09:11 +02:00
Stepan Kasal
2e69421a65 Merge 'home' into HEAD 2014-05-29 11:08:05 +02:00
Stepan Kasal
9e8817c4d0 Merge 'hide-dotgit' into HEAD 2014-05-29 10:58:53 +02:00
Stepan Kasal
dc63934ed3 Merge 'unicode' into HEAD 2014-05-29 10:58:25 +02:00
Stepan Kasal
6ac4a73cc8 Merge 'refs/rewritten/junio/notyet' into HEAD 2014-05-29 10:55:42 +02:00
Stepan Kasal
674dd13590 Merge 'refs/rewritten/junio/next' into HEAD 2014-05-29 10:55:41 +02:00
Karsten Blees
1823b88701 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-05-29 10:42:38 +02:00
Karsten Blees
e4629442a4 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-05-29 10:42:36 +02:00
Stepan Kasal
0ac3c91323 Merge 'home' into HEAD 2014-05-29 10:42:35 +02:00
Karsten Blees
5e96acf16e 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-05-29 10:42:34 +02:00
Karsten Blees
bab79360dd 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-05-29 10:42:33 +02:00
Karsten Blees
12624693a1 Win32: dirent.c: Move opendir down
Move opendir down in preparation for the next patch.

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-05-29 10:42:31 +02:00
Karsten Blees
52fa661271 Win32: make FILETIME conversion functions public
Signed-off-by: Karsten Blees <blees@dcon.de>
2014-05-29 10:42:30 +02:00
Stepan Kasal
6d3e23d45c 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-05-29 10:42:27 +02:00
Thomas Braun
9f0af82932 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-05-29 10:42:22 +02:00
Johannes Schindelin
705b6ee33f Add a README.md
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-29 10:42:19 +02:00
Heiko Voigt
a1d1b7120e 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-05-29 10:42:15 +02:00
Adam Roben
1b8301f0fa 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-05-29 10:42:11 +02:00
Adam Roben
7ed7c525db 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-05-29 10:42:10 +02:00
Evgeny Pashkin
5868bd1869 Fixed wrong path delimiter in exe finding
On Windows XP3 in git bash
git clone git@github.com:octocat/Spoon-Knife.git
cd Spoon-Knife
git gui
menu Remote\Fetch from\origin
error: cannot spawn git: No such file or directory
error: could not run rev-list

if u run
git fetch --all
it worked normal in git bash or gitgui tools

In second version CreateProcess get 'C:\Git\libexec\git-core/git.exe' in
first version - C:/Git/libexec/git-core/git.exe and not executes (unix
slashes)

after fixing C:\Git\libexec\git-core\git.exe or
C:/Git/libexec/git-core\git.exe it works normal

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-29 10:42:09 +02:00
Johannes Schindelin
b14ce6effd Handle http.* config variables pointing to files gracefully on Windows
On Windows, we would like to be able to have a default http.sslCAinfo
that points to an MSys path (i.e. relative to the installation root of
Git).  As Git is a MinGW program, it has to handle the conversion
of the MSys path into a MinGW32 path itself.

Since system_path() considers paths starting with '/' as absolute, we
have to convince it to make a Windows path by stripping the leading
slash.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-29 10:42:05 +02:00
Johannes Schindelin
635328c5b0 Always auto-gc after calling a fast-import transport
After importing anything with fast-import, we should always let the
garbage collector do its job, since the objects are written to disk
inefficiently.

This brings down an initial import of http://selenic.com/hg from about
230 megabytes to about 14.

In the future, we may want to make this configurable on a per-remote
basis, or maybe teach fast-import about it in the first place.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-29 10:42:01 +02:00
Sverre Rabbelier
e32da277db remote-helper: check helper status after import/export
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
2014-05-29 10:42:00 +02:00
Sverre Rabbelier
df8dfa30fe transport-helper: add trailing --
[PT: ensure we add an additional element to the argv array]
2014-05-29 10:41:59 +02:00
Johannes Schindelin
b1a3988796 fast-export: do not refer to non-existing marks
When calling `git fast-export a..a b` when a and b refer to the same
commit, nothing would be exported, and an incorrect reset line would
be printed for b ('from :0').

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
2014-05-29 10:41:58 +02:00
Pat Thoyts
1ad487cf5b tests: do not pass iso8859-1 encoded parameter
git commit -m with some iso8859-1 encoded stuff is doomed to fail in MinGW,
because Windows don't let you pass encoded bytes to a process (CreateProcessW
always takes a UTF-16LE encoded string).

It is safe to pass the iso8859-1 message using a file or a pipe.

Thanks-to: Karsten Blees <blees@dcon.de>
Author: Stepan Kasal <kasal@ucw.cz>
2014-05-29 10:41:54 +02:00
Johannes Schindelin
5b682f1af8 Disable t0110's high-bit test on Windows
The bash Git for Windows uses (i.e. the MSys bash) cannot pass
command-line arguments with high bits set verbatim to non-MSys programs,
but instead converts those characters with high bits set to their hex
representation.

For example, when running

	strings "$(echo -e '\x80')"

(where strings.exe is a MinGW program, not an MSys one) it will complain
about not finding the file called "80".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-29 10:41:53 +02:00
Pat Thoyts
0ece80f0ca t9902: mingw-specific fix for gitfile link files
The path in a .git platform independent link file needs to be absolute
and under mingw we need it to be a windows type path, not a unix style
path so it should start with a drive letter and not a /.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-05-29 10:41:52 +02:00
Karsten Blees
e4aba7b46b t800[12]: work around MSys limitation
MSys works very hard to convert Unix-style paths into DOS-style ones.
*Very* hard.

So hard, indeed, that

	git blame -L/hello/,/green/

is translated into something like

	git blame -LC:/msysgit/hello/,C:/msysgit/green/

As seen in msys_p2w in src\msys\msys\rt\src\winsup\cygwin\path.cc, line
3204ff:

	case '-':
	  //
	  // here we check for POSIX paths as attributes to a POSIX switch.
	  //
	...

seemingly absolute POSIX paths in single-letter options get expanded by
msys.dll unless they contain '=' or ';'.

So a quick and very dirty fix is to use '-L/;*evil/'. (Using an equal sign
works only when it is before a comma, so in the above example, /=*green/
would still be converted to a DOS-style path.)

Commit-message-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-29 10:41:51 +02:00
Pat Thoyts
566b373f0d t4210: skip command-line encoding tests on mingw
On Windows the application command line is provided as unicode and in
mingw-git we convert that to utf-8. So these tests that require a iso-8859-1
input are being subverted by the encoding transformations we perform and
should be skipped.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-05-29 10:41:50 +02:00
Pat Thoyts
9f3afbc3f6 t0008: avoid absolute path on Windows as colon is used in the tests
The test separator char is a colon which means any absolute paths on windows
confuse the tests that use global_excludes.

Suggested-by: Karsten Blees <karsten.blees@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2014-05-29 10:41:49 +02:00
Johannes Schindelin
e2e62cef29 Work around a problem identified by BuildHive
Apparently the signal handling is not quite correct in the fsckobject
handling (most likely we rely on a side effect that lets us still output
some message after receiving a signal 13 but in the BuildHive setup this
fails intermittently).

As a consequence, the push in t5504 does fail as expected, but fails to
output anything (unexpected). Since this is good enough for now, let's
handle an empty output as success, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-29 10:41:47 +02:00