- 05 Apr, 2020 1 commit
-
-
For years, we've repeatedly had confusion about what our actual coding style is not only for newcomers, but also across the core contributors. This can mostly be attributed to the fact that we do not have any coding conventions written down. This is now a thing of the past with the introduction of a new document that gives an initial overview of our style and most important best practices for both our C codebase as well as for CMake. While the proposed coding style for our C codebase should be rather uncontroversial, the coding style for CMake might be. This can be attributed to multiple facts. First, the CMake code base doesn't really have any uniform coding style and is quite outdated in a lot of places. Second, the proposed coding style actually breaks with our existing one: we currently use all-uppercase function names and variables, but the documented coding style says we use all-lowercase function names but all-uppercase variables. It's common practice in CMake to write variables in all upper-case, and in fact all variables made available by CMake are exactly that. As variables are case-sensitive in CMake, we cannot and shouldn't break with this. In contrast, function calls are case insensitive, and modern CMake always uses all-lowercase ones. I argue we should do the same to get in line with other codebases and to reduce the likelihood of repetitive strain injuries. So especially for CMake, the proposed coding style says something we don't have yet. I'm fine with that, as the document explicitly says that it's what we want to have and not what we have right now.
Patrick Steinhardt committed
-
- 04 Apr, 2020 4 commits
-
-
pack: Improve error handling for get_delta_base()
Patrick Steinhardt committed -
repo::open: ensure we can open the repository
Patrick Steinhardt committed -
examples: additions and fixes
Patrick Steinhardt committed -
merge: cache negative cache results for similarity metrics
Patrick Steinhardt committed
-
- 03 Apr, 2020 1 commit
-
-
Update the test cases to check the `git_repository_open` return code.
Edward Thomson committed
-
- 02 Apr, 2020 4 commits
-
-
add example for git commit fix example for git add add example for git push
Peter Salomonsen committed -
lhchavez committed
-
Handle repository format v1
Patrick Steinhardt committed -
CMake: backend selection streamlining
Patrick Steinhardt committed
-
- 01 Apr, 2020 10 commits
-
-
refdb_fs: remove unused header file
Edward Thomson committed -
This makes get_delta_base() return the error code as the return value and the delta base as an out-parameter.
lhchavez committed -
This change moves the responsibility of setting the error upon failures of get_delta_base() to get_delta_base() instead of its callers. That way, the caller chan always check if the return value is negative and mark the whole operation as an error instead of using garbage values, which can lead to crashes if the .pack files are malformed.
lhchavez committed -
patch: correctly handle mode changes for renames
Edward Thomson committed -
gitignore: clean up patterns from old times
Edward Thomson committed -
README.md: update build matrix to reflect our latest releases
Edward Thomson committed -
We're currently doing unnecessary work to auto-detect backends even if the functionality is disabled altogether. Let's fix this by removing the extraneous FOO_BACKEND variables, instead letting auto-detection modify the variable itself.
Patrick Steinhardt committed -
Patrick Steinhardt committed
-
Release v1.0
Patrick Steinhardt committed -
When computing renames, we cache the hash signatures for each of the potentially conflicting entries so that we do not need to repeatedly read the file and can at least halfway efficiently determine whether two files are similar enough to be deemed a rename. In order to make the hash signatures meaningful, we require at least four lines of data to be present, resulting in at least four different hashes that can be compared. Files that are deemed too small are not cached at all and will thus be repeatedly re-hashed, which is usually not a huge issue. The issue with above heuristic is in case a file does _not_ have at least four lines, where a line is anything separated by a consecutive run of "\n" or "\0" characters. For example "a\nb" is two lines, but "a\0\0b" is also just two lines. Taken to the extreme, a file that has megabytes of consecutive space- or NUL-only may also be deemed as too small and thus not get cached. As a result, we will repeatedly load its blob, calculate its hash signature just to finally throw it away as we notice it's not of any value. When you've got a comparitively big file that you compare against a big set of potentially renamed files, then the cost simply expodes. The issue can be trivially fixed by introducing negative cache entries. Whenever we determine that a given blob does not have a meaningful representation via a hash signature, we store this negative cache marker and will from then on not hash it again, but also ignore it as a potential rename target. This should help the "normal" case already where you have a lot of small files as rename candidates, but in the above scenario it's savings are extraordinarily high. To verify we do not hit the issue anymore with described solution, this commit adds a test that uses the exact same setup described above with one 50 megabyte blob of '\0' characters and 1000 other files that get renamed. Without the negative cache: $ time ./libgit2_clar -smerge::trees::renames::cache_recomputation >/dev/null real 11m48.377s user 11m11.576s sys 0m35.187s And with the negative cache: $ time ./libgit2_clar -smerge::trees::renames::cache_recomputation >/dev/null real 0m1.972s user 0m1.851s sys 0m0.118s So this represents a ~350-fold performance improvement, but it obviously depends on how many files you have and how big the blob is. The test number were chosen in a way that one will immediately notice as soon as the bug resurfaces.
Patrick Steinhardt committed
-
- 30 Mar, 2020 1 commit
-
-
The gitignore file currently has a lot of patterns for files that we shouldn't write anymore since we have migrated to CMake, as everybody is expected to do out-of-source builds anyway. Let's remove them.
Patrick Steinhardt committed
-
- 28 Mar, 2020 2 commits
-
-
Patrick Steinhardt committed
-
Patrick Steinhardt committed
-
- 26 Mar, 2020 8 commits
-
-
When generating a patch for a renamed file whose mode bits have changed in addition to the rename, then we currently fail to parse the generated patch. Furthermore, when generating a diff we output mode bits after the similarity metric, which is different to how upstream git handles it. Fix both issues by adding another state transition that allows similarity indices after mode changes and by printing mode changes before the similarity index.
Patrick Steinhardt committed -
refdb_backend: improve callback documentation
Patrick Steinhardt committed -
credentials: provide backcompat for opaque structs
Patrick Steinhardt committed -
The credential structures are now opaque and defined in `sys/credential.h`. However, we should continue to provide them for backward compatibility, unless `GIT_DEPRECATED_HARD` is set.
Edward Thomson committed -
Fix segfault when calling git_blame_buffer()
Edward Thomson committed -
The callbacks are currently sparsely documented, making it really hard to implement a new backend without taking a look at the existing refdb_fs backend. Add documentation to make this task hopefully easier to achieve.
Patrick Steinhardt committed -
Fix spelling error
Patrick Steinhardt committed -
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
Utkarsh Gupta committed
-
- 25 Mar, 2020 1 commit
-
-
The "refdb_fs.h" header contains a single struct `git_refcache` that is not used anywhere. As a result, we can just delete the header altogether as it doesn't have any purpose and may confuse readers.
Patrick Steinhardt committed
-
- 23 Mar, 2020 3 commits
-
-
This change makes sure that the hunk is not null before trying to dereference it. This avoids segfaults, especially when blaming against a modified buffer (i.e. the index). Fixes: #5443
lhchavez committed -
refdb_fs: initialize backend version
Edward Thomson committed -
repository: improve commondir docs
Edward Thomson committed
-
- 22 Mar, 2020 1 commit
-
-
While the `git_refdb_backend()` struct has a version, we do not initialize it correctly when calling `git_refdb_backend_fs()`. Fix this by adding the call to `git_refdb_init_backend()`.
Patrick Steinhardt committed
-
- 21 Mar, 2020 1 commit
-
-
cmake: use install directories provided via GNUInstallDirs
Edward Thomson committed
-
- 18 Mar, 2020 1 commit
-
-
azure: fix errors due to curl and removal of old VM images
Edward Thomson committed
-
- 17 Mar, 2020 1 commit
-
-
mbedTLS has fixed their certificate.
🎉 Edward Thomson committed
-
- 14 Mar, 2020 1 commit
-
-
We currently hand-code logic to configure where to install our artifacts via the `LIB_INSTALL_DIR`, `INCLUDE_INSTALL_DIR` and `BIN_INSTALL_DIR` variables. This is reinventing the wheel, as CMake already provide a way to do that via `CMAKE_INSTALL_<DIR>` paths, e.g. `CMAKE_INSTALL_LIB`. This requires users of libgit2 to know about the discrepancy and will require special hacks for any build systems that handle these variables in an automated way. One such example is Gentoo Linux, which sets up these paths in both the cmake and cmake-utils eclass. So let's stop doing that: the GNUInstallDirs module handles it in a better way for us, especially so as the actual values are dependent on CMAKE_INSTALL_PREFIX. This commit removes our own set of variables and instead refers users to use the standard ones. As a second benefit, this commit also fixes our pkgconfig generation to use the GNUInstallDirs module. We had a bug there where we ignored the CMAKE_INSTALL_PREFIX when configuring the libdir and includedir keys, so if libdir was set to "lib64", then libdir would be an invalid path. With GNUInstallDirs, we can now use `CMAKE_INSTALL_FULL_LIBDIR`, which handles the prefix for us.
Patrick Steinhardt committed
-