Commit Graph

6735 Commits

Author SHA1 Message Date
Russell Belfer
adebcb1645 Merge pull request #2360 from phkelley/noinherit
Win32: Supply _O_NOINHERIT when calling _wopen
2014-05-16 10:42:17 -07:00
Philip Kelley
f0b820dd67 Win32: Supply _O_NOINHERIT when calling _wopen 2014-05-16 12:38:56 -04:00
Vicent Marti
228272ef58 Merge pull request #2313 from libgit2/cmn/remote-delete
Remote deletion
2014-05-16 11:56:37 +02:00
Carlos Martín Nieto
ec8a949a58 remote: remove remote-tracking branches on delete
When we delete a remote, we also need to go through its fetch refspecs
and remove the references they create locally.
2014-05-16 10:02:07 +02:00
Russell Belfer
8e1b5a8dc6 Merge pull request #2357 from libgit2/cmn/pack-cache-init
pack: init the cache on packfile alloc
2014-05-15 15:31:13 -07:00
Vicent Marti
88b1b36dfc Merge pull request #2356 from libgit2/rb/restore-search-paths
Better global search path sandboxing in tests
2014-05-15 20:25:54 +02:00
Carlos Martín Nieto
649214be4b pack: init the cache on packfile alloc
When running multithreaded, it is not enough to check for the offmap
allocation. Move the call to cache_init() to packfile allocation so we
can be sure it is always allocated free of races.

This fixes #2355.
2014-05-15 19:59:05 +02:00
Russell Belfer
8487e23797 Better search path sandboxing
There are a number of tests that modify the global or system
search paths during the tests.  This adds a helper function to
make it easier to restore those paths and makes sure that they
are getting restored in a manner that preserves test isolation.
2014-05-15 10:56:28 -07:00
Philip Kelley
4af0ef9690 Fix mutex init/free in config_file.c 2014-05-15 11:09:49 -04:00
Vicent Marti
7851e595ad Merge pull request #2351 from linquize/init-var
Initialize local variable
2014-05-14 16:05:23 +02:00
Vicent Marti
2bcc1afd10 Merge pull request #2349 from libgit2/rb/coverity-fixes
Increase config snapshot usage
2014-05-14 12:20:24 +02:00
Vicent Marti
a8af3e0284 Merge pull request #2348 from stewid/add-link-R-bindings
Add R bindings to the README
2014-05-14 12:18:57 +02:00
Russell Belfer
2b52a0bfae Increase use of config snapshots
And decrease extra reload checks of config data.
2014-05-13 16:32:27 -07:00
Russell Belfer
a37aa82ea6 Some coverity inspired cleanups 2014-05-13 15:54:23 -07:00
Stefan Widgren
562516eceb Add R bindings to the README 2014-05-13 22:43:59 +02:00
Linquize
b3f27c4368 Initialize local variable 2014-05-13 21:08:50 +08:00
Vicent Marti
03fcef1889 Merge pull request #2328 from libgit2/rb/how-broken-can-ignores-be
Improve checks for ignore containment
2014-05-13 12:40:13 +02:00
Vicent Marti
bcf9792f08 Merge pull request #2330 from libgit2/cmn/pack-unpack-loop
Make pack object lookup use loops
2014-05-13 12:36:51 +02:00
Vicent Marti
e161962634 Merge pull request #2346 from kitbellew/fix2300
Minor fix for previously merged netops code.
2014-05-13 12:35:56 +02:00
Albert Meltzer
7c57cd97d8 Win32 fix for #2300.
The code doesn't use SSL and a test requires it.
2014-05-12 20:51:03 -07:00
Carlos Martín Nieto
c968ce2c2c pack: don't forget to cache the base object
The base object is a good cache candidate, so we shouldn't forget to add
it to the cache.
2014-05-13 02:48:52 +02:00
Carlos Martín Nieto
15bcced223 pack: use stack allocation for smaller delta chains
This avoid allocating the array on the heap for relatively small
chains. The expected performance increase is sadly not really
noticeable.
2014-05-13 02:48:52 +02:00
Carlos Martín Nieto
a3ffbf230e pack: expose a cached delta base directly
Instead of going through a special entry in the chain, let's pass it as
an output parameter.
2014-05-13 02:48:48 +02:00
Russell Belfer
df3419269b Merge pull request #2336 from libgit2/rb/unicode-branch-names
Pass unconverted Unicode path data when iconv doesn't like it
2014-05-12 10:51:56 -07:00
Russell Belfer
af567e8853 Merge pull request #2334 from libgit2/rb/fix-2333
Be more careful with user-supplied buffers
2014-05-12 10:44:13 -07:00
Russell Belfer
ce3b71d91b Don't scale diff stat when not needed 2014-05-12 10:28:45 -07:00
Russell Belfer
b1914c3651 Minor fixes for warnings and error propagation 2014-05-12 10:24:46 -07:00
Russell Belfer
7bcced44b7 Merge pull request #2300 from libgit2/cmn/match-host-tests
Some improvements to the cert checking
2014-05-12 10:15:30 -07:00
Russell Belfer
d2c4d1c63d Merge pull request #2188 from libgit2/cmn/config-snapshot
Configuration snapshotting
2014-05-12 10:04:52 -07:00
Carlos Martín Nieto
9dbd150f5f pack: simplify delta chain code
The switch makes the loop somewhat unwieldy. Let's assume it's fine and
perform the check when we're accessing the data.

