summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* util as a directoryethomson/util_as_a_directoryEdward Thomson2020-04-3059-234/+310
|
* util: add more to the utility libraryethomson/middlewareEdward Thomson2020-04-081-4/+12
|
* path: split repository-specific functionsEdward Thomson2020-04-0811-461/+490
| | | | | Make path.[ch] contain pure utility functions that do not know about public-facing libgit2 objects, including `git_repository`.
* cli: introduce a clone commandEdward Thomson2020-04-063-1/+159
|
* cli: introduce a progress classEdward Thomson2020-04-062-0/+441
| | | | | | Provide a class that will display progress information to the console. Initially, it contains callbacks for fetch progress and checkout progress.
* cli: introduce a help commandEdward Thomson2020-04-065-6/+169
| | | | | | | | | | Set up a framework for subcommands, and introduce the first, "help". Help will display the commands available, and information about the help command itself. Commands are expected to provide their own usage and help information, which the help command will proxy to when necessary.
* cli: introduce usageEdward Thomson2020-04-069-5/+305
| | | | | | Our options parsing system can also be used as the basis for displaying command-line usage. Add usage information, using knowledge of the console (if we're attached to one) for wrapping nicely.
* cli: add global stateEdward Thomson2020-04-064-2/+36
| | | | | | | As we consume parts of the libgit2 utility functions (like `git_buf`), we will inevitably need to allocate. Since we re-use the libgit2 allocation functions - but linked into our application - we'll need to configure our allocation strategy ahead of time.
* cli: infrastructure for a cli projectEdward Thomson2020-04-067-0/+653
| | | | | | | | | | | | | | | | | | | | | | | Introduce a command-line interface for libgit2. The goal is to be git-compatible, so that: 1. By creating a git client ourselves, we can understand the needs of git clients and produce a common "middleware" for commonly-used pieces of client functionality. For example: interacting with other command-line tools, like filter drivers or merge drivers. This can assist other git clients. 2. We can benefit from git's unit tests, running their test suite against our own CLI to ensure correct behavior. 3. We can easily benchmark ourselves against git to understand where we are poorly performing, by running identical commands between git and ourselves. 4. We can easily A/B test ourselves against git, at least for read-only operations, which will ensure that we are producing identical output. This commit introduces a simple infrastructure for the CLI.
* fixup! libgit2client: a client "middleware" libraryEdward Thomson2020-04-063-0/+78
|
* libgit2client: a client "middleware" libraryEdward Thomson2020-04-065-0/+108
| | | | | | | | | | | | Introduce libgit2client, a client "middleware" library. This is an experimental set of utility functions and classes for client software that builds on top of libgit2. This library might contain - for example - code that invokes filters or other tools. This is incredibly useful to share and reuse among consumers but should be excluded from libgit2 itself. Users may, understandably, not want code that executes arbitrary other commands in libgit2 itself.
* errors: move system error message getter to utilEdward Thomson2020-04-063-21/+37
| | | | | Provide the system error message functionality (strerror or the string handling for GetLastError on Windows) into a utility class.
* Merge pull request #5485 from libgit2/ethomson/sysdir_unusedPatrick Steinhardt2020-04-052-30/+0
|\ | | | | sysdir: remove unused git_sysdir_get_str
| * sysdir: remove unused git_sysdir_get_strethomson/sysdir_unusedEdward Thomson2020-04-052-30/+0
| |
* | Merge pull request #5483 from xSetech/masterPatrick Steinhardt2020-04-051-1/+1
|\ \ | |/ |/| Fix typo causing removal of symbol 'git_worktree_prune_init_options'
| * Fix typo causing removal of symbol 'git_worktree_prune_init_options'Seth Junot2020-04-041-1/+1
|/ | | | | | Commit 0b5ba0d replaced this function with an "option_init" equivallent, but misspelled the replacement function. As a result, this symbol has been missing from libgit2.so ever since.
* Merge pull request #5425 from lhchavez/fix-get-delta-basePatrick Steinhardt2020-04-043-26/+44
|\ | | | | pack: Improve error handling for get_delta_base()
| * Re-adding the "delta offset is zero" error caselhchavez2020-04-021-0/+6
| |
| * Making get_delta_base() conform to the general error-handling patternlhchavez2020-04-013-25/+29
| | | | | | | | | | This makes get_delta_base() return the error code as the return value and the delta base as an out-parameter.
| * pack: Improve error handling for get_delta_base()lhchavez2020-04-011-7/+15
| | | | | | | | | | | | | | | | 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.
* | Merge pull request #5480 from libgit2/ethomson/coverityPatrick Steinhardt2020-04-041-2/+2
|\ \ | | | | | | repo::open: ensure we can open the repository
| * | repo::open: ensure we can open the repositoryethomson/coverityEdward Thomson2020-04-031-2/+2
| | | | | | | | | | | | Update the test cases to check the `git_repository_open` return code.
* | | Merge pull request #5421 from petersalomonsen/examples-fixes-and-additionsPatrick Steinhardt2020-04-045-1/+147
|\ \ \ | | | | | | | | examples: additions and fixes
| * | | examples: additions and fixesPeter Salomonsen2020-04-025-1/+147
| | | | | | | | | | | | | | | | | | | | | | | | add example for git commit fix example for git add add example for git push
* | | | Merge pull request #5477 from pks-t/pks/rename-detection-negative-cachesPatrick Steinhardt2020-04-042-7/+97
|\ \ \ \ | |_|/ / |/| | | merge: cache negative cache results for similarity metrics
| * | | merge: cache negative cache results for similarity metricsPatrick Steinhardt2020-04-012-7/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #5388 from bk2204/repo-format-v1Patrick Steinhardt2020-04-022-9/+84
|\ \ \ \ | | | | | | | | | | Handle repository format v1
| * | | | repository: handle format v1brian m. carlson2020-02-112-9/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Git has supported repository format version 1 for some time. This format is just like version 0, but it supports extensions. Implementations must reject extensions that they don't support. Add support for this format version and reject any extensions but extensions.noop, which is the only extension we currently support. While we're at it, also clean up an error message.
* | | | | Merge pull request #5440 from pks-t/pks/cmake-streamliningPatrick Steinhardt2020-04-024-91/+66
|\ \ \ \ \ | | | | | | | | | | | | CMake: backend selection streamlining
| * | | | | cmake: streamline backend detectionPatrick Steinhardt2020-04-014-91/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Merge pull request #5461 from pks-t/pks/refdb-fs-unused-headerEdward Thomson2020-04-012-21/+0
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | refdb_fs: remove unused header file
| * | | | | refdb_fs: remove unused header filePatrick Steinhardt2020-03-252-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Merge pull request #5466 from pks-t/pks/patch-modechange-with-renameEdward Thomson2020-04-014-7/+22
|\ \ \ \ \ \ | | | | | | | | | | | | | | patch: correctly handle mode changes for renames
| * | | | | | patch: correctly handle mode changes for renamesPatrick Steinhardt2020-03-264-7/+22
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Merge pull request #5474 from pks-t/pks/gitignore-cleanupEdward Thomson2020-04-011-30/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | gitignore: clean up patterns from old times
| * | | | | | gitignore: clean up patterns from old timesPatrick Steinhardt2020-03-301-30/+0
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Merge pull request #5478 from pks-t/pks/readme-ci-updateEdward Thomson2020-04-011-1/+1
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | README.md: update build matrix to reflect our latest releases
| * | | | | README.md: update build matrix to reflect our latest releasesPatrick Steinhardt2020-04-011-1/+1
|/ / / / /
* | | | | Merge pull request #5471 from pks-t/pks/v1.0v1.0.0Patrick Steinhardt2020-04-012-4/+55
|\ \ \ \ \ | |_|/ / / |/| | | | Release v1.0
| * | | | version.h: bump version to v1.0.0Patrick Steinhardt2020-03-281-4/+4
| | | | |
| * | | | docs: update changelog for v1.0Patrick Steinhardt2020-03-281-0/+51
|/ / / /
* | | | Merge pull request #5464 from pks-t/pks/refdb-backend-docsPatrick Steinhardt2020-03-261-2/+109
|\ \ \ \ | | | | | | | | | | refdb_backend: improve callback documentation
| * | | | refdb_backend: improve callback documentationPatrick Steinhardt2020-03-261-2/+109
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #5465 from libgit2/ethomson/cred_deprecationPatrick Steinhardt2020-03-261-0/+7
|\ \ \ \ | | | | | | | | | | credentials: provide backcompat for opaque structs
| * | | | credentials: provide backcompat for opaque structsethomson/cred_deprecationEdward Thomson2020-03-261-0/+7
|/ / / / | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #5445 from lhchavez/fix-5443Edward Thomson2020-03-266-2/+32
|\ \ \ \ | | | | | | | | | | Fix segfault when calling git_blame_buffer()
| * | | | Fix segfault when calling git_blame_buffer()lhchavez2020-03-236-2/+32
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Merge pull request #5463 from utkarsh2102/spell-fixPatrick Steinhardt2020-03-261-1/+1
|\ \ \ \ | |/ / / |/| | | Fix spelling error
| * | | Fix spelling errorUtkarsh Gupta2020-03-261-1/+1
|/ / / | | | | | | | | | Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
* | | Merge pull request #5456 from pks-t/pks/refdb-fs-backend-versionEdward Thomson2020-03-231-0/+3
|\ \ \ | | | | | | | | refdb_fs: initialize backend version