include


Log

Author Commit Date CI Message
Edward Thomson 9d49a43c 2017-06-12T12:01:10 repository_item_path: return ENOTFOUND when appropriate Disambiguate error values: return `GIT_ENOTFOUND` when the item cannot exist in the repository (perhaps because the repository is inmemory or otherwise not backed by a filesystem), return `-1` when there is a hard failure.
Edward Thomson 2a3cc403 2017-06-11T12:23:34 Update version number to v0.26
Patrick Steinhardt 6c23704d 2017-06-08T21:40:18 settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION` Initially, the setting has been solely used to enable the use of `fsync()` when creating objects. Since then, the use has been extended to also cover references and index files. As the option is not yet part of any release, we can still correct this by renaming the option to something more sensible, indicating not only correlation to objects. This commit renames the option to `GIT_OPT_ENABLE_FSYNC_GITDIR`. We also move the variable from the object to repository source code.
Edward Thomson dd0aa811 2017-06-04T22:46:07 Merge branch 'pr/4228'
Edward Thomson f0848dd7 2017-06-04T22:44:30 worktree: upgrade lock to an int
Patrick Steinhardt 883eeb5f 2017-05-02T12:35:59 worktree: switch over worktree pruning to an opts structure The current signature of `git_worktree_prune` accepts a flags field to alter its behavior. This is not as flexible as we'd like it to be when we want to enable passing additional options in the future. As the function has not been part of any release yet, we are still free to alter its current signature. This commit does so by using our usual pattern of an options structure, which is easily extendable without breaking the API.
Patrick Steinhardt 8264a30f 2017-05-02T10:11:28 worktree: support creating locked worktrees When creating a new worktree, we do have a potential race with us creating the worktree and another process trying to delete the same worktree as it is being created. As such, the upstream git project has introduced a flag `git worktree add --locked`, which will cause the newly created worktree to be locked immediately after its creation. This mitigates the race condition. We want to be able to mirror the same behavior. As such, a new flag `locked` is added to the options structure of `git_worktree_add` which allows the user to enable this behavior.
Patrick Steinhardt a7aa73a5 2017-05-02T10:02:36 worktree: introduce git_worktree_add options The `git_worktree_add` function currently accepts only a path and name for the new work tree. As we may want to expand these parameters in future versions without adding additional parameters to the function for every option, this commit introduces our typical pattern of an options struct. Right now, this structure is still empty, which will change with the next commit.
Edward Thomson 13c1bf07 2017-05-01T16:17:48 Merge pull request #4197 from pks-t/pks/verify-object-hashes Verify object hashes
Edward Thomson d8702843 2017-05-01T16:11:56 Merge pull request #4206 from libgit2/cmn/transport-get-proxy transport: provide a getter for the proxy options
Edward Thomson 45071cec 2017-05-01T15:23:27 git_remote_push: document that NULL refspecs allowed
Patrick Steinhardt 35079f50 2017-04-21T07:31:56 odb: add option to turn off hash verification Verifying hashsums of objects we are reading from the ODB may be costly as we have to perform an additional hashsum calculation on the object. Especially when reading large objects, the penalty can be as high as 35%, as can be seen when executing the equivalent of `git cat-file` with and without verification enabled. To mitigate for this, we add a global option for libgit2 which enables the developer to turn off the verification, e.g. when he can be reasonably sure that the objects on disk won't be corrupted.
Patrick Steinhardt 28a0741f 2017-04-10T09:30:08 odb: verify object hashes The upstream git.git project verifies objects when looking them up from disk. This avoids scenarios where objects have somehow become corrupt on disk, e.g. due to hardware failures or bit flips. While our mantra is usually to follow upstream behavior, we do not do so in this case, as we never check hashes of objects we have just read from disk. To fix this, we create a new error class `GIT_EMISMATCH` which denotes that we have looked up an object with a hashsum mismatch. `odb_read_1` will then, after having read the object from its backend, hash the object and compare the resulting hash to the expected hash. If hashes do not match, it will return an error. This obviously introduces another computation of checksums and could potentially impact performance. Note though that we usually perform I/O operations directly before doing this computation, and as such the actual overhead should be drowned out by I/O. Running our test suite seems to confirm this guess. On a Linux system with best-of-five timings, we had 21.592s with the check enabled and 21.590s with the ckeck disabled. Note though that our test suite mostly contains very small blobs only. It is expected that repositories with bigger blobs may notice an increased hit by this check. In addition to a new test, we also had to change the odb::backend::nonrefreshing test suite, which now triggers a hashsum mismatch when looking up the commit "deadbeef...". This is expected, as the fake backend allocated inside of the test will return an empty object for the OID "deadbeef...", which will obviously not hash back to "deadbeef..." again. We can simply adjust the hash to equal the hash of the empty object here to fix this test.
Patrick Steinhardt f4d1592c 2017-04-21T07:09:59 global: fix typo in `git_libgit2_init` description
Carlos Martín Nieto 8d89e409 2017-04-17T17:19:03 Merge pull request #4192 from libgit2/ethomson/win32_posix Refactor some of the win32 POSIX emulation
Carlos Martín Nieto 5c760960 2017-04-17T13:03:03 transport: provide a getter for the proxy options As with the callbacks, third-party implementations of smart subtransports cannot reach into the opaque struct and thus cannot know what options the user set. Add a getter for these options to copy the proxy options into something external implementors can use.
Sven Strickroth d5e6ca1e 2017-01-14T18:39:32 Allow to configure default file share mode for opening files This can prevent FILE_SHARED_VIOLATIONS when used in tools such as TortoiseGit TGitCache and FILE_SHARE_DELETE, because files can be opened w/o being locked any more. Signed-off-by: Sven Strickroth <email@cs-ware.de>
Remy Suen a12796dd 2017-04-02T23:05:48 Correct typos that reference a non-existing file There are references to odb_backends.h when the file is actually named odb_backend.h and in the sys folder.
Edward Thomson cc8d9a29 2017-04-01T10:44:17 win32: introduce `do_with_retries` macro Provide a macro that will allow us to run a function with posix-like return values multiple times in a retry loop, with an optional cleanup function called between invocations.
Edward Thomson f623cf89 2017-03-22T20:32:55 Merge pull request #4163 from pks-t/pks/submodules-with-worktrees Worktree fixes
Edward Thomson 6fd6c678 2017-03-22T20:29:22 Merge pull request #4030 from libgit2/ethomson/fsync fsync all the things
Remy Suen 84b4e573 2017-03-22T06:08:24 Use proper documentation tags git_cred_acquire_cb isn't using the standard @param and @return tags. This is causing the generated documentation to not be formatted properly.
Remy Suen 12b7394c 2017-03-20T22:30:37 Fix typo in remote.h API
Patrick Steinhardt 3017ba94 2017-03-15T14:24:25 worktree: implement `git_worktree_open_from_repository` While we already provide functionality to look up a worktree from a repository, we cannot do so the other way round. That is given a repository, we want to look up its worktree if it actually exists. Getting the worktree of a repository is useful when we want to get certain meta information like the parent's location, getting the locked status, etc.
Patrick Steinhardt bb342159 2017-03-15T11:46:15 merge_driver: fix const-correctness for source getters
Edward Thomson 2dfd1294 2017-02-24T13:34:01 hash: include sha1collisiondetection Include the SHA1 collision attack detection library from https://github.com/cr-marcstevens/sha1collisiondetection
Edward Thomson 2a5ad7d0 2017-02-17T16:42:40 fsync: call it "synchronous" object writing Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` -> `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.
Edward Thomson 6d3ad7e0 2016-12-13T10:58:43 Add `ENABLE_SYNCHRONIZED_OBJECT_CREATION` option Allow users to enable `SYNCHRONIZED_OBJECT_CREATION` with a setting.
Edward Thomson fc27fe21 2016-12-13T10:35:05 odb_loose: actually honor the fsync option We've had an fsync option for a long time, but it was "ignored". Stop ignoring it.
David Catmull 19874e29 2017-02-16T08:40:49 Minor comment fix
Edward Thomson a59545de 2017-02-13T14:38:12 Merge pull request #4122 from pks-t/pks/signature-dbl-free Signature cleanups
Patrick Steinhardt dc851d9e 2017-02-13T13:42:16 commit: clear user-provided buffers The functions `git_commit_header_field` and `git_commit_extract_signature` both receive buffers used to hand back the results to the user. While these functions called `git_buf_sanitize` on these buffers, this is not the right thing to do, as it will simply initialize or zero-terminate passed buffers. As we want to overwrite contents, we instead have to call `git_buf_clear` to completely reset them.
Edward Thomson c576d4ff 2017-02-13T12:46:00 Merge pull request #4115 from gsaralms/users/gsaral/optionalOfsDelta Changes to provide option to turn off/on ofs_delta
Patrick Steinhardt 1ba242c9 2017-02-03T13:52:23 worktree: extract git_worktree_is_prunable
Patrick Steinhardt e3acd37b 2015-11-06T12:08:15 branch: implement `git_branch_is_checked_out` Implement a new function that is able to determine if a branch is checked out in any repository connected to the current repository. In particular, this is required to check if for a given repository and branch, there exists any working tree connected to that repository that is referencing this branch.
Patrick Steinhardt 04fb12ab 2015-10-27T12:37:51 worktree: implement functions reading HEAD Implement `git_repository_head_for_worktree` and `git_repository_head_detached_for_worktree` for directly accessing a worktree's HEAD without opening it as a `git_repository` first.
Patrick Steinhardt f0cfc341 2015-10-21T13:53:18 worktree: implement `git_worktree_prune` Implement the `git_worktree_prune` function. This function can be used to delete working trees from a repository. According to the flags passed to it, it can either delete the working tree's gitdir only or both gitdir and the working directory.
Patrick Steinhardt 2a503485 2015-10-21T16:03:04 worktree: implement locking mechanisms Working trees support locking by creating a file `locked` inside the tree's gitdir with an optional reason inside. Support this feature by adding functions to get and set the locking status.
Patrick Steinhardt dea7488e 2015-10-23T14:11:44 worktree: implement `git_worktree_add` Implement the `git_worktree_add` function which can be used to create new working trees for a given repository.
Patrick Steinhardt 372dc9ff 2015-10-21T13:49:55 worktree: implement `git_worktree_validate` Add a new function that checks wether a given `struct git_worktree` is valid. The validation includes checking if the gitdir, parent directory and common directory are present.
Patrick Steinhardt 8c8d726e 2015-10-21T12:10:30 worktree: implement `git_repository_open_from_worktree` Add function `git_repository_open_from_worktree`, which allows to open a `git_worktree` as repository.
Patrick Steinhardt d3bc09e8 2015-10-21T12:02:31 worktree: introduce `struct git_worktree` Introduce a new `struct git_worktree`, which holds information about a possible working tree connected to a repository. Introduce functions to allow opening working trees for a repository.
Patrick Steinhardt 45f2b7a4 2015-10-21T11:48:02 worktree: implement `git_worktree_list` Add new module for working trees with the `git_worktree_list` function. The function lists names for all working trees of a certain repository.
Patrick Steinhardt 79ab3ef6 2015-10-15T15:58:05 repository: introduce is_worktree variable
Patrick Steinhardt cb3269c9 2016-11-11T13:46:59 repository: add function to retrieve paths for repo items
Patrick Steinhardt c09fd54e 2015-09-16T12:10:11 repository: introduce commondir variable The commondir variable stores the path to the common directory. The common directory is used to store objects and references shared across multiple repositories. A current use case is the newly introduced `git worktree` feature, which sets up a separate working copy, where the backing git object store and references are pointed to by the common directory.
Gaurav Saral 61acc9fa 2017-02-08T16:22:44 Changes to provide option to turn off/on ofs_delta This change provides an option in git_libgit2_opt_t which can be used in git_libgit2_opts to turn off/on ofs_delta capability in libGit2
Remy Suen 93e2c744 2017-02-09T19:12:31 Flag optional parameters for apply and pop The options parameter in both git_stash_apply and git_stash_pop can be NULL. They should be flagged as such in the documentation.
Remy Suen 3a133652 2017-02-05T07:12:32 Flag checkout_opts in git_reset as optional The check_outs argument can be NULL and should be flagged accordingly in the header file.
Remy Suen 21d4a378 2017-02-04T17:24:31 Flag given_opts in git_revert as optional The given_opts argument can actually be NULL and thus should be flagged accordingly in the header file.
Matthew Plough 921493cc 2017-01-27T14:37:16 Update docs for git_oid_fromstrn and p
Etienne Samson 7414acf5 2017-01-23T12:28:02 parameter 'id' not found in the function declaration
Edward Thomson 8d3b39a6 2017-01-21T23:50:38 Merge branch 'pr/3912'
Edward Thomson 28d0ba0b 2017-01-21T23:45:23 symbolic ref target validation: fixups Fixups requested in #3912.
Edward Thomson 44e8af8f 2017-01-21T22:51:50 Merge pull request #3892 from mitesch/shared_buffer Use a shared buffer in calls of git_treebuilder_write to avoid heap contention
Edward Thomson 9e78b727 2017-01-21T22:39:59 Merge branch 'master' into pr/3938
Brock Peabody 4d99c4cf 2016-11-23T18:32:48 Allow for caching of submodules. Added `git_repository_submodule_cache_all` to initialze a cache of submodules on the repository so that operations looking up N submodules are O(N) and not O(N^2). Added a `git_repository_submodule_cache_clear` function to remove the cache. Also optimized the function that loads all submodules as it was itself O(N^2) w.r.t the number of submodules, having to loop through the `.gitmodules` file once per submodule. I changed it to process the `.gitmodules` file once, into a map. Signed-off-by: David Turner <dturner@twosigma.com>
Edward Thomson a5cf255b 2017-01-06T17:15:53 Bump version to 0.25.1
Edward Thomson 19ed4d0c 2017-01-01T22:19:23 merge: set default rename threshold When `GIT_MERGE_FIND_RENAMES` is set, provide a default for `rename_threshold` when it is unset.
Carlos Martín Nieto 75db289a 2016-12-20T19:14:20 Merge pull request #3980 from tiennou/doc-fixes Documentation fixes
Carlos Martín Nieto 77e46232 2016-12-17T14:31:36 settings: clarify what each value means Most importantly, clarify what it means for HTTPS and SSH to be supported.
Michael Tesch 87aaefe2 2016-08-09T12:23:19 write_tree: use shared buffer for writing trees The function to write trees allocates a new buffer for each tree. This causes problems with performance when performing a lot of actions involving writing trees, e.g. when doing many merges. Fix the issue by instead handing in a shared buffer, which is then re-used across the calls without having to re-allocate between calls.
Josh Bleecher Snyder 72cee168 2016-12-02T16:14:47 remote: fix typo in git_fetch_init_options docs
Carlos Martín Nieto 5569778a 2016-11-15T11:15:40 Bump version number to v0.25
Etienne Samson 8d400c09 2016-11-01T17:49:07 transaction: fix documentation
Etienne Samson 788fcdb8 2016-11-01T17:46:57 remote: fix documentation and indent
Etienne Samson 2adac910 2016-11-01T17:46:37 remote: unused function typedef
Etienne Samson 8d2784d5 2016-11-01T17:46:20 describe: fix documentation
Patrick Steinhardt 6502398f 2016-11-01T16:55:16 proxy: fix typo in documentation
Davide Coppola 6d8ecf08 2016-10-16T00:43:27 patch: minor documentation fix. Fix @return description of git_patch_num_lines_in_hunk.
Josh Leeb-du Toit 3e22bb71 2016-09-28T14:45:18 Update submodule update opts init as per code review Update the `GIT_SUBMODULE_UPDATE_OPTIONS_INIT` definition with the correct values after removing `clone_checkout_strategy` in `git_submodule_update_options`.
Josh Leeb-du Toit 567fd782 2016-09-26T19:32:15 Remove `clone_checkout_strategy` in submodule update opts Remove `clone_checkout_strategy` in `git_submodule_update_options` as per issue #3784.
Edward Thomson 93392cdd 2016-10-09T11:27:56 docs: GIT_OPT_ENABLE_STRICT_OBJECT_CREATION is enabled We changed the defaults on strict object creation - it is enabled by default. Update the documentation to reflect that.
Carlos Martín Nieto 82d4c0e6 2016-10-05T12:55:53 revwalk: update the description for the default sorting It changed from implementation-defined to git's default sorting, as there are systems (e.g. rebase) which depend on this order. Also specify more explicitly how you can get git's "date-order".
Vicent Marti 2749ff46 2016-09-13T15:52:43 time: Export `git_time_monotonic`
Edward Thomson adedac5a 2016-09-02T02:03:45 diff: treat binary patches with no data special When creating and printing diffs, deal with binary deltas that have binary data specially, versus diffs that have a binary file but lack the actual binary data.
Richard Ipsum 452bf57c 2016-08-27T13:42:53 Make symbolic ref target validation optional Introduce GIT_OPT_ENABLE_SYMBOLIC_REF_TARGET_VALIDATION option. Setting this option to 0 allows validation of a symbolic ref's target to be bypassed. This option is enabled by default. This mechanism is added primarily to address a discrepancy between git behaviour and libgit2 behaviour, whereby the former allows the symbolic ref target to carry an arbitrary string and the latter does not, so: $ git symbolic-ref refs/heads/foo bar $ cat .git/refs/heads/foo ref: bar where as attempting the same via libgit2 raises an error: The given reference name 'bar' is not valid this mechanism also allows those that might want to make use of git's more lenient treatment of symbolic ref targets to do so.
David Turner 5625d86b 2016-05-17T15:40:32 index: support index v4 Support reading and writing index v4. Index v4 uses a very simple compression scheme for pathnames, but is otherwise similar to index v3. Signed-off-by: David Turner <dturner@twitter.com>
Edward Thomson e2e7f31a 2016-08-05T20:00:22 diff: document `git_diff_from_buffer`
Edward Thomson 8f09a98e 2016-07-14T16:23:24 odb: freshen existing objects when writing When writing an object, we calculate its OID and see if it exists in the object database. If it does, we need to freshen the file that contains it.
Edward Thomson 002c8e29 2016-08-03T17:09:41 git_diff_file: move `id_abbrev` Move `id_abbrev` to a more reasonable place where it packs more nicely (before anybody starts using it).
Edward Thomson 60e15ecd 2016-07-15T17:18:39 packbuilder: `size_t` all the things After 1cd65991, we were passing a pointer to an `unsigned long` to a function that now expected a pointer to a `size_t`. These types differ on 64-bit Windows, which means that we trash the stack. Use `size_t`s in the packbuilder to avoid this.
Andrius Bentkus f1dba144 2016-07-05T09:41:51 Add get user agent functionality.
Edward Thomson ebeb56f0 2016-07-01T18:45:10 Merge pull request #3711 from joshtriplett/git_repository_discover_default Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars
Jason Haslam de43efcf 2016-06-28T16:07:25 submodule: Try to fetch when update fails to find the target commit in the submodule.
Edward Thomson 20302aa4 2016-06-25T23:33:05 Merge pull request #3223 from ethomson/apply Reading patch files
Josh Triplett 0dd98b69 2016-04-03T17:22:07 Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars git_repository_open_ext provides parameters for the start path, whether to search across filesystems, and what ceiling directories to stop at. git commands have standard environment variables and defaults for each of those, as well as various other parameters of the repository. To avoid duplicate environment variable handling in users of libgit2, add a GIT_REPOSITORY_OPEN_FROM_ENV flag, which makes git_repository_open_ext automatically handle the appropriate environment variables. Commands that intend to act just like those built into git itself can use this flag to get the expected default behavior. git_repository_open_ext with the GIT_REPOSITORY_OPEN_FROM_ENV flag respects $GIT_DIR, $GIT_DISCOVERY_ACROSS_FILESYSTEM, $GIT_CEILING_DIRECTORIES, $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and $GIT_ALTERNATE_OBJECT_DIRECTORIES. In the future, when libgit2 gets worktree support, git_repository_open_env will also respect $GIT_WORK_TREE and $GIT_COMMON_DIR; until then, git_repository_open_ext with this flag will error out if either $GIT_WORK_TREE or $GIT_COMMON_DIR is set.
Josh Triplett 39c6fca3 2016-04-03T16:01:01 Add GIT_REPOSITORY_OPEN_NO_DOTGIT flag to avoid appending /.git GIT_REPOSITORY_OPEN_NO_SEARCH does not search up through parent directories, but still tries the specified path both directly and with /.git appended. GIT_REPOSITORY_OPEN_BARE avoids appending /.git, but opens the repository in bare mode even if it has a working directory. To support the semantics git uses when given $GIT_DIR in the environment, provide a new GIT_REPOSITORY_OPEN_NO_DOTGIT flag to not try appending /.git.
Edward Thomson b9266488 2016-06-14T12:27:03 documentation: improve docs for `checkout_head` `git_checkout_head` is sadly misunderstood as something that can switch branches. It cannot. Update the documentation to reflect this.
Edward Thomson 72827490 2016-04-25T12:40:19 Introduce `git_diff_to_buf` Like `git_patch_to_buf`, provide a simple helper method that can print an entire diff directory to a `git_buf`.
Edward Thomson 7166bb16 2016-04-25T00:35:48 introduce `git_diff_from_buffer` to parse diffs Parse diff files into a `git_diff` structure.
Edward Thomson 440e3bae 2015-11-21T12:27:03 patch: `git_patch_from_patchfile` -> `git_patch_from_buffer`
Edward Thomson 82175084 2015-09-23T13:40:12 Introduce git_patch_options, handle prefixes Handle prefixes (in terms of number of path components) for patch parsing.
Edward Thomson d68cb736 2015-09-22T18:25:03 diff: include oid length in deltas Now that `git_diff_delta` data can be produced by reading patch file data, which may have an abbreviated oid, allow consumers to know that the id is abbreviated.
Edward Thomson d34f6826 2014-04-08T17:18:47 Patch parsing from patch files
Edward Thomson 7cb904ba 2014-04-01T23:58:59 Introduce git_apply_patch The beginnings of patch application from an existing (diff-created) git_patch object: applies the hunks of a git_patch to a buffer.
Carlos Martín Nieto 9464f9eb 2016-05-02T17:36:58 Introduce a function to create a tree based on a different one Instead of going through the usual steps of reading a tree recursively into an index, modifying it and writing it back out as a tree, introduce a function to perform simple updates more efficiently. `git_tree_create_updated` avoids reading trees which are not modified and supports upsert and delete operations. It is not as versatile as modifying the index, but it makes some common operations much more efficient.
Edward Thomson d383c39b 2016-04-28T12:47:14 Introduce `git_signature_from_buffer` Allow users to construct a signature from the type of signature lines that actually appear in commits.
Arthur Schreiber a3e379cb 2016-04-26T11:10:31 Remove traces of `git_blob_create_fromchunks`
Arthur Schreiber 908f24fd 2016-04-22T10:34:17 Allow creating copies of `git_reference` objects.