This makes our code look a lot more like git's.
2014-05-09 09:59:24 +02:00
Carlos Martín Nieto
b2559f477a pack: preallocate a 64-element chain
Dependency chains are often large and require a few
reallocations. Allocate a 64-element chain before doing anything else to
avoid allocations during the loop.

This value comes from the stack-allocated one git uses. We still
allocate this on the heap, but it does help performance a little bit.
2014-05-09 09:40:29 +02:00
Carlos Martín Nieto
e6d10c58b5 pack: make sure not to leak the dep chain 2014-05-09 09:40:29 +02:00
Carlos Martín Nieto
a332e91c92 pack: use a cache for delta bases when unpacking
Bring back the use of the delta base cache for unpacking objects. When
generating the delta chain, we stop when we find a delta base in the
pack's cache and use that as the starting point.
2014-05-09 09:40:29 +02:00
Carlos Martín Nieto
2acdf4b854 pack: unpack using a loop
We currently make use of recursive function calls to unpack an object,
resolving the deltas as we come back down the chain. This means that we
have unbounded stack growth as we look up objects in a pack.

This is now done in two steps: first we figure out what the dependency
chain is by looking up the delta bases until we reach a non-delta
object, pushing the information we need onto a stack and then we pop
from that stack and apply the deltas until there are no more left.

