summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* message: update docs for git_message_prettifycmn/prettify-docsCarlos Martín Nieto2018-01-191-3/+2
| | | | | | | | We used to hard-code the octothorpe as the comment character and the documentation still mentions this even though we accept the comment character as a parameter. Update the line to indicate this and clean up the first paragraph a bit.
* Merge pull request #4451 from libgit2/charliesome/trailer-infoBrian Lopez2018-01-173-0/+622
|\ | | | | Implement message trailer parsing API
| * rename find_trailer to extract_trailer_blockcharliesome/trailer-infoBrian Lopez2018-01-171-2/+2
| |
| * update code docsBrian Lopez2018-01-161-4/+15
| |
| * just use git_message_trailer in testsBrian Lopez2018-01-161-15/+10
| |
| * try and fix windows buildBrian Lopez2018-01-161-1/+2
| |
| * Change trailer API to return a simple arrayBrian Lopez2018-01-163-32/+46
| |
| * Merge remote-tracking branch 'origin/master' into charliesome/trailer-infoBrian Lopez2018-01-1022-123/+157
| |\
| * | switch back to braced array initializersBrian Lopez2018-01-051-61/+40
| | |
| * | make separators const a macro as wellBrian Lopez2018-01-031-5/+4
| | |
| * | remove empty lines between @-linesBrian Lopez2018-01-031-3/+0
| | |
| * | make comment_line_char const a macroBrian Lopez2018-01-031-4/+4
| | |
| * | Don't use newer C syntax for declaration in testsBrian Lopez2018-01-031-57/+78
| | |
| * | Merge remote-tracking branch 'origin/master' into charliesome/trailer-infoBrian Lopez2018-01-0244-427/+1397
| |\ \
| * | | trailer: use git__prefixcmp instead of starts_withCharlie Somerville2017-12-201-15/+3
| | | |
| * | | trailer: remove inline specifier on is_blank_lineCharlie Somerville2017-12-201-1/+1
| | | |
| * | | tests: add message trailer parsing test casesCharlie Somerville2017-12-191-0/+179
| | | |
| * | | message: add routine for parsing trailers from messagesCharlie Somerville2017-12-192-0/+438
| | | | | | | | | | | | | | | | | | | | This is implemented in trailer.c and borrows a large amount of logic from Git core to ensure compatibility.
* | | | Merge pull request #4477 from pks-t/pks/memleaksCarlos Martín Nieto2018-01-174-8/+6
|\ \ \ \ | |_|_|/ |/| | | Memory leaks
| * | | tests: refs::iterator: fix memory leak due to ref names not being free'dPatrick Steinhardt2018-01-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The test refs::iterator::foreach_name iterates through every reference and copies its name into a local vector. While the test makes sure to free the vector afterwards, the copied reference names are not being free'd. Fix that.
| * | | refs: document need to free refs in foreach-callbackPatrick Steinhardt2018-01-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | References passed to the callback function of `git_reference_foreach` are expected to be owned by the callback. As such, they are never being freed by `git_reference_foreach`, but will have to be freed by the caller. This small detail is never mentioned in the function's documentation, though, making it easy to get wrong. Document this to make it discoverable.
| * | | transports: local: fix memory leak in reference walkPatrick Steinhardt2018-01-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upon downloading the pack file, the local transport will iterate through every reference using `git_reference_foreach`. The function is a bit tricky though in that it requires the passed callback to free the references, which does not currently happen. Fix the memory leak by freeing all passed references in the callback.
| * | | tests: network::fetchlocal: let cleanup function handle sandbox cleanupPatrick Steinhardt2018-01-121-8/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | Two tests in network::fetchlocal explicitly set a cleanup function to free and remove the created sandbox repositories. This is not necessary, though, as the cleanup function executed after each test already takes care of cleaning up after them. Remove the code to avoid needless code duplication.
* | | Merge pull request #4472 from libgit2/ethomson/libgit2deps_azureCarlos Martín Nieto2018-01-101-2/+2
|\ \ \ | | | | | | | | travis: fetch trusty dependencies from Bintray
| * | | travis: we use bintray's own key for signingethomson/libgit2deps_azureCarlos Martín Nieto2018-01-101-1/+1
| | | | | | | | | | | | The VM on Travis apparently will still proceed, but it's good practice.
| * | | travis: fetch trusty dependencies from bintrayEdward Thomson2018-01-101-1/+1
| | | | | | | | | | | | | | | | The trusty dependencies are now hosted on Bintray.
* | | | Merge pull request #4471 from libgit2/cmn/cmake-feature-302Patrick Steinhardt2018-01-101-1/+2
|\ \ \ \ | |/ / / |/| | | cmake: use a FEATURE_SUMMARY call compatible with 3.0.2
| * | | cmake: use a FEATURE_SUMMARY call compatible with 3.0.2cmn/cmake-feature-302Carlos Martín Nieto2018-01-101-1/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we print features, we make an effort to support all the way back to pre-3.0. However, in the code for versions from 3 onward we call `FEATURE_SUMMARY` with multiple kinds of elements to print in the same line. This is only supported in CMake 3.1 and later, making the rather popular CMake 3.0.2 unable to build the library. Use a single kind of element per invocation. This means we need to provide a "description" text, which CMake provides for us if provide multiple kinds of elements.
* | | Merge pull request #4468 from libgit2/cmn/openssl-pcCarlos Martín Nieto2018-01-081-2/+6
|\ \ \ | | | | | | | | Make sure to include 'openssl' as a dep when building statically with SHA1DC
| * | | cmake: add openssl to the private deps list when it's the TLS implementationCarlos Martín Nieto2018-01-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We might want OpenSSL to be the implementation for SHA-1 and/or TLS. If we only want it for TLS (e.g. we're building with the collision-detecting SHA-1 implementation) then we did not indicate this to the systems including us a static library. Add OpenSSL to the list also during the TLS decision to make sure we say we should link to it if we use it for TLS.
| * | | cmake: treat LIBGIT2_PC_REQUIRES as a listCarlos Martín Nieto2018-01-081-2/+5
|/ / / | | | | | | | | | | | | | | | It is indeed a list of dependencies for those which include the static archive. This is in preparation for adding two possible places where we might add openssl as a dependency.
* | | Merge pull request #4467 from libgit2/cmn/static-archive-laterCarlos Martín Nieto2018-01-071-4/+6
|\ \ \ | | | | | | | | cmake: move the rule to find static archives close to building clar
| * | | cmake: move the rule to find static archives close to building clarcmn/static-archive-laterCarlos Martín Nieto2018-01-071-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we're building static libraries, we want to use that for building our clar binary. This is done in 49551254 (2017-09-22; cmake: use static dependencies when building static libgit2) but that commit included the rule too early, making it affect the search for iconv, meaning we did not find it when we were building a static libgit2. Move the rule to just before building clar, after we've included the rules for building the library itself. This lets us find and link to the dynamic libiconv.
* | | | Merge pull request #4398 from pks-t/pks/generic-sha1Edward Thomson2018-01-052-21/+27
|\ \ \ \ | |/ / / |/| | | cmake: allow explicitly choosing SHA1 backend
| * | | cmake: allow explicitly choosing SHA1 backendPatrick Steinhardt2018-01-042-21/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, if SHA1DC is disabled, the SHA1 backend is mostly chosen based on which system libgit2 is being compiled on and which libraries have been found. To give developers and distributions more choice, enable them to request specific backends by passing in a `-DSHA1_BACKEND=<BACKEND>` option instead. This completely replaces the previous auto-selection.
| * | | cmake: default to using SHA1DCPatrick Steinhardt2018-01-041-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | Upstream git.git has changed their default SHA1 implementation to the collision-detection algorithm SHA1DC in commit e6b07da27 (Makefile: make DC_SHA1 the default, 2017-03-17). To match upstream, align ourselves and switch over to SHA1DC by default.
* | | Merge pull request #4257 from pks-t/pks/stale-testEdward Thomson2018-01-0311-58/+43
|\ \ \ | | | | | | | | Execute stale tests
| * | | tests: create new test target for all SSH-based testsPatrick Steinhardt2018-01-032-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some tests shall be run against our own SSH server we spin up in Travis. As those need to be run separate from our previous tests which run against git-daemon, we have to do this in a separate step. Instead of bundling all that knowledge in the CI script, move it into the test build instructions by creating a new test target.
| * | | tests: online::clone: inline creds-test with nonexistent URLPatrick Steinhardt2018-01-034-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, we test our credential callback code twice, once via SSH on localhost and once via a non-existent GitHub repository. While the first URL makes sense to be configurable, it does not make sense to hard-code the non-existing repository, which requires us to call tests multiple times. Instead, we can just inline the URL into another set of tests.
| * | | tests: online::clone: construct credential-URL from environmentPatrick Steinhardt2018-01-034-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We support two types of passing credentials to the proxy, either via the URL or explicitly by specifying user and password. We test these types by modifying the proxy URL and executing the tests twice, which is in fact unnecessary and requires us to maintain the list of environment variables and test executions across multiple CI infrastructures. To fix the situation, we can just always pass the host, port, user and password to the tests. The tests can then assemble the complete URL either with or without included credentials, allowing us to test both cases in-process.
| * | | tests: perf: build but exclude performance tests by defaultPatrick Steinhardt2018-01-032-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our performance tests (or to be more concrete, our single performance test) are not built by default, as they are always #ifdef'd out. While it is true that we don't want to run performance tests by default, not compiling them at all may cause code rot and is thus an unfavorable approach to handle this. We can easily improve this situation: this commit removes the #ifdef, causing the code to always be compiled. Furthermore, we add `-xperf` to the default command line parameters of `generate.py`, thus causing the tests to be excluded by default. Due to this approach, we are now able to execute the performance tests by passing `-sperf` to `libgit2_clar`. Unfortunately, we cannot execute the performance tests on Travis or AppVeyor as they rely on history being available for the libgit2 repository. As both do a shallow clone only, though, this is not given.
| * | | tests: iterator::workdir: fix reference count in stale testPatrick Steinhardt2018-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test `iterator::workdir::filesystem_gunk` is usually not executed, as it is guarded by the environment variable "GITTEST_INVASIVE_SPEED" due to its effects on speed. As such, it has become stale and does not account for new references which have meanwhile been added to the testrepo, causing it to fail. Fix this by raising the number of expected references to 15.
| * | | tests: iterator_helpers: assert number of iterator itemsPatrick Steinhardt2018-01-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the function `expect_iterator_items` surpasses the number of expected items, we simply break the loop. This causes us to trigger an assert later on which has message attached, which is annoying when trying to locate the root error cause. Instead, directly assert that the current count is still smaller or equal to the expected count inside of the loop.
| * | | tests: status::worktree: indicate skipped tests on Win32Patrick Steinhardt2018-01-034-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some function bodies of tests which are not applicable to the Win32 platform are completely #ifdef'd out instead of calling `cl_skip()`. This leaves us with no indication that these tests are not being executed at all and may thus cause decreased scrutiny when investigating skipped tests. Improve the situation by calling `cl_skip()` instead of just doing nothing.
| * | | travis: build sources with tracing enabledPatrick Steinhardt2018-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our tracing architecture is not built by default, causing the Travis CI to not execute some code and skip several tests. As AppVeyor has already enabled the tracing architecture when building the code, we should do the same for Travis CI to have this code being tested on macOS and Linux. Add "-DENABLE_TRACE=ON" to our release-build options of Travis.
* | | | Merge pull request #4437 from pks-t/pks/openssl-hash-errorsEdward Thomson2018-01-032-8/+31
|\ \ \ \ | | | | | | | | | | hash: openssl: check return values of SHA1_* functions
| * | | | streams: openssl: fix thread-safety for OpenSSL error messagesPatrick Steinhardt2018-01-031-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function `ERR_error_string` can be invoked without providing a buffer, in which case OpenSSL will simply return a string printed into a static buffer. Obviously and as documented in ERR_error_string(3), this is not thread-safe at all. As libgit2 is a library, though, it is easily possible that other threads may be using OpenSSL at the same time, which might lead to clobbered error strings. Fix the issue by instead using a stack-allocated buffer. According to the documentation, the caller has to provide a buffer of at least 256 bytes of size. While we do so, make sure that the buffer will never get overflown by switching to `ERR_error_string_n` to specify the buffer's size.
| * | | | hash: openssl: check return values of SHA1_* functionsPatrick Steinhardt2018-01-031-3/+18
| | |_|/ | |/| | | | | | | | | | | | | | | | | | The OpenSSL functions `SHA1_Init`, `SHA1_Update` and `SHA1_Final` all return 1 for success and 0 otherwise, but we never check their return values. Do so.
* | | | Merge pull request #4462 from pks-t/pks/diff-generated-excessive-statsEdward Thomson2018-01-035-10/+20
|\ \ \ \ | | | | | | | | | | diff_generate: avoid excessive stats of .gitattribute files
| * | | | diff_generate: avoid excessive stats of .gitattribute filesPatrick Steinhardt2018-01-035-10/+20
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When generating a diff between two trees, for each file that is to be diffed we have to determine whether it shall be treated as text or as binary files. While git has heuristics to determine which kind of diff to generate, users can also that default behaviour by setting or unsetting the 'diff' attribute for specific files. Because of that, we have to query gitattributes in order to determine how to diff the current files. Instead of hitting the '.gitattributes' file every time we need to query an attribute, which can get expensive especially on networked file systems, we try to cache them instead. This works perfectly fine for every '.gitattributes' file that is found, but we hit cache invalidation problems when we determine that an attribuse file is _not_ existing. We do create an entry in the cache for missing '.gitattributes' files, but as soon as we hit that file again we invalidate it and stat it again to see if it has now appeared. In the case of diffing large trees with each other, this behaviour is very suboptimal. For each pair of files that is to be diffed, we will repeatedly query every directory component leading towards their respective location for an attributes file. This leads to thousands or even hundreds of thousands of wasted syscalls. The attributes cache already has a mechanism to help in that scenario in form of the `git_attr_session`. As long as the same attributes session is still active, we will not try to re-query the gitmodules files at all but simply retain our currently cached results. To fix our problem, we can create a session at the top-most level, which is the initialization of the `git_diff` structure, and use it in order to look up the correct diff driver. As the `git_diff` structure is used to generate patches for multiple files at once, this neatly solves our problem by retaining the session until patches for all files have been generated. The fix has been tested with linux.git by calling `git_diff_tree_to_tree` and `git_diff_to_buf` with v4.10^{tree} and v4.14^{tree}. | time | .gitattributes stats without fix | 33.201s | 844614 with fix | 30.327s | 4441 While execution only improved by roughly 10%, the stat(3) syscalls for .gitattributes files decreased by 99.5%. The benchmarks were quite simple with best-of-three timings on Linux ext4 systems. One can assume that for network based file systems the performance gain will be a lot larger due to a much higher latency.