summaryrefslogtreecommitdiff
path: root/include/git2
Commit message (Collapse)AuthorAgeFilesLines
* docs: git_treebuilder_insert validates entriesethomson/treebuilder_docsEdward Thomson2017-12-311-3/+4
| | | | | | | The documentation for `git_treebuilder_insert` erroneously states that we do not validate that the entry being inserted exists. We do, as of https://github.com/libgit2/libgit2/pull/3633. Update the documentation to reflect the new reality.
* Merge pull request #4159 from richardipsum/notes-commitEdward Thomson2017-12-301-0/+89
|\ | | | | Support using notes via a commit rather than a ref
| * notes: Add git_note_commit_iterator_newRichard Ipsum2017-10-071-0/+14
| | | | | | | | This also adds tests for this function.
| * notes: Add git_note_commit_removeRichard Ipsum2017-10-071-0/+26
| | | | | | | | This also adds tests for this function.
| * notes: Add git_note_commit_readRichard Ipsum2017-10-071-0/+19
| | | | | | | | This also adds tests for this function.
| * notes: Add git_note_commit_createRichard Ipsum2017-10-071-0/+30
| | | | | | | | | | | | | | | | | | | | This adds a new function that will allow creation of notes without necessarily updating a particular ref, the notes tree is obtained from the git_commit object parameter, a new commit object pointing to the current tip of the notes tree is optionally returned via the 'note_commit_out' parameter, optionally the blob id for the note is returned through the 'note_blob_out' object.
* | Merge pull request #4318 from Uncommon/amend_statusEdward Thomson2017-12-011-0/+4
|\ \ | | | | | | Add git_status_file_at
| * | status: Add a baseline field to git_status_options for comparing to trees ↵David Catmull2017-11-301-0/+4
| | | | | | | | | | | | other than HEAD
* | | diff: expose the "indent heuristic" in the diff optionsCarlos Martín Nieto2017-11-191-0/+6
| | | | | | | | | | | | | | | We default to off, but we might want to consider changing `GIT_DIFF_NORMAL` to include it.
* | | signature: distinguish +0000 and -0000 UTC offsetsHenry Kleynhans2017-11-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Git considers '-0000' a valid offset for signature lines. They need to be treated as _not_ equal to a '+0000' signature offset. Parsing a signature line stores the offset in a signed integer which does not distinguish between `+0` and `-0`. This patch adds an additional flag `sign` to the `git_time` in the `signature` object which is populated with the sign of the offset. In addition to exposing this information to the user, this information is also used to compare signatures. /cc @pks-t @ethomson
* | | describe.h: fix spelling in commentsKen Dreyer2017-11-101-1/+1
| | | | | | | | | | | | optios -> options
* | | config: pass repository when opening config filesPatrick Steinhardt2017-10-092-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our current configuration logic is completely oblivious of any repository, but only cares for actual file paths. Unfortunately, we are forced to break this assumption by the introduction of conditional includes, which are evaluated in the context of a repository. Right now, only one conditional exists with "gitdir:" -- it will only include the configuration if the current repository's git directory matches the value passed to "gitdir:". To support these conditionals, we have to break our API and make the repository available when opening a configuration file. This commit extends the `open` call of configuration backends to include another repository and adjusts existing code to have it available. This includes the user-visible functions `git_config_add_file_ondisk` and `git_config_add_backend`.
* | | repository: constify several repo parameters for gettersPatrick Steinhardt2017-10-091-6/+6
|/ / | | | | | | | | | | | | Several functions to retrieve variables from a repository only return immutable values, which allows us to actually constify the passed-in repository parameter. Do so to help a later patch, which will only have access to a constant repository.
* | remote: add typedef to normalize push_update_reference callbackCarson Howard2017-10-061-4/+16
| | | | | | Very many callbacks in libgit2 have some sort of typedef to normalize the name at git_<name_of_operation>_cb. Add a typedef for push_update_references in the remote so the name follows the same conventions.
* | graph: document that a commit isn't a descendant of itselfJacob Wahlgren2017-10-061-0/+3
| |
* | Docs: Fix inline comments for git_diff_hunkAlpha2017-08-111-6/+6
| |
* | Merge pull request #4304 from pks-t/pks/patch-buffersEdward Thomson2017-07-311-2/+2
|\ \ | | | | | | patch_generate: represent buffers as void pointers
| * | patch_generate: represent buffers as void pointersPatrick Steinhardt2017-07-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pointers to general data should usually be used as a void pointer such that it is possible to hand in variables of a different pointer type without the need to cast. This is the same when creating patches from buffers, where the buffers may contain arbitrary data. Instead of requiring the caller to care whether his buffer is e.g. `char *` or `unsigned char *`, we should instead just accept a `void *`. This is also consistent in how we tread other types like for example `git_blob`, which also just has a void pointer as its raw contents.
* | | Merge pull request #4323 from libgit2/ethomson/remove_sys_remote_hEdward Thomson2017-07-311-16/+0
|\ \ \ | | | | | | | | Remove unused 'sys/remote.h' header
| * | | Remove unused 'sys/remote.h' headerethomson/remove_sys_remote_hEdward Thomson2017-07-311-16/+0
| | | |
* | | | Merge branch '4233'Edward Thomson2017-07-311-0/+18
|\ \ \ \ | |/ / / |/| | |
| * | | remote: add function to create detached remotesEric Myhre2017-05-051-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now it is only possible to create remotes from a repository. While this is probably the most common use-case, there are commands which make sense even without a repository, e.g. the equivalence of `git ls-remote`. Add a new function `git_remote_create_detached`, which simply accepts a URL.
* | | | Merge pull request #4272 from pks-t/pks/patch-idEdward Thomson2017-07-191-0/+45
|\ \ \ \ | | | | | | | | | | Patch ID calculation
| * | | | diff: implement function to calculate patch IDPatrick Steinhardt2017-06-261-0/+45
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upstream git project provides the ability to calculate a so-called patch ID. Quoting from git-patch-id(1): A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated with a patch, with whitespace and line numbers ignored." Patch IDs can be used to identify two patches which are probably the same thing, e.g. when a patch has been cherry-picked to another branch. This commit implements a new function `git_diff_patchid`, which gets a patch and derives an OID from the diff. Note the different terminology here: a patch in libgit2 are the differences in a single file and a diff can contain multiple patches for different files. The implementation matches the upstream implementation and should derive the same OID for the same diff. In fact, some code has been directly derived from the upstream implementation. The upstream implementation has two different modes to calculate patch IDs, which is the stable and unstable mode. The old way of calculating the patch IDs was unstable in a sense that a different ordering the diffs was leading to different results. This oversight was fixed in git 1.9, but as git tries hard to never break existing workflows, the old and unstable way is still default. The newer and stable way does not care for ordering of the diff hunks, and in fact it is the mode that should probably be used today. So right now, we only implement the stable way of generating the patch ID.
* | | | git_reset_*: pass parameters as const pointersAndrey Davydov2017-06-301-4/+4
|/ / /
* | | Adding git_filter_init for initializing `git_filter` struct + unit test Mohseen Mukaddam2017-06-131-0/+11
| | |
* | | adding GIT_FILTER_VERSION to GIT_FILTER_INIT as part of conventionMohseen Mukaddam2017-06-131-1/+1
| | |
* | | repository_item_path: return ENOTFOUND when appropriateEdward Thomson2017-06-121-2/+2
| | | | | | | | | | | | | | | | | | | | | 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.
* | | Update version number to v0.26ethomson/bump-v26Edward Thomson2017-06-111-3/+3
| | |
* | | settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`Patrick Steinhardt2017-06-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'pr/4228'Edward Thomson2017-06-041-10/+57
|\ \ \ | |/ / |/| |
| * | worktree: upgrade lock to an intEdward Thomson2017-06-041-1/+1
| | |
| * | worktree: switch over worktree pruning to an opts structurePatrick Steinhardt2017-05-051-9/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | worktree: support creating locked worktreesPatrick Steinhardt2017-05-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | worktree: introduce git_worktree_add optionsPatrick Steinhardt2017-05-021-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #4197 from pks-t/pks/verify-object-hashesEdward Thomson2017-05-012-0/+9
|\ \ \ | | | | | | | | Verify object hashes
| * | | odb: add option to turn off hash verificationPatrick Steinhardt2017-04-281-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | odb: verify object hashesPatrick Steinhardt2017-04-281-0/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #4206 from libgit2/cmn/transport-get-proxyEdward Thomson2017-05-011-0/+10
|\ \ \ | | | | | | | | transport: provide a getter for the proxy options
| * | | transport: provide a getter for the proxy optionscmn/transport-get-proxyCarlos Martín Nieto2017-04-171-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | git_remote_push: document that NULL refspecs allowedEdward Thomson2017-05-011-2/+2
| |/ / |/| |
* | | global: fix typo in `git_libgit2_init` descriptionPatrick Steinhardt2017-04-211-1/+1
| | |
* | | Merge pull request #4192 from libgit2/ethomson/win32_posixCarlos Martín Nieto2017-04-172-0/+14
|\ \ \ | |/ / |/| | Refactor some of the win32 POSIX emulation
| * | Allow to configure default file share mode for opening filesSven Strickroth2017-04-031-0/+13
| | | | | | | | | | | | | | | | | | 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>
| * | win32: introduce `do_with_retries` macroEdward Thomson2017-04-011-0/+1
| | | | | | | | | | | | | | | | | | 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.
* | | Correct typos that reference a non-existing fileRemy Suen2017-04-031-2/+2
|/ / | | | | | | | | There are references to odb_backends.h when the file is actually named odb_backend.h and in the sys folder.
* | Merge pull request #4163 from pks-t/pks/submodules-with-worktreesEdward Thomson2017-03-221-0/+12
|\ \ | | | | | | Worktree fixes
| * | worktree: implement `git_worktree_open_from_repository`Patrick Steinhardt2017-03-171-0/+12
| |/ | | | | | | | | | | | | | | | | 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.
* | Merge pull request #4030 from libgit2/ethomson/fsyncEdward Thomson2017-03-222-1/+9
|\ \ | | | | | | fsync all the things
| * | fsync: call it "synchronous" object writingEdward Thomson2017-02-281-2/+2
| | | | | | | | | | | | | | | Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` -> `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.