summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | 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-123-56/+66
|\ \ \ \ \ | | | | | | | | | | | | Pass unconverted Unicode path data when iconv doesn't like it
| * | | | | Pass unconverted data when iconv doesn't like itRussell Belfer2014-05-083-56/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-126-20/+36
|\ \ \ \ \ \ | | | | | | | | | | | | | | Be more careful with user-supplied buffers
| * | | | | | Be more careful with user-supplied buffersrb/fix-2333Russell Belfer2014-05-086-20/+36
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-121-0/+2
| | | | | |
* | | | | | Minor fixes for warnings and error propagationRussell Belfer2014-05-123-11/+9
| | | | | |
* | | | | | Merge pull request #2300 from libgit2/cmn/match-host-testsRussell Belfer2014-05-122-9/+26
|\ \ \ \ \ \ | | | | | | | | | | | | | | 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-262-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-128-254/+454
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Configuration snapshotting
| * | | | | | | repository: introduce a convenience config snapshot methodcmn/config-snapshotCarlos Martín Nieto2014-05-076-29/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-181-51/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: refresh before reading a valueCarlos Martín Nieto2014-04-181-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-181-82/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-182-67/+295
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | | | Merge pull request #2331 from libgit2/rb/dont-stop-diff-on-safecrlfVicent Marti2014-05-097-12/+46
|\ \ \ \ \ \ \ \ | |_|_|_|/ / / / |/| | | | | | | Add filter options and ALLOW_UNSAFE
| * | | | | | | Use unsigned type for APIs with opt flag maskRussell Belfer2014-05-081-4/+4
| | | | | | | |
| * | | | | | | Add filter options and ALLOW_UNSAFERussell Belfer2014-05-067-12/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | | | 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 #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.
| * | | | | | | Fix the issues in git__on_shutdownAnurag Gupta2014-05-062-5/+9
| | |_|_|/ / / | |/| | | | |
* | | | | | | Merge pull request #2324 from libgit2/cmn/file-in-objects-dirRussell Belfer2014-05-061-0/+4
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | odb: ignore files in the objects dir
| * | | | | | odb: ignore files in the objects dircmn/file-in-objects-dirCarlos Martín Nieto2014-05-051-0/+4
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We assume that everything under GIT_DIR/objects/ is a directory. This is not necessarily the case if some process left a stray file in there. Check beforehand if we do have a directory and ignore the entry otherwise.
* | | | | | object: fix a braceCarlos Martín Nieto2014-05-061-1/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | The brace in the check for peel's return was surrounding the wrong thing, which made 'error' be set to 1 when there was an error instead of the error code.
* | | | | Merge pull request #2308 from libgit2/rb/diff-update-index-stat-cacheVicent Marti2014-05-0222-267/+284
|\ \ \ \ \ | | | | | | | | | | | | Reduce excessive OID calculation for diff and stat
| * | | | | Improve handling of fake home directoryRussell Belfer2014-05-022-15/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a few tests that set up a fake home directory and a fake GLOBAL search path so that we can test things in global ignore or attribute or config files. This cleans up that code to work more robustly even if there is a test failure. This also fixes some valgrind warnings where scanning search paths for separators could end up doing a little bit of sketchy data access when coming to the end of search list.
| * | | | | Fix remaining init_options inconsistenciesRussell Belfer2014-05-0210-86/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were a couple of "init_opts()" functions a few more cases of structure initialization that I somehow missed.
| * | | | | Make init_options fns use unsigned ints and macroRussell Belfer2014-05-028-85/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use an unsigned int for the version and add a helper macro so the code is simplified (and so the error message is a common string).
| * | | | | Remove trace / add git_diff_perfdata struct + apiRussell Belfer2014-05-027-66/+88
| | | | | |
| * | | | | Get rid of redundant git_diff_options_init fnRussell Belfer2014-05-021-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | Since git_diff_init_options was introduced, remove this old fn.
| * | | | | Add payloads, bitmaps to trace APIRussell Belfer2014-05-024-22/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a proposed adjustment to the trace APIs. This makes the trace levels into a bitmask so that they can be selectively enabled and adds a callback-level payload, plus a message-level payload. This makes it easier for me to a GIT_TRACE_PERF callbacks that are simply bypassed if the PERF level is not set.
| * | | | | Add GIT_STATUS_OPT_UPDATE_INDEX and use trace APIRussell Belfer2014-05-026-35/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds an option to refresh the stat cache while generating status. It also rips out the GIT_PERF stuff I had an makes use of the trace API to keep statistics about what happens during diff.
| * | | | | Add diff option to update index stat cacheRussell Belfer2014-05-023-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When diff is scanning the working directory, if it finds a file where it is not sure if the index entry matches the working dir, it will recalculate the OID (which is pretty expensive). This adds a new flag to diff so that if the OID calculation finds that the file actually has not changed (i.e. just the modified time was altered or such), then it will refresh the stat cache in the index so that future calls to diff will not have to check the oid again.
| * | | | | Lay groundwork for updating stat cache in diffRussell Belfer2014-05-024-21/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reorganized the diff OID calculation to make it easier to correctly update the stat cache during a diff once the flags to do so are enabled. This includes marking the path of a git_index_entry as const so we can make a "fake" git_index_entry with a "const char *" path and not get warnings. I was a little surprised at how unobtrusive this change was, but I think it's probably a good thing.
| * | | | | Skip diff oid calc when size definitely changedRussell Belfer2014-05-022-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we think the stat cache in the index seems valid and the size or mode of a file has definitely changed, then don't bother trying to recalculate the OID of the workdir bits to confirm that it is modified - just accept that it is modified. This can result in files that show as modified with no actual diff, but the behavior actually appears to match Git on the command line. This also includes a minor optimization to not perform a submodule lookup on the ".git" directory itself.
| * | | | | Add build option for diff internal statisticsRussell Belfer2014-05-028-48/+79
| | | | | |
* | | | | | Merge pull request #2310 from libgit2/cmn/commit-create-safeRussell Belfer2014-05-021-21/+78
|\ \ \ \ \ \ | |/ / / / / |/| | | | | commit: safer commit creation with reference update
| * | | | | commit: safer commit creation with reference updatecmn/commit-create-safeCarlos Martín Nieto2014-04-301-21/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current version of the commit creation and amend function are unsafe to use when passing the update_ref parameter, as they do not check that the reference at the moment of update points to what the user expects. Make sure that we're moving history forward when we ask the library to update the reference for us by checking that the first parent of the new commit is the current value of the reference. We also make sure that the ref we're updating hasn't moved between the read and the write. Similarly, when amending a commit, make sure that the current tip of the branch is the commit we're amending.
* | | | | | Temporary fix for Travis CI buildsVicent Marti2014-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/libgit2/libgit2/pull/2321#issuecomment-42039673 We may rollback once we found something more reliable
* | | | | | Make ** pattern eat trailing slashrb/fix-starstar-againRussell Belfer2014-05-011-0/+2
| |_|_|_|/ |/| | | | | | | | | | | | | | This allows "foo/**/*.html" to match "foo/file.html"
* | | | | Merge pull request #2304 from jacquesg/solarisVicent Marti2014-05-013-3/+4
|\ \ \ \ \ | | | | | | | | | | | | Solaris!