summaryrefslogtreecommitdiff
path: root/include/git2/worktree.h
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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.
* worktree: extract git_worktree_is_prunablePatrick Steinhardt2017-02-131-0/+18
|
* worktree: implement functions reading HEADPatrick Steinhardt2017-02-131-1/+1
| | | | | | 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.
* worktree: implement `git_worktree_prune`Patrick Steinhardt2017-02-131-0/+26
| | | | | | | 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.
* worktree: implement locking mechanismsPatrick Steinhardt2017-02-131-0/+36
| | | | | | 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.
* worktree: implement `git_worktree_add`Patrick Steinhardt2017-02-131-0/+15
| | | | | Implement the `git_worktree_add` function which can be used to create new working trees for a given repository.
* worktree: implement `git_worktree_validate`Patrick Steinhardt2017-02-131-0/+12
| | | | | | 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.
* worktree: introduce `struct git_worktree`Patrick Steinhardt2017-02-131-0/+17
| | | | | | | 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.
* worktree: implement `git_worktree_list`Patrick Steinhardt2017-02-131-0/+37
Add new module for working trees with the `git_worktree_list` function. The function lists names for all working trees of a certain repository.