summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* buf: deprecate git_buf as a public typeethomson/userbufEdward Thomson2020-05-2923-183/+129
| | | | | | | | | | | | | | | The `git_buf` type is now no longer a publicly available structure, and the `git_buf` family of functions are no longer exported. The deprecation layer adds a typedef for `git_buf` (as `git_userbuf`) and macros that define `git_buf` functions as `git_userbuf` functions. This provides API (but not ABI) compatibility with libgit2 1.0's buffer functionality. Within libgit2 itself, we take care to avoid including those deprecated typedefs and macros, since we want to continue using the `git_buf` type and functions unmodified. Therefore, a `GIT_DEPRECATE_BUF` guard now wraps the buffer deprecation layer. libgit2 will define that.
* examples: use git_userbufEdward Thomson2020-05-293-7/+7
|
* filter: user-facing functions write to a userbufEdward Thomson2020-05-2918-102/+104
|
* merge: user-facing functions write to a userbufEdward Thomson2020-05-295-12/+12
|
* submodule: user-facing functions write to a userbufEdward Thomson2020-05-294-10/+19
|
* packbuilder: user-facing functions write to a userbufEdward Thomson2020-05-295-8/+7
|
* refspec: user-facing functions write to a userbufEdward Thomson2020-05-2911-34/+49
|
* object: user-facing functions write to a userbufEdward Thomson2020-05-293-7/+11
|
* diff: user-facing functions write to a userbufEdward Thomson2020-05-2910-105/+111
|
* notes: user-facing functions write to a userbufEdward Thomson2020-05-294-10/+11
|
* message: user-facing functions write to a userbufEdward Thomson2020-05-294-24/+24
|
* remote: user-facing functions write to a userbufEdward Thomson2020-05-295-23/+30
|
* tree: user-facing functions write to a userbufEdward Thomson2020-05-292-5/+14
|
* worktree: user-facing functions write to a userbufEdward Thomson2020-05-293-14/+19
|
* repository: user-facing functions write to a userbufEdward Thomson2020-05-2914-41/+53
|
* settings: user-facing functions write to a userbufEdward Thomson2020-05-297-28/+35
|
* describe: user-facing functions write to a userbufEdward Thomson2020-05-293-11/+15
|
* commit: user-facing functions write to a userbufEdward Thomson2020-05-297-52/+116
|
* branch: user-facing functions write to a userbufEdward Thomson2020-05-289-37/+54
|
* branch: remove unused git_branch_upstream__name declEdward Thomson2020-05-281-3/+13
|
* blob: user-facing functions write to a userbufEdward Thomson2020-05-287-61/+73
|
* config: user-facing functions write to a userbufEdward Thomson2020-05-2819-159/+221
|
* diff: user-facing functions write to a userbufEdward Thomson2020-05-2818-79/+98
|
* userbuf: provide a user-facing buffer structEdward Thomson2020-05-283-0/+137
| | | | | | | Introduce a new user-facing buffer struct that is compatible with `git_buf`. This will allow us to keep our `git_buf` implementation private, to disentangle the notion of public and private types. But since it's compatible, it's trivially castable.
* getenv: move into the buffer classEdward Thomson2020-05-288-61/+64
| | | | | `git__getenv` belongs in a class instead of as a top-level function, move it into the `git_buf` class as `git_buf_getenv`.
* Merge pull request #5522 from pks-t/pks/openssl-cert-memleakEdward Thomson2020-05-231-6/+12
|\ | | | | OpenSSL certificate memory leak
| * streams: openssl: fix memleak due to us not free'ing certsPatrick Steinhardt2020-05-151-6/+12
| | | | | | | | | | | | | | | | | | When creating a `git_cert` from the OpenSSL X509 certificate of a given stream, we do not call `X509_free()` on the certificate, leading to a memory leak as soon as the certificate is requested e.g. by the certificate check callback. Fix the issue by properly calling `X509_free()`.
* | Merge pull request #5515 from pks-t/pks/flaky-checkout-testEdward Thomson2020-05-232-22/+19
|\ \ | | | | | | tests: checkout: fix flaky test due to mtime race
| * | checkout::index: free the indexEdward Thomson2020-05-231-0/+2
| | |
| * | checkout: fix file being treated as unmodified due to racy indexPatrick Steinhardt2020-05-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to determine whether a file changed, we try to avoid heavy operations by fist taking a look at the index, seeing whether the index entry is modified already. This doesn't seem to cut it, though, as we currently have the racy checkout::index::can_disable_pathspec_match test case: sometimes the files get restored to their original contents, sometimes they aren't. The issue is caused by a racy index [1]: in case we modify a file, add it to the index and then modify it again in-place without changing its file, then we may end up with a modified file that has the same stat(3P) info as we've currently got it in its corresponding index entry. The mitigation for this is to treat files with the same mtime as the index are treated as racily modified. We already have this logic in place for the index, but not when doing a checkout. Fix the issue by only consulting the index entry in case it has an older mtime as the index. Previously, the following script reliably had at least 20 failures, while now there is no failure to be observed anymore: ```bash j=0 for i in $(seq 100) do if ! ./libgit2_clar -scheckout::index::can_disable_pathspec_match >/dev/null then j=$(($j + 1)) fi done echo "Failures: $j" ``` [1]: https://git-scm.com/docs/racy-git
| * | tests: checkout: fix stylistic issues and static variablePatrick Steinhardt2020-05-161-19/+13
| | | | | | | | | | | | | | | | | | | | | | | | The test case checkout::index::can_disable_pathspec_match has some shortcomings when it comes to coding style, which didn't fit our own coding style. Furthermore, it had an unnecessary static local variable. The test has been refactored to address these issues.
* | | Merge pull request #5523 from libgit2/pks/cmake-sort-reproducible-buildsEdward Thomson2020-05-235-25/+36
|\ \ \ | |/ / |/| | cmake: Sort source files for reproducible builds
| * | cmake: Sort source files for reproducible buildspks/cmake-sort-reproducible-buildsPatrick Steinhardt2020-05-155-25/+36
| |/ | | | | | | | | | | | | | | | | | | | | We currently use `FILE(GLOB ...)` in most places to find source and header files. This is problematic in that the order of files returned depends on the operating system's directory iteration order and may thus not be deterministic. As a result, we link object files in unspecified order, which may cause the linker to emit different code across runs. Fix this issue by sorting all code used as input to the libgit2 library to improve the reliability of reproducible builds.
* | Merge pull request #5517 from libgit2/pks/futils-symlink-argsEdward Thomson2020-05-122-6/+6
|\ \ | | | | | | futils: fix order of declared parameters for `git_futils_fake_symlink`
| * | futils: fix order of declared parameters for `git_futils_fake_symlink`pks/futils-symlink-argsPatrick Steinhardt2020-05-122-6/+6
| |/ | | | | | | | | | | | | | | | | While the function `git_futils_fake_symlink` is declared with arguments `new, old`, the implementation uses the reverse order `old, new`. Let's fix the ordering issues to be `new, old` for both, which matches what symlink(3P) has. While at it, we also rename these parameters: `old` and `new` doesn't really make a lot of sense in the context of symlinks, which is why this commit renames them to be called `target` and `path`.
* | Merge pull request #5516 from suhaibmujahid/update-releasePatrick Steinhardt2020-05-121-0/+11
|\ \ | | | | | | Check the version in package.json
| * | feat: Check the version in package.jsonSuhaib Mujahid2020-05-121-0/+11
|/ /
* | Merge pull request #5513 from libgit2/pks/tests-fix-32-bit-formatterEdward Thomson2020-05-121-1/+1
|\ \ | |/ |/| tests: merge: fix printf formatter on 32 bit arches
| * tests: merge: fix printf formatter on 32 bit archesPatrick Steinhardt2020-05-121-1/+1
|/ | | | | | | | | We currently use `PRIuMAX` to print an integer of type `size_t` in merge::trees::rename::cache_recomputation. While this works just fine on 64 bit arches, it doesn't on 32 bit ones. As a result, our nightly builds on x86 and arm32 fail. Fix the issue by using `PRIuZ` instead.
* Merge pull request #5511 from suhaibmujahid/patch-1Edward Thomson2020-05-121-1/+1
|\ | | | | Update package.json
| * Update package.jsonSuhaib Mujahid2020-05-111-1/+1
| |
* | Merge pull request #5509 from libgit2/ethomson/assert_macrosEdward Thomson2020-05-114-1/+155
|\ \ | | | | | | Introduce GIT_ASSERT macros
| * | assert: allow non-int returning functions to assertethomson/assert_macrosEdward Thomson2020-05-112-14/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Include GIT_ASSERT_WITH_RETVAL and GIT_ASSERT_ARG_WITH_RETVAL so that functions that do not return int (or more precisely, where `-1` would not be an error code) can assert. This allows functions that return, eg, NULL on an error code to do that by passing the return value (in this example, `NULL`) as a second parameter to the GIT_ASSERT_WITH_RETVAL functions.
| * | assert: optionally fall-back to assert(3)Edward Thomson2020-05-113-27/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fall back to the system assert(3) in debug builds, which may aide in debugging. "Safe" assertions can be enabled in debug builds by setting GIT_ASSERT_HARD=0. Similarly, hard assertions can be enabled in release builds by setting GIT_ASSERT_HARD to nonzero.
| * | Introduce GIT_ASSERT macrosEdward Thomson2020-05-113-1/+68
| |/ | | | | | | | | | | | | | | | | | | | | | | Provide macros to replace usages of `assert`. A true `assert` is punishing as a library. Instead we should do our best to not crash. GIT_ASSERT_ARG(x) will now assert that the given argument complies to some format and sets an error message and returns `-1` if it does not. GIT_ASSERT(x) is for internal usage, and available as an internal consistency check. It will set an error message and return `-1` in the event of failure.
* | Merge pull request #5512 from A-Ovchinnikov-mx/patch-1Edward Thomson2020-05-111-0/+15
|\ \ | |/ |/| README.md: Add instructions for building in MinGW environment
| * Update README.mdA-Ovchinnikov-mx2020-05-111-0/+15
|/ | | Add instructions for building libgit2 in MinGW environment
* Merge pull request #5510 from phkelley/stash-to-index-crashEdward Thomson2020-05-111-2/+2
|\ | | | | Fix uninitialized stack memory and NULL ptr dereference in stash_to_index
| * Fix uninitialized stack memory and NULL ptr dereference in stash_to_indexPhilip Kelley2020-05-101-2/+2
|/ | | | Caught by static analysis.
* checkout: Fix removing untracked files by path in subdirectoriesSegev Finer2020-05-112-2/+33
| | | | | | | | The checkout code didn't iterate into a subdir if it didn't match the pathspec, but since the pathspec might match files in the subdir we should recurse into it (In contrast to gitignore handling). Fixes #5089