This version of the code does not make use of the delta base cache so it
is slower than what's in the mainline. A later commit will reintroduce
it.
2014-05-09 09:40:29 +02:00
Carlos Martín Nieto
ae0817393c pack: do not repeat the same error message four times
Repeating this error message makes it harder to find out where we
actually are finding the error, and they don't really describe what
we're trying to do.
2014-05-09 09:40:29 +02:00
Carlos Martín Nieto
86d5810b82 pack: remove misleading comment 2014-05-09 09:40:29 +02:00
Vicent Marti
e18d5e52e3 Merge pull request #2331 from libgit2/rb/dont-stop-diff-on-safecrlf
Add filter options and ALLOW_UNSAFE
2014-05-09 08:59:59 +02:00
Russell Belfer
bb45e39063 Disable threads::refdb::edit_while_iterate test
It seems that with the various recent changes to reference updating
and reflog writing, that the thread safety of refdb updates has
been reduced (either that or it was never thread safe and the
window for error has increased).  Either way, this test is now
sometimes segfaulting which is no good, so let's disable the test
for now.  We don't really make any public promises about thread
safety for this type of operation, so I think this is acceptable,
at least in the short term.
2014-05-08 15:01:07 -07:00
Russell Belfer
8a2ef218b9 Don't always test composed-insensitive lookups
Only on a filesystem that is composed/decomposed insensitive,
should be testing that a branch can be looked up by the opposite
form and still work correctly.
2014-05-08 14:48:27 -07:00
Russell Belfer
be20ac5a1d Allow cl_repo_get_bool to work with missing key
One of the test helpers provides a quick way for looking up a
boolean key.  But if the key way missing completely, the check
would actually raise an error.  Given the way we use this helper,
if the key is missing, this should just return false, I think.
2014-05-08 14:33:37 -07:00
Vicent Marti
4df53a64a1 Merge pull request #2335 from libgit2/cmn/indexer-vector-handling
indexer: avoid memory moves
2014-05-08 23:16:21 +02:00
Russell Belfer
43a0413524 Pass unconverted data when iconv doesn't like it
When using Iconv to convert unicode data and iconv doesn't like
the source data (because it thinks that it's not actual UTF-8),
instead of stopping the operation, just use the unconverted data.
This will generally do the right thing on the filesystem, since
that is the source of the non-UTF-8 path data anyhow.

This adds some tests for creating and looking up branches with
messy Unicode names.  Also, this takes the helper function that
was previously internal to `git_repository_init` and makes it
into `git_path_does_fs_decompose_unicode` which is a useful in
tests to understand what the expected results should be.
2014-05-08 13:52:46 -07:00
Carlos Martín Nieto
2dde1e0c1c indexer: avoid memory moves
Our vector does a move of the rest of the array when we remove an
item. Doing this repeatedly can be expensive, and we do this a lot in
the indexer. Instead, set the value to NULL and skip those entries.

perf reported around 30% of `index-pack` time was going into
memmove. With this change, that goes away and we spent most of the time
hashing and inflating data.
2014-05-08 22:40:13 +02:00
Russell Belfer
5ebe18b72c Merge pull request #2332 from libgit2/peff/iconv
iconv debugging aids
2014-05-08 13:29:09 -07:00
Jeff King
56ec2256f2 examples: add a basic for-each-ref example
This is quite close to running "git for-each-ref" except:

  1. It does not take any formatting or selection options at
     all.

  2. The output is not sorted.

I wrote it to look at debugging some issues with ref
iteration, but there's no reason it can't live on as an
example command.
2014-05-08 15:49:38 -04:00
Jeff King
6bcb098755 cmake: s/ICONV/Iconv/ in FIND_PACKAGE
The cmake module we provide is in the file FindIconv.cmake,
so we must match the case correctly. It happens to work in
practice because we only turn on ICONV on Darwin, and people
generally have case-insensitive filesystems there.

Note that we only need to update the package name here. The
package itself still sets the all-uppercase ICONV_FOUND
flag, so we continue to use uppercase in the rest of cmake.
2014-05-08 15:48:49 -04:00
Russell Belfer
45c53eb6cb Use unsigned type for APIs with opt flag mask 2014-05-08 10:46:04 -07:00
Russell Belfer
1e4976cb01 Be more careful with user-supplied buffers
This adds in missing calls to `git_buf_sanitize` and fixes a
number of places where `git_buf` APIs could inadvertently write
NUL terminator bytes into invalid buffers.  This also changes the
behavior of `git_buf_sanitize` to NUL terminate a buffer if it can
and of `git_buf_shorten` to do nothing if it can.

Adds tests of filtering code with zeroed (i.e. unsanitized) buffer
which was previously triggering a segfault.
2014-05-08 10:17:14 -07:00
Carlos Martín Nieto
ac99d86ba5 repository: introduce a convenience config snapshot method
Accessing the repository's config and immediately taking a snapshot of
it is a common operation, so let's provide a convenience function for
it.
2014-05-07 11:34:32 +02:00
Russell Belfer
ed476c236b Merge pull request #2329 from anuraggup/fix_git_shutdown
Fix the issues in git_shutdown
2014-05-06 16:11:03 -07:00