Commit Graph

45009 Commits

Author SHA1 Message Date
Stepan Kasal
c68e27d50c fixup! git tag --contains : avoid stack overflow
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
2014-04-22 17:55:31 +02:00
Johannes Schindelin
c63d196ece fixup! git tag --contains : avoid stack overflow 2014-04-17 12:24:31 -05:00
Johannes Schindelin
2ec943a028 fixup! Merge pull request #159 from kasal/config-c-warning
This commit replaces the Git for Windows-only patch by the patch
accepted upstream instead.

It was performed by the following shell commands:

	git revert -n 3c87ce5^2 &&
	git cherry-pick -n 06bdc23 &&
	git commit -s --fixup 3c87ce5

(and amending the commit with this commit message)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-04-17 11:23:32 -05:00
Johannes Schindelin
6845d53e87 fixup! MinGW: Update tests to handle a native eol of crlf 2014-04-16 17:55:39 -05:00
Stepan Kasal
5cb0a6d931 Merge pull request #122 from kblees/kb/long-paths-v2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-04-16 16:34:38 +02:00
Stepan Kasal
50d3ca7563 Merge remote-tracking branch 'kblees/kb/fscache-v4-tentative-1.8.5' into thicket-1.8.5.2 2014-04-16 16:34:37 +02:00
Stepan Kasal
9406783204 Merge branch 'kb/hashmap-v5-minimal' into kb/fscache-v4-t1.8.5 2014-04-16 16:34:36 +02:00
Stepan Kasal
3c87ce59ec Merge pull request #159 from kasal/config-c-warning
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-04-16 16:34:35 +02:00
Stepan Kasal
7217f8ab52 Merge branch 'tag-contains'
This topic branch addresses out-of-memory errors in particular on
Windows, where the default stack space is not very large.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-04-16 16:34:34 +02:00
Stepan Kasal
61e063248c Merge pull request #126 from RomanBelinsky/master
fix date parsing error:  Update SVN.pm
2014-04-16 16:34:33 +02:00
Stepan Kasal
dea126f633 Merge pull request #115 from msysgit/tip4commit
Mention tip4commit
2014-04-16 16:34:31 +02:00
Stepan Kasal
e368c17d89 Merge 'poll-busy-wait' into HEAD 2014-04-16 16:34:30 +02:00
Stepan Kasal
a3686bb99e Merge 'normalize-win-paths' into HEAD 2014-04-16 16:34:29 +02:00
Stepan Kasal
873a1f515f Merge 'msvc-link-crt' into HEAD 2014-04-16 16:34:28 +02:00
Stepan Kasal
830b6ee9c0 Merge 'install-wincred' into HEAD 2014-04-16 16:34:27 +02:00
Stepan Kasal
be98ea89d3 Merge 'fix-is-exe' into HEAD 2014-04-16 16:34:26 +02:00
Stepan Kasal
6ce3472c31 Merge 'fix-externals' into HEAD 2014-04-16 16:34:25 +02:00
Stepan Kasal
01c0d7e358 Merge 'stash-reflog' into HEAD 2014-04-16 16:34:24 +02:00
Stepan Kasal
31199945c3 Merge 'http-msys-paths' into HEAD 2014-04-16 16:34:22 +02:00
Stepan Kasal
13716a83dd 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-04-16 16:34:21 +02:00
Stepan Kasal
0974fa1134 Merge 'win-tests-fixes' into HEAD 2014-04-16 16:34:20 +02:00
Stepan Kasal
48fef2d29c 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-04-16 16:34:19 +02:00
Stepan Kasal
52ee32dfb4 Merge 'grep-fixes' into HEAD 2014-04-16 16:34:18 +02:00
Stepan Kasal
d46df546a4 Merge 'pull-rebase-interactive' into HEAD 2014-04-16 16:34:17 +02:00
Stepan Kasal
73fea7fedb Merge 'send-email' into HEAD 2014-04-16 16:34:16 +02:00
Stepan Kasal
265d4d7e07 Merge 'jberezanski/wincred-sso-r2' into HEAD 2014-04-16 16:34:14 +02:00
Stepan Kasal
d8b255878c Merge 'gitweb-syntax' into HEAD 2014-04-16 16:34:13 +02:00
Stepan Kasal
aef144818b Merge 'gitk' into HEAD 2014-04-16 16:34:12 +02:00
Stepan Kasal
9c625d990e Merge 'git-gui' into HEAD 2014-04-16 16:34:11 +02:00
Stepan Kasal
96b6c7c3bf Merge 'deny-current-branch' into HEAD 2014-04-16 16:34:10 +02:00
Stepan Kasal
b16fe63e5c Merge 'criss-cross-merge' into HEAD 2014-04-16 16:34:09 +02:00
Stepan Kasal
0ad5c62e22 Merge 'am-submodules' into HEAD 2014-04-16 16:34:08 +02:00
Stepan Kasal
f6659890e9 Merge 'unc' into HEAD 2014-04-16 16:34:07 +02:00
Stepan Kasal
d16630b039 Merge 'home' into HEAD 2014-04-16 16:34:05 +02:00
Stepan Kasal
aa9961a92c Merge 'hide-dotgit' into HEAD 2014-04-16 16:34:04 +02:00
Stepan Kasal
33c8cf768e Merge 'unicode' into HEAD 2014-04-16 16:34:03 +02:00
Karsten Blees
b394f70c56 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.

