Commit Graph

45186 Commits

Author SHA1 Message Date
Jeff King
12949d047d config.c: mark die_bad_number as NORETURN
This can help avoid -Wuninitialized false positives in
git_config_int and git_config_ulong, as the compiler now
knows that we do not return "ret" if we hit the error
codepath.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-10 17:13:53 -05:00
Johannes Schindelin
9860bbb4ed 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-10 17:13:50 -05:00
Thomas Braun
b6e7fcf533 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-10 17:13:50 -05:00
Erik Faye-Lund
db40d884d0 Makefile: do not depend on curl-config
MinGW builds of cURL does not ship with curl-config unless built
with the autoconf based build system, which is not the practice
recommended by the documentation. MsysGit has had issues with
binaries of that sort, so it has switched away from autoconf-based
cURL-builds.

Unfortunately, broke pushing over WebDAV on Windows, because
http-push.c depends on cURL's multi-threaded API, which we could
not determine the presence of any more.

Since troublesome curl-versions are ancient, and not even present
in RedHat 5, let's just assume cURL is capable instead of doing a
non-robust check.

Instead, add a check for curl_multi_init to our configure-script,
for those on ancient system. They probably already need to do the
configure-dance anyway.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
2014-05-10 17:13:49 -05:00
Johannes Schindelin
af30131ce0 Merge pull request #122 from kblees/kb/long-paths-v2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-10 17:13:49 -05:00
Johannes Schindelin
231f53802f Merge remote-tracking branch 'kblees/kb/fscache-v4-tentative-1.8.5' into thicket-1.8.5.2 2014-05-10 17:13:49 -05:00
Johannes Schindelin
2588ee01ea Merge branch 'kb/hashmap-v5-minimal' into kb/fscache-v4-t1.8.5 2014-05-10 17:13:49 -05:00
Johannes Schindelin
0853bed367 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-05-10 16:57:03 -05:00
Johannes Schindelin
58af5a8889 Merge pull request #126 from RomanBelinsky/master
fix date parsing error:  Update SVN.pm
2014-05-10 16:57:02 -05:00
Johannes Schindelin
8947aba21a Merge pull request #115 from msysgit/tip4commit
Mention tip4commit
2014-05-10 16:57:02 -05:00
Johannes Schindelin
d774bfc142 Merge 'poll-busy-wait' into HEAD 2014-05-10 16:57:02 -05:00
Johannes Schindelin
43e098b1b2 Merge 'normalize-win-paths' into HEAD 2014-05-10 16:57:02 -05:00
Johannes Schindelin
8f9a5f39f3 Merge 'msvc-link-crt' into HEAD 2014-05-10 16:57:02 -05:00
Johannes Schindelin
a02dd25e70 Merge 'install-wincred' into HEAD 2014-05-10 16:57:02 -05:00
Johannes Schindelin
618f8140c9 Merge 'fix-is-exe' into HEAD 2014-05-10 16:57:01 -05:00
Johannes Schindelin
4af426c1e5 Merge 'fix-externals' into HEAD 2014-05-10 16:57:01 -05:00
Johannes Schindelin
e598900a99 Merge 'stash-reflog' into HEAD 2014-05-10 16:57:01 -05:00
Johannes Schindelin
7abda7a425 Merge 'http-msys-paths' into HEAD 2014-05-10 16:57:01 -05:00
Johannes Schindelin
b7593f867f 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-10 16:57:01 -05:00
Johannes Schindelin
acdd2fc2d3 Merge 'win-tests-fixes' into HEAD 2014-05-10 16:57:01 -05:00
Johannes Schindelin
cbdee028b8 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-10 16:57:00 -05:00
Johannes Schindelin
5a9b30853b Merge 'grep-fixes' into HEAD 2014-05-10 16:57:00 -05:00
Johannes Schindelin
5322eac747 Merge 'pull-rebase-interactive' into HEAD 2014-05-10 16:57:00 -05:00
Johannes Schindelin
ab62c69232 Merge 'send-email' into HEAD 2014-05-10 16:57:00 -05:00
Johannes Schindelin
2398365930 Merge 'jberezanski/wincred-sso-r2' into HEAD 2014-05-10 16:57:00 -05:00
Johannes Schindelin
66353333a0 Merge 'gitweb-syntax' into HEAD 2014-05-10 16:56:59 -05:00
Johannes Schindelin
48e63552e6 Merge 'gitk' into HEAD 2014-05-10 16:56:59 -05:00
Johannes Schindelin
790f423a13 Merge 'git-gui' into HEAD 2014-05-10 16:56:59 -05:00
Johannes Schindelin
9a1e8b50f4 Merge 'deny-current-branch' into HEAD 2014-05-10 16:56:59 -05:00
Johannes Schindelin
7536fcf23d Merge 'criss-cross-merge' into HEAD 2014-05-10 16:56:59 -05:00
Johannes Schindelin
be6b605193 Merge 'am-submodules' into HEAD 2014-05-10 16:56:59 -05:00
Johannes Schindelin
9485bf31d5 Merge 'unc' into HEAD 2014-05-10 16:56:58 -05:00
Johannes Schindelin
a565692e8c Merge 'home' into HEAD 2014-05-10 16:56:58 -05:00
Johannes Schindelin
16180e48a2 Merge 'hide-dotgit' into HEAD 2014-05-10 16:56:58 -05:00
Johannes Schindelin
547db2e8c8 Merge 'unicode' into HEAD 2014-05-10 16:56:58 -05:00
Karsten Blees
104d4e8941 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-05-10 16:56:57 -05:00
Karsten Blees
738ce022b2 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-10 16:56:57 -05:00
Doug Kelly
aad2ca9251 Add a test demonstrating a problem with long submodule paths
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-10 16:56:57 -05:00
Karsten Blees
658d848289 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-10 16:56:57 -05:00
Johannes Schindelin
177f20e284 Merge 'home' into HEAD 2014-05-10 16:56:57 -05:00
Karsten Blees
dfbbbd2c35 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-05-10 16:56:56 -05:00
Karsten Blees
bbb31517e2 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-10 16:56:56 -05:00
Karsten Blees
3d76202fc5 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-10 16:56:56 -05:00
Karsten Blees
659686eaed 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-10 16:56:56 -05:00
Karsten Blees
e43d7f7da4 Win32: make FILETIME conversion functions public
Signed-off-by: Karsten Blees <blees@dcon.de>
2014-05-10 16:56:56 -05:00
Johannes Schindelin
cec0b8ed6f 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-05-10 16:56:55 -05:00
Jens Lehmann
c33e6c7c75 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-05-10 16:56:55 -05:00
Jean-Jacques Lafay
f172da6b28 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-05-10 16:56:49 -05:00
RomanBelinsky
e2ffc77010 Update SVN.pm
fix parsing error for dates like:
2014-01-07T5:58:36.048176Z
previous regex can parse only:
2014-01-07T05:58:36.048176Z
reproduced in my svn repository during conversion.
2014-05-10 16:56:48 -05:00
Johannes Schindelin
c70bf30377 Add a README.md
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2014-05-10 16:56:48 -05:00