- 22 Feb, 2019 1 commit
-
-
Allocator restructuring
Edward Thomson committed
-
- 21 Feb, 2019 12 commits
-
-
cache: fix misnaming of `git_cache_free`
Patrick Steinhardt committed -
examples: produce single cgit2 binary
Patrick Steinhardt committed -
Functions that free a structure's contents but not the structure itself shall be named `dispose` in the libgit2 project, but the function `git_cache_free` does not follow this naming pattern. Fix this by renaming it to `git_cache_dispose` and adjusting all callers to make use of the new name.
Patrick Steinhardt committed -
In commit 6e0dfc6f (Make stdalloc__reallocarray call stdalloc__realloc, 2019-02-16), we have changed the stdalloc allocator to reuse `stdalloc__realloc` to implement `stdalloc__reallocarray`. This commit is making the same change for the Windows-specific crtdbg allocator to avoid code duplication.
Patrick Steinhardt committed -
The Windows-specific crtdbg allocator is currently mixed into the crtdbg stacktracing compilation unit, making it harder to find than necessary. Extract it and move it into the new "allocators/" subdirectory to improve discoverability. This change means that the crtdbg compilation unit is now compiled unconditionally, whereas it has previously only been compiled on Windows platforms. Thus we now have additional guards around the code so that it will only be compiled if GIT_MSVC_CRTDBG is defined. This also allows us to move over the fallback-implementation of `git_win32_crtdbg_init_allocator` into the same compilation unit.
Patrick Steinhardt committed -
Right now, our two allocator implementations are scattered around the tree in "stdalloc.h" and "win32/w32_crtdbg_stacktrace.h". Start grouping them together in a single directory "allocators/", similar to how e.g. our streams are organized.
Patrick Steinhardt committed -
Remove public 'inttypes.h' header
Patrick Steinhardt committed -
Remove an `inttypes.h` header that is too large in scope, and far too public. For Visual Studio 2012 and earlier (ie, `_MSC_VER < 1800`), we do need to include `stdint.h` in our public headers, for types like `uint32_t`. Internally, we also need to define `PRId64` as a printf formatting string when it is not available.
Edward Thomson committed -
Prevent reading out of bounds memory
Patrick Steinhardt committed -
Previously, we would fail to correctly truncate the source buffer if the source has more than one line and ends with a non-newline character. In the following call, we thus truncate the source string in the middle of the second line. Without the bug fixed, we would successfully apply the patch to the source and return success. With the overflow being fixed, we should return an error now.
Patrick Steinhardt committed -
When parsing the patch image from a string, we split the string by newlines to get a line-based view of it. To split, we use `memchr` on the buffer and limit the buffer length by the original length provided by the caller. This works just fine for the first line, but for every subsequent line we need to actually subtract the amount of bytes that we have already read. The above issue can be easily triggered by having a source buffer with at least two lines, where the second line does _not_ end in a newline. Given a string "foo\nb", we have an original length of five bytes. After having extracted the first line, we will point to 'b' and again try to `memchr(p, '\n', 5)`, resulting in an out-of-bounds read of four bytes. Fix the issue by correctly subtracting the amount of bytes already read.
Erik Aigner committed -
Fix a memory leak in odb_otype_fast()
Patrick Steinhardt committed
-
- 20 Feb, 2019 4 commits
-
-
This change frees a copy of a cached object in odb_otype_fast().
lhchavez committed -
Make stdalloc__reallocarray call stdalloc__realloc
Patrick Steinhardt committed -
Remove `git_time_monotonic`
Patrick Steinhardt committed -
Fix a _very_ improbable memory leak in git_odb_new()
Patrick Steinhardt committed
-
- 17 Feb, 2019 8 commits
-
-
`git_time_monotonic` was added so that non-native bindings like rugged could get high-resolution timing for benchmarking. However, this is outside the scope of libgit2 *and* rugged decided not to use this function in the first place. Google suggests that absolutely _nobody_ is using this function and we don't want to be in the benchmarking business. Remove the function.
Edward Thomson committed -
ci: publish documentation on merge
Edward Thomson committed -
When a commit is pushed or merged into one of the release branches (master, maint/*) then push the documentation update to gh-pages.
Edward Thomson committed -
This reverts commit 2a4e866a.
Edward Thomson committed -
Edward Thomson committed
-
Edward Thomson committed
-
When a continuous integration build runs (ie a commit is pushed or merged into one of the CI branches, `master` or `maint/*`) then push the rebuilt documentation into the `gh-pages` branch.
Edward Thomson committed -
This change fixes a mostly theoretical memory leak in got_odb_new() that can only manifest if git_cache_init() fails due to running out of memory or not being able to acquire its lock.
lhchavez committed
-
- 16 Feb, 2019 1 commit
-
-
This change avoids calling realloc(3) in more than one place.
lhchavez committed
-
- 15 Feb, 2019 6 commits
-
-
Etienne Samson committed
-
Patrick Steinhardt committed
-
Inside of our networking example code, we have a git2 executable that acts as an entry point to all the different network examples. As such, it is kind of the same like the normal git(1) executable in that it simply arbitrates to the respective subcommands. Let's extend this approach and merge all examples into a single standalone lg2 executable. Instead of building an executable for all the existing examples we have, we now bundle them all inside of the lg2 one and let them be callable via subcommands. In the process, we can get rid of duplicated library initialization, deinitialization and repository discovery code. Instead of having each subcommand handle these on its own, we simply do it inside of the single main function now.
Patrick Steinhardt committed -
Right now, we have two sets of "common" code, one containing general common code and one containing network common code. As we intend to get rid of the network subdirectory and instead merge all examples into a single standalone executable, this distinction doesn't make a lot of sense now. Furthermore, the common network code is not that big. Let's get rid of the common network code by merging it into the general common code.
Patrick Steinhardt committed -
This Makefile isn't used anymore and probably won't work anyway. Remove it in favor of the existing CMake build instructions.
Patrick Steinhardt committed -
In commit 2e233285 (examples: a test, for rev-list, 2013-03-20), a script was introduced with the intention of testing our rev-list example code. Nobody uses that script, and in fact it doesn't even properly work due to the not-so-recent addition out-of-source builds. Remove the script.
Patrick Steinhardt committed
-
- 14 Feb, 2019 8 commits
-
-
Enable creation of worktree from bare repo's default branch
Edward Thomson committed -
Allow bypassing check for '.keep' file
Edward Thomson committed -
Deprecation: export the deprecated functions properly
Edward Thomson committed -
In a bare repository, HEAD usually points to the branch that is considered the "default" branch. As the current implementation for `git_branch_is_checked_out` only does a comparison of HEAD with the branch that is to be checked, it will say that the branch pointed to by HEAD in such a bare repo is checked out. Fix this by skipping the main repo's HEAD when it is bare.
Patrick Steinhardt committed -
Right now, the function `git_repository_foreach_head` will always iterate over all HEADs of the main repository and its worktrees. In some cases, it might be required to skip either of those, though. Add a flag in preparation for the following commit that enables this behaviour.
Patrick Steinhardt committed -
Libraries should use assert(3P) only very scarcely. First, we usually shouldn't cause the caller of our library to abort in case where the assert fails. Second, if code is compiled with -DNDEBUG, then the assert will not be included at all. In our `git_branch_is_checked_out` function, we have an assert that verifies that the given reference parameter is non-NULL and in fact a branch. While the first check is fine, the second is not. E.g. when compiled with -DNDEBUG, we'd proceed and treat the given reference as a branch in all cases. Fix the issue by instead treating a non-branch reference as not being checked out. This is the obvious solution, as references other than branches cannot be directly checked out.
Patrick Steinhardt committed -
We currently do not have any tests at all for the `git_branch_is_checked_out` function. Add some basic ones.
Patrick Steinhardt committed -
When adding a new worktree, we only verify that an optionally given reference is valid half-way through the function. At this point, some data structures have already been created on-disk. If we bail out due to an invalid reference, these will be left behind and need to be manually cleaned up by the user. Improve the situation by moving the reference checks to the function's preamble. Like this, we error out as early as possible and will not leave behind any files.
Patrick Steinhardt committed
-