summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | Merge pull request #2330 from libgit2/cmn/pack-unpack-loopVicent Marti2014-05-132-78/+211
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | Make pack object lookup use loops
| | * | | | | | pack: don't forget to cache the base objectcmn/pack-unpack-loopCarlos Martín Nieto2014-05-131-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The base object is a good cache candidate, so we shouldn't forget to add it to the cache.
| | * | | | | | pack: use stack allocation for smaller delta chainsCarlos Martín Nieto2014-05-131-16/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoid allocating the array on the heap for relatively small chains. The expected performance increase is sadly not really noticeable.
| | * | | | | | pack: expose a cached delta base directlyCarlos Martín Nieto2014-05-132-97/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of going through a special entry in the chain, let's pass it as an output parameter.
| | * | | | | | pack: simplify delta chain codeCarlos Martín Nieto2014-05-091-49/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | pack: preallocate a 64-element chainCarlos Martín Nieto2014-05-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | pack: make sure not to leak the dep chainCarlos Martín Nieto2014-05-091-8/+13
| | | | | | | |
| | * | | | | | pack: use a cache for delta bases when unpackingCarlos Martín Nieto2014-05-092-73/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | pack: unpack using a loopCarlos Martín Nieto2014-05-092-25/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | pack: do not repeat the same error message four timesCarlos Martín Nieto2014-05-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | pack: remove misleading commentCarlos Martín Nieto2014-05-091-7/+0
| | | | | | | |
| * | | | | | | Merge pull request #2346 from kitbellew/fix2300Vicent Marti2014-05-131-0/+4
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Minor fix for previously merged netops code.
| | * | | | | | | Win32 fix for #2300.Albert Meltzer2014-05-121-0/+4
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | The code doesn't use SSL and a test requires it.
| * | | | | | | Merge pull request #2336 from libgit2/rb/unicode-branch-namesRussell Belfer2014-05-125-57/+124
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Pass unconverted Unicode path data when iconv doesn't like it
| | * | | | | | | Don't always test composed-insensitive lookupsrb/unicode-branch-namesRussell Belfer2014-05-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | | Allow cl_repo_get_bool to work with missing keyRussell Belfer2014-05-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | | Pass unconverted data when iconv doesn't like itRussell Belfer2014-05-084-56/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | | Merge pull request #2334 from libgit2/rb/fix-2333Russell Belfer2014-05-127-23/+46
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Be more careful with user-supplied buffers
| | * | | | | | | | Be more careful with user-supplied buffersrb/fix-2333Russell Belfer2014-05-087-23/+46
| | |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | | Don't scale diff stat when not neededRussell Belfer2014-05-122-0/+6
| | | | | | | | |
| * | | | | | | | Minor fixes for warnings and error propagationRussell Belfer2014-05-124-12/+14
| | | | | | | | |
| * | | | | | | | Merge pull request #2300 from libgit2/cmn/match-host-testsRussell Belfer2014-05-123-9/+39
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Some improvements to the cert checking
| | * | | | | | | | netops: catch the server not sending a certificatecmn/match-host-testsCarlos Martín Nieto2014-04-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's possible for an encrypted connection not have a certificate. In this case, SSL_get_verify_result() will return OK because no error happened (as it never even tried to validate anything). SSL_get_peer_certificate() will return NULL in this case so we need to catch that. On the upside, the current code would segfault in this situation instead of letting it through as a valid cert.
| | * | | | | | | | netops: provide more specific error for cert failureCarlos Martín Nieto2014-04-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specify what we do not like about the certificate. In this case, we do not like the name.
| | * | | | | | | | netops: unit-test the cert host-name pattern matchingCarlos Martín Nieto2014-04-263-4/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This kind of stuff should have unit tests, even if it's just to show what we expect to match successfully.
| * | | | | | | | | Merge pull request #2188 from libgit2/cmn/config-snapshotRussell Belfer2014-05-1215-266/+594
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Configuration snapshotting
| | * | | | | | | | | repository: introduce a convenience config snapshot methodcmn/config-snapshotCarlos Martín Nieto2014-05-077-30/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | | | | config: share the strmap on snapshotCarlos Martín Nieto2014-04-181-54/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that our strmap is no longer modified but replaced, we can use the same strmap for the snapshot's values and it will be freed when we don't need it anymore.
| | * | | | | | | | | config: refcount the values mapCarlos Martín Nieto2014-04-181-43/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mostly groundwork to let us re-use the map in the snapshots.
| | * | | | | | | | | config: refresh on deleteCarlos Martín Nieto2014-04-182-54/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we delete an entry, we also want to refresh the configuration to catch any changes that happened externally. This allows us to simplify the logic, as we no longer need to delete these variables internally. The whole state will be refreshed and the deleted entries won't be there.
| | * | | | | | | | | config: document the how long the pointers are valid forCarlos Martín Nieto2014-04-181-1/+14
| | | | | | | | | | |
| | * | | | | | | | | config: refresh before reading a valueCarlos Martín Nieto2014-04-184-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the isolation of complex reads, we can now try to refresh the on-disk file before reading a value from it. This changes the semantics a bit, as before we could be sure that a string we got from the configuration was valid until we wrote or refreshed. This is no longer the case, as a read can also invalidate the pointer.
| | * | | | | | | | | config: refresh the values on writeCarlos Martín Nieto2014-04-182-83/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When writing out, parse the resulting file instead of adding or replacing the value locally. This has the effect of reading external changes as well.
| | * | | | | | | | | config: use a snapshot for the iteratorCarlos Martín Nieto2014-04-181-3/+17
| | | | | | | | | | |
| | * | | | | | | | | config: split out the refresh stepCarlos Martín Nieto2014-04-181-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will be used by the writing commands in a later step.
| | * | | | | | | | | config: make refresh atomicCarlos Martín Nieto2014-04-181-23/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code sets the active map to a new one and builds it whilst it's active. This is a race condition with someone else trying to access the same config. Instead, let's build up our new map and swap the active and new one.
| | * | | | | | | | | Use config snapshottingCarlos Martín Nieto2014-04-186-28/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This way we can assume we have a consistent view of the config situation when we're looking up remote, branch, pack-objects, etc.
| | * | | | | | | | | config: implement config snapshottingCarlos Martín Nieto2014-04-185-67/+379
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to have consistent views of the config files for remotes, submodules et al. and a configuration that represents what is currently stored on-disk, we need a way to provide a view of the configuration that does not change. The goal here is to provide the snapshotting part by creating a read-only copy of the state of the configuration at a particular point in time, which does not change when a repository's main config changes.
| | * | | | | | | | | config: document current write behaviour in a testCarlos Martín Nieto2014-04-181-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On set, we set/add the value written to the config's internal values, but we do not refresh old values. Document this in a test in preparation for the refresh changes.
| * | | | | | | | | | Merge pull request #2331 from libgit2/rb/dont-stop-diff-on-safecrlfVicent Marti2014-05-0915-36/+145
| |\ \ \ \ \ \ \ \ \ \ | | |_|_|_|/ / / / / / | |/| | | | | | | | | Add filter options and ALLOW_UNSAFE
| | * | | | | | | | | Disable threads::refdb::edit_while_iterate testrb/dont-stop-diff-on-safecrlfRussell Belfer2014-05-081-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | | | | Use unsigned type for APIs with opt flag maskRussell Belfer2014-05-083-8/+9
| | | | | | | | | | |
| | * | | | | | | | | Add filter options and ALLOW_UNSAFERussell Belfer2014-05-0614-29/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Diff and status do not want core.safecrlf to actually raise an error regardless of the setting, so this extends the filter API with an additional options flags parameter and adds a flag so that filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating that unsafe filter application should be downgraded from a failure to a warning.
| * | | | | | | | | | Merge pull request #2335 from libgit2/cmn/indexer-vector-handlingVicent Marti2014-05-081-8/+15
| |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | indexer: avoid memory moves
| | * | | | | | | | | | indexer: avoid memory movescmn/indexer-vector-handlingCarlos Martín Nieto2014-05-081-8/+15
| | | |_|_|/ / / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | | | | Merge pull request #2332 from libgit2/peff/iconvRussell Belfer2014-05-084-1/+49
| |\ \ \ \ \ \ \ \ \ \ | | |/ / / / / / / / / | |/| | | | | | | | | iconv debugging aids
| | * | | | | | | | | examples: add a basic for-each-ref examplepeff/iconvJeff King2014-05-083-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * | | | | | | | | cmake: s/ICONV/Iconv/ in FIND_PACKAGEJeff King2014-05-081-1/+1
| |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | | | | | Merge pull request #2329 from anuraggup/fix_git_shutdownRussell Belfer2014-05-062-4/+8
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Fix the issues in git_shutdown
| | * | | | | | | | | Fix the issues in git_shutdownAnurag Gupta2014-05-061-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Call to git_shutdown results in setting git__n_shutdown_callbacks to -1. Next call to git__on_shutdown results in ABW (Array Bound Write) for array git__shutdown_callbacks. In the current Implementation, git_atomic_dec is called git__n_shutdown_callbacks + 1 times. I have modified it to a for loop so that it is more readable. It would not set git__n_shutdown_callbacks to a negative number and reset the elements of git__shutdown_callbacks to NULL. 2) In function git_sysdir_get, shutdown function is registered only if git_sysdir__dirs_shutdown_set is set to 0. However, after this variable is set to 1, it is never reset to 0. If git_sysdir_global_init is called again from synchronized_threads_init it does not register shutdown function for this subsystem.