Commit Graph

58537 Commits

Author SHA1 Message Date
Karsten Blees
8fbc5bb3ec 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>
2016-04-04 08:02:18 +02:00
Karsten Blees
f16b677633 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>
2016-04-04 08:02:17 +02:00
Karsten Blees
7f9a6c2fde 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>
2016-04-04 08:02:16 +02:00
Karsten Blees
b2a0ca071a 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>
2016-04-04 08:02:16 +02:00
Karsten Blees
eb2a2311c9 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>
2016-04-04 08:02:15 +02:00
Karsten Blees
009513ec02 Win32: dirent.c: Move opendir down
Move opendir down in preparation for the next patch.

Signed-off-by: Karsten Blees <blees@dcon.de>
2016-04-04 08:02:14 +02:00
Karsten Blees
b5f2d54f0d Win32: make FILETIME conversion functions public
Signed-off-by: Karsten Blees <blees@dcon.de>
2016-04-04 08:02:14 +02:00
Pat Thoyts
3bcdaecf84 mingw: add tests for the hidden attribute on the git directory
With msysGit the .git directory is supposed to be hidden, unless it is
a bare git repository. Test this.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2016-04-04 08:02:05 +02:00
Johannes Schindelin
16ca5c88ed When initializing .git/, record the current setting of core.hideDotFiles
This is on Windows only, of course.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-04-04 08:02:05 +02:00
Erik Faye-Lund
0abc989443 core.hideDotFiles: hide '.git' dir by default
At least for cross-platform projects, it makes sense to hide the
files starting with a dot, as this is the behavior on Unix/MacOSX.

However, at least Eclipse has problems interpreting the hidden flag
correctly, so the default is to hide only the .git/ directory.

The config setting core.hideDotFiles therefore supports not only
'true' and 'false', but also 'dotGitOnly'.

[jes: clarified the commit message, made git init respect the setting
by marking the .git/ directory only after reading the config, and added
documentation, and rebased on top of current junio/next]

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-04-04 08:02:04 +02:00
Johannes Schindelin
d80fc90904 mingw: mark t9100's test cases with appropriate prereqs
Many a test requires either POSIXPERM (to change the executable bit) or
SYMLINKS, and neither are available on Windows.

This lets t9100-git-svn-basic.sh pass in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-04-04 08:02:01 +02:00
Johannes Schindelin
47571a6769 Start the merging-rebase to v2.8.1
This commit starts the rebase of 5840b06 to fdeee3d
2016-04-04 08:02:00 +02:00
Johannes Schindelin
dfa7d5a9aa fixup! DEBUG
This was a commit not intended for `master`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-04-04 07:59:36 +02:00
Junio C Hamano
d95553a6b8 Git 2.8.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v2.8.1
2016-04-03 10:14:12 -07:00
Junio C Hamano
6e4de7fca3 Merge branch 'mm/readme-markdown' into maint
* 'mm/readme-markdown':
  git.spec.in: use README.md, not README
2016-04-03 10:13:09 -07:00
Matthieu Moy
c7089e0ee9 git.spec.in: use README.md, not README
The file was renamed in 4ad21f5 (README: use markdown syntax,
2016-02-25), but that commit forgot to update git.spec.in, which
caused the rpmbuild target in the Makefile to fail.

Reported-by: Ron Isaacson <isaacson.ljits@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-03 10:12:48 -07:00
Johannes Schindelin
71c3301cac Merge pull request #661 from shiftkey/patch-1
Update CONTRIBUTING.md to Contributor Covenant v1.4
2016-04-02 14:12:11 +02:00
Johannes Schindelin
af5a5e06e5 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-04-02 13:51:48 +02:00
Johannes Schindelin
8086988cd7 mingw: support spawning programs containing spaces in their names
The CreateProcessW() function does not really support spaces in its
first argument, lpApplicationName. But it supports passing NULL as
lpApplicationName, which makes it figure out the application from the
(possibly quoted) first argument of lpCommandLine.

Let's use that trick (if we are certain that the first argument matches
the executable's path) to support launching programs whose path contains
spaces.

This fixes https://github.com/git-for-windows/git/issue/692

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-04-02 13:07:13 +02:00
Johannes Schindelin
29d557eaa5 DEBUG
GDB cannot handle executables compiled with ASLR support, and it has
serious problems figuring out source code locations corresponding to the
current instruction pointer when compiled with -O2.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-04-02 13:05:50 +02:00
Johannes Schindelin
fce9915e62 Merge pull request #677 from yaras/fix-git-675
Fixed masking username with asterisks when reading credentials
2016-03-29 10:27:20 +02:00
Johannes Schindelin
2c979b21b3 Merge pull request #665 from yaras/fix-git-664
Fix initial git gui message encoding
2016-03-29 10:26:50 +02:00
Johannes Schindelin
1cf0d2e46d git gui: fix staging a second line to a 1-line file
When a 1-line file is augmented by a second line, and the user tries to
stage that single line via the "Stage Line" context menu item, we do not
want to see "apply: corrupt patch at line 5".

The reason for this error was that the hunk header looks like this:

	@@ -1 +1,2 @@

