summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* revwalk: formatting updatescmn/revwalk-iterationEdward Thomson2018-06-181-17/+17
|
* revwalk: remove one useless layer of functionsCarlos Martín Nieto2018-04-111-32/+17
| | | | | | We don't currently need to have anything that's different between `get_revision` and `get_one_revision` so let's just remove the inner function and make the code more straightforward.
* revwalk: avoid walking the entire history when output is unsortedCarlos Martín Nieto2018-04-012-10/+59
| | | | | | | | | | | | | | | | | | | As part of reducing our divergence from git, its code for revwalk was ported into our codebase. A detail about when to limit the list was lost and we ended up always calling that code. Limiting the list means performing the walk and creating the final list of commits to be output during the preparation stage. This is unavoidable when sorting and when there are negative refs. We did this even when asked for unsorted output with no negative refs, which you might do to retrieve something like the "last 10 commits on HEAD" for a nominally unsorted meaning of "last". This commit adds and sets a flag indicating when we do need to limit the list, letting us avoid doing so when we can. The previously mentioned query thus no longer loads the entire history of the project during the prepare stage, but loads it iteratively during the walk.
* Merge pull request #4378 from cjhoward92/fix/submodule-add-check-indexPatrick Steinhardt2018-03-302-0/+109
|\ | | | | submodule: check index for path and prefix before adding submodule
| * submodule: add more robust error handling when a submodule path is found on addCarson Howard2018-03-282-13/+16
| |
| * submodule: add better error handling to is_path_occupiedCarson Howard2018-03-271-1/+4
| |
| * submodule: change can_add_submodule to is_path_occupiedCarson Howard2018-03-271-6/+11
| |
| * tests: submodule: insert index entries directly into indexCarson Howard2018-03-271-18/+22
| |
| * submodule: update index check to check path before directory and fix testsCarson Howard2018-03-272-27/+35
| |
| * submodule: fix styling errorsCarson Howard2018-03-272-61/+50
| |
| * test: submodule: add: join path without slashesCarson Howard2018-03-271-3/+3
| |
| * test: submodule: add: use p_mkdir to create directoriesCarson Howard2018-03-271-1/+1
| |
| * submodule: check index for prefix before adding submoduleCarson Howard2018-03-272-0/+97
| | | | | | | | | | | | | | submodule: check path and prefix before adding submodule submodule: fix test errors
* | Merge pull request #4602 from pks-t/pks/mempack-memleakEdward Thomson2018-03-291-0/+1
|\ \ | | | | | | odb: mempack: fix leaking objects when freeing mempacks
| * | odb: mempack: fix leaking objects when freeing mempacksPatrick Steinhardt2018-03-291-0/+1
|/ / | | | | | | | | | | | | | | When a ODB mempack gets free'd, we take no measures at all to free its contents, most notably the objects added to the database, resulting in a memory leak. Call `git_mempack_reset` previous to freeing the ODB structures themselves, which takes care of releasing all associated data structures.
* | Merge pull request #4598 from cjhoward92/fix/remove-unused-merge-resultPatrick Steinhardt2018-03-281-3/+0
|\ \ | |/ |/| types: remove unused git_merge_result
| * types: remove unused git_merge_resultCarson Howard2018-03-271-3/+0
|/ | | `git_merge_result` is currently unused in the codebase and generates a blank page in the [documentation](https://libgit2.github.com/libgit2/#HEAD/type/git_merge_result).
* Merge pull request #4531 from tiennou/fix/checkout-default-safeEdward Thomson2018-03-274-8/+4
|\ | | | | checkout: change default strategy to SAFE
| * checkout: change default strategy to SAFEEtienne Samson2018-03-264-8/+4
|/ | | As per #4200, our default is quite surprising to users that expect checkout to just "do the thing".
* Merge pull request #4570 from newren/masterPatrick Steinhardt2018-03-261-0/+1
|\ | | | | Add myself to git.git-authors
| * Add myself to git.git-authorsElijah Newren2018-03-071-0/+1
| |
* | Merge pull request #4594 from pks-t/pks/mempack-assertv0.27.0Edward Thomson2018-03-232-1/+61
|\ \ | | | | | | odb: fix writing to fake write streams
| * | odb: fix writing to fake write streamsPatrick Steinhardt2018-03-232-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 7ec7aa4a7 (odb: assert on logic errors when writing objects, 2018-02-01), the check for whether we are trying to overflowing the fake stream buffer was changed from returning an error to raising an assert. The conversion forgot though that the logic around `assert`s are basically inverted. Previously, if the statement stream->written + len > steram->size evaluated to true, we would return a `-1`. Now we are asserting that this statement is true, and in case it is not we will raise an error. So the conversion to the `assert` in fact changed the behaviour to the complete opposite intention. Fix the assert by inverting its condition again and add a regression test.
| * | tests: add tests for the mempack ODB backendPatrick Steinhardt2018-03-231-0/+52
|/ / | | | | | | | | | | Our mempack ODB backend has no test coverage at all right now. Add a simple test suite to at least have some coverage of the most basic operations on the ODB.
* | Merge pull request #4588 from libgit2/ethomson/bitbucketEdward Thomson2018-03-201-1/+1
|\ \ | | | | | | online tests: update auth for bitbucket test
| * | online tests: update auth for bitbucket testethomson/bitbucketEdward Thomson2018-03-201-1/+1
|/ / | | | | | | | | Update the settings to use a specific read-only token for accessing our test repositories in Bitbucket.
* | Merge pull request #4563 from libgit2/ethomson/ssh-unescapev0.27.0-rc3Edward Thomson2018-03-206-64/+163
|\ \ | | | | | | Refactor `gitno_extract_url_parts`
| * | buf: add tests for percent decodingethomson/ssh-unescapeEdward Thomson2018-03-191-0/+49
| | |
| * | gitno_extract_url_parts: decode hostnamesEdward Thomson2018-03-191-1/+1
| | | | | | | | | | | | | | | RFC 3986 says that hostnames can be percent encoded. Percent decode hostnames in our URLs.
| * | Remove now unnecessary `gitno_unescape`Edward Thomson2018-03-192-20/+0
| | |
| * | gitno_extract_url_parts: use `git_buf`sEdward Thomson2018-03-191-42/+73
| | | | | | | | | | | | | | | Now that we can decode percent-encoded strings as part of `git_buf`s, use that decoder in `gitno_extract_url_parts`.
| * | ssh urls: use `git_buf_decode_percent`Edward Thomson2018-03-191-8/+6
| | | | | | | | | | | | | | | Use `git_buf_decode_percent` so that we can avoid allocating a temporary buffer.
| * | Introduce `git_buf_decode_percent`Edward Thomson2018-03-192-1/+34
| | | | | | | | | | | | | | | Introduce a function to take a percent-encoded string (URI encoded, described by RFC 1738) and decode it into a `git_buf`.
| * | Update testsSteven King Jr2018-03-191-0/+2
| | |
| * | Unescape repo before constructing ssh requestSteven King Jr2018-03-191-1/+5
| | |
| * | Rename unescape and make non-staticSteven King Jr2018-03-192-3/+5
|/ /
* | Merge pull request #4584 from libgit2/ethomson/bitbucketEdward Thomson2018-03-191-4/+34
|\ \ | | | | | | online::clone: skip creds fallback test
| * | online::clone: skip creds fallback testEdward Thomson2018-03-191-4/+34
|/ / | | | | | | | | | | | | | | | | | | | | | | At present, we have three online tests against bitbucket: one which specifies the credentials in the payload, one which specifies the correct credentials in the URL and a final one that specifies the incorrect credentials in the URL. Bitbucket has begun responding to the latter test with a 403, which causes us to fail. Break these three tests into separate tests so that we can skip the latter until this is resolved on Bitbucket's end or until we can change the test to a different provider.
* | Merge pull request #4544 from josharian/docsPatrick Steinhardt2018-03-131-18/+35
|\ \ | | | | | | pathspec: improve git_pathspec_flag_t doc rendering
| * | pathspec: improve git_pathspec_flag_t doc renderingJosh Bleecher Snyder2018-02-231-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By placing docs per enum value rather than in a large block, the automated doc generation tool can make nicer docs, as could other automated tools, such as the mooted https://github.com/libgit2/git2go/issues/427. The current rendering is somewhat ugly: https://libgit2.github.com/libgit2/#HEAD/type/git_pathspec_flag_t No textual changes, just reorganization.
* | | Merge pull request #4575 from pks-t/pks/index-secfixes-masterEdward Thomson2018-03-121-18/+27
|\ \ \ | | | | | | | | Index parsing fixes
| * | | index: error out on unreasonable prefix-compressed path lengthsPatrick Steinhardt2018-03-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When computing the complete path length from the encoded prefix-compressed path, we end up just allocating the complete path without ever checking what the encoded path length actually is. This can easily lead to a denial of service by just encoding an unreasonable long path name inside of the index. Git already enforces a maximum path length of 4096 bytes. As we also have that enforcement ready in some places, just make sure that the resulting path is smaller than GIT_PATH_MAX. Reported-by: Krishna Ram Prakash R <krp@gtux.in> Reported-by: Vivek Parikh <viv0411.parikh@gmail.com>
| * | | index: fix out-of-bounds read with invalid index entry prefix lengthPatrick Steinhardt2018-03-101-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The index format in version 4 has prefix-compressed entries, where every index entry can compress its path by using a path prefix of the previous entry. Since implmenting support for this index format version in commit 5625d86b9 (index: support index v4, 2016-05-17), though, we do not correctly verify that the prefix length that we want to reuse is actually smaller or equal to the amount of characters than the length of the previous index entry's path. This can lead to a an integer underflow and subsequently to an out-of-bounds read. Fix this by verifying that the prefix is actually smaller than the previous entry's path length. Reported-by: Krishna Ram Prakash R <krp@gtux.in> Reported-by: Vivek Parikh <viv0411.parikh@gmail.com>
| * | | index: convert `read_entry` to return entry size via an out-paramPatrick Steinhardt2018-03-101-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function `read_entry` does not conform to our usual coding style of returning stuff via the out parameter and to use the return value for reporting errors. Due to most of our code conforming to that pattern, it has become quite natural for us to actually return `-1` in case there is any error, which has also slipped in with commit 5625d86b9 (index: support index v4, 2016-05-17). As the function returns an `size_t` only, though, the return value is wrapped around, causing the caller of `read_tree` to continue with an invalid index entry. Ultimately, this can lead to a double-free. Improve code and fix the bug by converting the function to return the index entry size via an out parameter and only using the return value to indicate errors. Reported-by: Krishna Ram Prakash R <krp@gtux.in> Reported-by: Vivek Parikh <viv0411.parikh@gmail.com>
* | | | Merge pull request #4396 from libgit2/cmn/config-regex-is-normalisedEdward Thomson2018-03-121-2/+26
|\ \ \ \ | |/ / / |/| | | config: specify how we match the regular expressions
| * | | config: explicitly state that subsections are case-sensitivecmn/config-regex-is-normalisedCarlos Martín Nieto2018-03-111-6/+11
| | | |
| * | | config: specify how we match the regular expressionsCarlos Martín Nieto2017-11-181-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do it the same as git does: case-sensitively on the normalized form of the variable name. While here also specify that we're case-sensitive on the values when handling the values when setting or deleting multivars.
* | | | Merge pull request #4571 from jacquesg/overflowPatrick Steinhardt2018-03-082-3/+4
|\ \ \ \ | |_|_|/ |/| | | Integer overflow
| * | | cmake: enable shift count overflow warningJacques Germishuys2018-03-081-0/+1
| | | |
| * | | diff: ensure an unsigned number is shiftedJacques Germishuys2018-03-081-3/+3
|/ / /