Thanks-to: Martin W. Kirst <maki@bitkings.de>
Thanks-to: Doug Kelly <dougk.ff7@gmail.com>
Signed-off-by: Karsten Blees <blees@dcon.de>
2014-04-16 16:34:00 +02:00
Doug Kelly
0493c5189e Add a test demonstrating a problem with long submodule paths
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-04-16 16:33:58 +02:00
Karsten Blees
ef1baaf918 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-04-16 16:33:54 +02:00
Karsten Blees
9caf6fb918 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-04-16 16:33:53 +02:00
Stepan Kasal
d0ca8be6c7 Merge 'home' into HEAD 2014-04-16 16:33:52 +02:00
Karsten Blees
be869eb2ea 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-04-16 16:33:51 +02:00
Karsten Blees
0395058403 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-04-16 16:33:50 +02:00
Karsten Blees
1216953c06 Win32: dirent.c: Move opendir down
Move opendir down in preparation for the next patch.

Signed-off-by: Karsten Blees <blees@dcon.de>
2014-04-16 16:33:49 +02:00
Karsten Blees
eb5c1f8e6a Win32: make FILETIME conversion functions public
Signed-off-by: Karsten Blees <blees@dcon.de>
2014-04-16 16:33:49 +02:00
Karsten Blees
fa0bc514ca add a hashtable implementation that supports O(1) removal
The existing hashtable implementation (in hash.[ch]) uses open addressing
(i.e. resolve hash collisions by distributing entries across the table).
Thus, removal is difficult to implement with less than O(n) complexity.
Resolving collisions of entries with identical hashes (e.g. via chaining)
is left to the client code.

Add a hashtable implementation that supports O(1) removal and is slightly
easier to use due to builtin entry chaining.

Supports all basic operations init, free, get, add, remove and iteration.

Also includes ready-to-use hash functions based on the public domain FNV-1
algorithm (http://www.isthe.com/chongo/tech/comp/fnv).

The per-entry data structure (hashmap_entry) is piggybacked in front of
the client's data structure to save memory. See test-hashmap.c for usage
examples.

The hashtable is resized by a factor of four when 80% full. With these
settings, average memory consumption is about 2/3 of hash.[ch], and
insertion is about twice as fast due to less frequent resizing.

Lookups are also slightly faster, because entries are strictly confined to
their bucket (i.e. no data of other buckets needs to be traversed).

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-16 16:33:45 +02:00
Jens Lehmann
fc48c50837 submodule: don't access the .gitmodules cache entry after removing it
Commit 5fee995244 introduced the stage_updated_gitmodules() function to
add submodule configuration updates to the index. It assumed that even
after calling remove_cache_entry_at() the same cache entry would still be
valid. This was true in the old days, as cache entries could never be
freed, but that is not so sure in the present as there is ongoing work to
free removed cache entries, which makes this code segfault.

Fix that by calling add_file_to_cache() instead of open coding it. Also
remove the "could not find .gitmodules in index" warning, as that won't
happen in regular use cases (and by then just silently adding it to the
index we do the right thing).

Thanks-to: Karsten Blees <karsten.blees@gmail.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-16 16:33:44 +02:00
Stepan Kasal
6fe331a280 config.c: fix a compiler warning 2014-04-16 16:33:41 +02:00
Johannes Schindelin
8050a25f5e Touch up the comments in the 'tag-contains' branch
Thomas Braun pointed out several documentation shortcomings.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-04-16 16:33:38 +02:00
Jean-Jacques Lafay
a054ed8a9e git tag --contains : avoid stack overflow
In large repos, the recursion implementation of contains(commit,
commit_list) may result in a stack overflow. Replace the recursion with
a loop to fix it.

This problem is more apparent on Windows than on Linux, where the stack
is more limited by default.

See also this thread on the msysGit list:

	https://groups.google.com/d/topic/msysgit/FqT6boJrb2g/discussion

[jes: re-written to imitate the original recursion more closely]

Signed-off-by: Jean-Jacques Lafay <jeanjacques.lafay@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Stepan Kasal <kasal@ucw.cz>
2014-04-16 16:33:37 +02:00