but the existing code expects the original range always to contain a
comma. This problem is easily fixed by cutting the string "1 +1,2"
(that Git GUI formerly mistook for the starting line) at the space.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:50 +02:00
Johannes Schindelin
9b5baa1b00 Merge pull request #620 from sidecut/sidecut-gitk-list-references-window-width
Make the "list references" default window width wider
2016-03-29 10:26:49 +02:00
Johannes Schindelin
7292b98a0e Merge pull request #662 from shiftkey/issue_template
added issue template mirroring wiki notes
2016-03-29 10:26:48 +02:00
Johannes Schindelin
77e779f1ac Merge branch 'consolez'
This fixes an issue where the Git wrapper would terminate upon Ctrl+C,
even in the case when its child process would *not* terminate.

Note: while the original intention was to fix running Git Bash in
ConsoleZ, the bug fix applies also to running

	C:\Program Files\Git\bin\bash -l -i

in a cmd window.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:47 +02:00
Johannes Schindelin
dd729e809d Merge branch 'gitk-cursor-keys'
This patch needs to be contributed to gitk proper, of course.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:47 +02:00
Johannes Schindelin
12763a50fb Merge branch 'clean-long-paths'
This addresses https://github.com/git-for-windows/git/issues/521

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:46 +02:00
Johannes Schindelin
f6a0d76424 Merge branch 'git-wrapper-interpolate'
There was a bug in the wrapper where it would interpolate incorrectly if
the name of the environment variable to expand was longer than the value.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:45 +02:00
Johannes Schindelin
1b8a0eabf8 Merge branch 'home-bin' 2016-03-29 10:26:44 +02:00
Johannes Schindelin
991f736c96 Merge branch 'conhost-git-bash' 2016-03-29 10:26:44 +02:00
Johannes Schindelin
a9e192842d Merge branch 'bash-redirector' 2016-03-29 10:26:43 +02:00
Johannes Schindelin
9423dde3bf Merge branch 'pinnable'
Part 2/3 of fixing https://github.com/git-for-windows/git/issues/263

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:42 +02:00
Johannes Schindelin
f2b24f1305 Merge branch 'git-wrapper--command'
This topic branch adds the --command=<command> option that allows
starting the Git Bash (or Git CMD) with different terminal emulators
than the one encoded via embedded string resources.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:42 +02:00
Johannes Schindelin
569ad754ad Merge 'git-wrapper' into HEAD
Use msysGit's `git-wrapper` instead of the builtins. This works around
two issues:

- when the file system does not allow hard links, we would waste over
  800 megabyte by having 109 copies of a multi-megabyte executable

- even when the file system allows hard links, the Windows Explorer
  counts the disk usage as if it did not. Many users complained about
  Git for Windows using too much space (when it actually did not). We
  can easily avoid those user complaints by merging this branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:41 +02:00
Johannes Schindelin
adb7a272f9 Merge 'aslr' into HEAD
Address Space Layout Randomization (ASLR) allows executables' memory
layout to change at random between runs, and therefore offers a quite
decent protection against many attacks.

We enable ASLR because MSYS2's C compiler offers support for ASLR, and
whatever performance impact it has is neglible, according to
https://insights.sei.cmu.edu/cert/2014/02/differences-between-aslr-on-windows-and-linux.html

This merges the part of https://github.com/git-for-windows/git/pull/612
that does not break Git ;-)

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:40 +02:00
Johannes Schindelin
9ba9f31db1 Merge 'unc-alternates' into HEAD 2016-03-29 10:26:39 +02:00
Johannes Schindelin
6bae3d3f45 Merge pull request #552 from duncansmart/fix-vcproj-gen
Fix Visual Studio .sln/.vcproj generation.
2016-03-29 10:26:39 +02:00
Johannes Schindelin
33b719157e Merge pull request #487 from dscho/default-username
Improve the default user name & email logic
2016-03-29 10:26:38 +02:00
Johannes Schindelin
175fc23ca1 Merge pull request #486 from dscho/mmap-no-error
Better mmap() emulation
2016-03-29 10:26:38 +02:00
Johannes Schindelin
ca81412b07 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-03-29 10:26:37 +02:00
Johannes Schindelin
cf9b3504ea Merge pull request #443 from kblees/kb/nanosecond-file-times-v2.5.3
nanosecond file times for v2.5.3
2016-03-29 10:26:36 +02:00
Johannes Schindelin
f7bbf9afae Merge pull request #305 from dscho/msysgit_issues_182
Allow `add -p` and `add -i` with a large number of files
2016-03-29 10:26:36 +02:00
Johannes Schindelin
63e77ba95a Merge pull request #246 from uecasm/patch-1
Verify memoized files can be reloaded before using them
2016-03-29 10:26:35 +02:00
Johannes Schindelin
84e8725f60 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>
2016-03-29 10:26:35 +02:00
Johannes Schindelin
2fe226cc2b Merge pull request #159 from dscho/vagrant
Add Vagrant support (easy Linux VM setup)
2016-03-29 10:26:34 +02:00
Johannes Schindelin
45b076136c Merge pull request #156 from kblees/kb/symlinks
Symlink support
2016-03-29 10:26:33 +02:00
Johannes Schindelin
3e75956064 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>
2016-03-29 10:26:33 +02:00
Johannes Schindelin
4361e57b48 Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2016-03-29 10:26:32 +02:00
Johannes Schindelin
4e3b0d06a9 Merge 'fix-is-exe' into HEAD 2016-03-29 10:26:32 +02:00