|
c8fe4da3
|
2020-11-21T22:06:03
|
|
Apply suggestions from code review
|
|
303b4c68
|
2020-11-07T16:30:44
|
|
worktree: change test to invalidate worktree via filesystem
|
|
848c7793
|
2020-11-06T11:32:13
|
|
worktree: Demonstrate missing worktree check
worktree_dir isn't validated when it should be
|
|
ce4cb073
|
2020-07-12T18:19:21
|
|
tests: verify renaming branch really updates worktree HEAD
In case where a branch is getting renamed, all HEADs of the main
repository and of its worktrees that point to the old branch need to get
updated to point to the new branch. We already do so and have a test for
this, but the test only verifies that we're able to lookup the updated
HEAD, not what it contains.
Let's make the test more specific by verifying the updated HEAD also has
the correct updated symbolic target.
|
|
65895410
|
2020-06-17T14:56:36
|
|
repository: retrieve worktree HEAD via refdb
The function `git_repository_head_for_worktree` currently uses
`git_reference__read_head` to directly read a given worktree's HEAD from
the filesystem. This is broken in case the repository uses a different
refdb implementation than the filesystem-based one, so let's instead
open the worktree as a real repository and use `git_reference_lookup`.
This also fixes the case where the worktree's HEAD is not a symref, but
a detached HEAD, which would have resulted in an error previously.
|
|
d1f210fc
|
2020-06-17T15:09:49
|
|
repository: remove function to iterate over HEADs
The function `git_repository_foreach_head` is broken, as it directly
interacts with the on-disk representation of the reference database,
thus assuming that no other refdb is used for the given repository. As
this is an internal function only and all users have been replaced,
let's remove this function.
|
|
2fcb4f28
|
2020-06-17T14:09:04
|
|
repository: introduce new function to iterate over all worktrees
Given a Git repository, it's non-trivial to iterate over all worktrees
that are associated with it, including the "main" repository. This
commit adds a new internal function `git_repository_foreach_worktree`
that does this for us.
|
|
51eff5a5
|
2020-05-29T13:13:19
|
|
strarray: we should `dispose` instead of `free`
We _dispose_ the contents of objects; we _free_ objects (and their
contents). Update `git_strarray_free` to be `git_strarray_dispose`.
`git_strarray_free` remains as a deprecated proxy function.
|
|
b26e51e0
|
2019-05-20T05:37:44
|
|
worktree: use size_t in tests
|
|
efb20825
|
2019-02-14T13:05:49
|
|
branches: introduce flag to skip enumeration of certain HEADs
Right now, the function `git_repository_foreach_head` will always
iterate over all HEADs of the main repository and its worktrees. In some
cases, it might be required to skip either of those, though. Add a flag
in preparation for the following commit that enables this behaviour.
|
|
59c2e70e
|
2018-08-17T00:51:51
|
|
worktree: unlock should return 1 when the worktree isn't locked
The documentation states that git_worktree_unlock returns 0 on success,
and 1 on success if the worktree wasn't locked. Turns out we were
returning 0 in any of those cases.
|
|
9994cd3f
|
2018-06-25T11:56:52
|
|
treewide: remove use of C++ style comments
C++ style comment ("//") are not specified by the ISO C90 standard and
thus do not conform to it. While libgit2 aims to conform to C90, we did
not enforce it until now, which is why quite a lot of these
non-conforming comments have snuck into our codebase. Do a tree-wide
conversion of all C++ style comments to the supported C style comments
to allow us enforcing strict C90 compliance in a later commit.
|
|
8356bf7e
|
2018-06-29T14:39:14
|
|
tests: worktree/bare: test some paths
|
|
d0921127
|
2018-06-29T14:39:13
|
|
tests: add a helper to build sandbox subpaths quickly
|
|
83c35f7e
|
2018-06-29T14:39:11
|
|
tests: worktree/bare: fix git_worktree_validate
|
|
bd40f0d7
|
2018-06-29T14:39:10
|
|
tests: worktree/bare: check git_worktree_list
|
|
7e3c13e0
|
2018-06-29T14:39:08
|
|
tests: worktree/bare: gather all tests
|
|
ecf4f33a
|
2018-02-08T11:14:48
|
|
Convert usage of `git_buf_free` to new `git_buf_dispose`
|
|
a82082d0
|
2018-04-20T08:38:50
|
|
worktree: a worktree can be made from a bare repository
|
|
b33b6d33
|
2018-04-30T09:27:47
|
|
Merge pull request #4640 from mkeeler/worktree-convenience2
worktree: add functions to get name and path
|
|
5ace1494
|
2018-04-26T11:45:38
|
|
Merge pull request #4633 from csware/worktree-delereref
Fix deletion of unrelated branch on worktree
|
|
3da1ad20
|
2018-04-24T17:09:34
|
|
worktree: add functions to get name and path
|
|
0ad2372b
|
2018-04-20T21:25:01
|
|
Merge pull request #4636 from tiennou/fix/leaks
Fix leaks in master
|
|
8d138f89
|
2018-04-20T20:28:48
|
|
Merge pull request #4577 from csware/reflog-worktree-head
worktree: Read worktree specific reflog for HEAD
|
|
25100d6d
|
2018-04-19T19:17:07
|
|
tests: free the worktree in add_with_explicit_branch
Valgrind log:
==2711== 305 (48 direct, 257 indirect) bytes in 1 blocks are definitely lost in loss record 576 of 624
==2711== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2711== by 0x5E079E: git__calloc (util.h:99)
==2711== by 0x5E0D21: open_worktree_dir (worktree.c:134)
==2711== by 0x5E0F23: git_worktree_lookup (worktree.c:176)
==2711== by 0x5E1972: git_worktree_add (worktree.c:388)
==2711== by 0x551F23: test_worktree_worktree__add_with_explicit_branch (worktree.c:292)
==2711== by 0x45853E: clar_run_test (clar.c:222)
==2711== by 0x4587E1: clar_run_suite (clar.c:286)
==2711== by 0x458B04: clar_parse_args (clar.c:362)
==2711== by 0x458CAB: clar_test_run (clar.c:428)
==2711== by 0x45665C: main (main.c:24)
|
|
fd7b5bc3
|
2018-04-20T12:54:41
|
|
Fix deletion of unrelated branch on worktree
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
8529ac9b
|
2018-04-17T23:38:46
|
|
Merge pull request #4524 from pks-t/pks/worktree-refs
worktree: add ability to create worktree with pre-existing branch
|
|
2dc54855
|
2018-04-10T23:49:44
|
|
tests: ensure worktrees' head have owners too
|
|
eb0a3afd
|
2018-03-11T15:35:56
|
|
worktree: Read worktree specific reflog for HEAD
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
a22f19e6
|
2018-02-09T10:38:11
|
|
worktree: add ability to create worktree with pre-existing branch
Currently, we always create a new branch after the new worktree's name
when creating a worktree. In some workflows, though, the caller may want
to check out an already existing reference instead of creating a new
one, which is impossible to do right now.
Add a new option `ref` to the options structure for adding worktrees. In
case it is set, a branch and not already checked out by another
worktree, we will re-use this reference instead of creating a new one.
|
|
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.
|
|
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.
|
|
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.
|
|
2a485dab
|
2017-04-04T18:55:57
|
|
refs: update worktree HEADs when renaming branches
Whenever we rename a branch, we update the repository's symbolic HEAD
reference if it currently points to the branch that is to be renamed.
But with the introduction of worktrees, we also have to iterate over all
HEADs of linked worktrees to adjust them. Do so.
|
|
60297256
|
2017-04-04T16:12:27
|
|
tests: worktree::refs: convert spaces to tabs
|
|
b0c9bc92
|
2017-03-15T13:38:54
|
|
submodule: resolve URLs relative to main worktree
It is possible to specify submodule URLs relative to the repository
location. E.g. having a submodule with URL "../submodule" will look for
the submodule at "repo/../submodule".
With the introduction of worktrees, though, we cannot simply resolve the
URL relative to the repository location itself. If the repository for
which a URL is to be resolved is a working tree, we have to resolve the
URL relative to the parent's repository path. Otherwise, the URL would
change depending on where the working tree is located.
Fix this by special-casing when we have a working tree while getting the
URL base.
|
|
097f0105
|
2017-03-17T08:54:53
|
|
refdb: create references in commondir
References for a repository are usually created inside of its gitdir.
When using worktrees, though, these references are not to be created
inside the worktree gitdir, but instead inside the gitdir of its parent
repository, which is the commondir. Like this, branches will still be
available after the worktree itself has been deleted.
The filesystem refdb currently still creates new references inside of
the gitdir. Fix this and have it create references in commondir.
|
|
8f154be3
|
2017-03-17T08:13:59
|
|
worktree: write resolved paths into link files
The three link files "worktree/.git", ".git/worktrees/<name>/commondir"
and ".git/worktrees/<name>/gitdir" should always contain absolute and
resolved paths. Adjust the logic creating new worktrees to first use
`git_path_prettify_dir` before writing out these files, so that paths
are resolved first.
|
|
20a368e2
|
2017-03-15T15:29:29
|
|
worktree: parent path should point to the working dir
The working tree's parent path should not point to the parent's gitdir,
but to the parent's working directory. Pointing to the gitdir would not
make any sense, as the parent's working directory is actually equal to
both repository's common directory.
Fix the issue.
|
|
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.
|
|
f3c30686
|
2017-03-15T15:04:24
|
|
tests: worktree: use joinpath instead of printf to join paths
|
|
fdb3e24a
|
2017-03-15T14:23:59
|
|
tests: worktree: unify init/cleanup in open tests
|
|
548e5bdf
|
2017-03-15T12:28:05
|
|
tests: worktree: unify init/cleanup in submodule tests
|
|
aa593a65
|
2017-03-15T12:01:02
|
|
tests: worktree: move submodule tests into own suite
|
|
3f3a4ce7
|
2016-11-09T14:18:22
|
|
worktree: test opening worktree via gitlink, gitdir and worktree
|
|
6f6dd17c
|
2016-11-08T12:13:59
|
|
worktree: test creating and opening submodule worktrees
|
|
1fd6e035
|
2016-11-07T10:23:34
|
|
worktree: test opening discovered submodule worktrees
|
|
39abd3ad
|
2016-11-04T13:39:54
|
|
worktree: compute workdir for worktrees opened via their gitdir
When opening a worktree via the gitdir of its parent repository
we fail to correctly set up the worktree's working directory. The
problem here is two-fold: we first fail to see that the gitdir
actually is a gitdir of a working tree and then subsequently
fail to determine the working tree location from the gitdir.
The first problem of not noticing a gitdir belongs to a worktree
can be solved by checking for the existence of a `gitdir` file in
the gitdir. This file points back to the gitlink file located in
the working tree's working directory. As this file only exists
for worktrees, it should be sufficient indication of the gitdir
belonging to a worktree.
The second problem, that is determining the location of the
worktree's working directory, can then be solved by reading the
`gitdir` file in the working directory's gitdir. When we now
resolve relative paths and strip the final `.git` component, we
have the actual worktree's working directory location.
|
|
84f56cb0
|
2016-11-04T11:59:52
|
|
repository: rename `path_repository` and `path_gitlink`
The `path_repository` variable is actually confusing to think
about, as it is not always clear what the repository actually is.
It may either be the path to the folder containing worktree and
.git directory, the path to .git itself, a worktree or something
entirely different. Actually, the intent of the variable is to
hold the path to the gitdir, which is either the .git directory
or the bare repository.
Rename the variable to `gitdir` to avoid confusion. While at it,
also rename `path_gitlink` to `gitlink` to improve consistency.
|
|
384518d0
|
2015-10-27T14:17:52
|
|
repository: restrict checking out checked out branches
If a branch is already checked out in a working tree we are not
allowed to check out that branch in another repository. Introduce
this restriction when setting a repository's HEAD.
|
|
143e539f
|
2015-11-06T12:33:59
|
|
branch: restrict branch deletion for worktrees
Restrict the ability to delete branches that are checked out in
any linked repository.
|
|
4321595d
|
2015-11-10T16:54:48
|
|
worktree: test basic merge functionality
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
4292837d
|
2015-09-24T14:37:10
|
|
config: open configuration in commondir
A repository's configuartion file can always be found in the
GIT_COMMON_DIR, which has been newly introduced. For normal
repositories this does change nothing, but for working trees this
change allows to access the shared configuration file.
|
|
e9403024
|
2015-09-24T15:32:26
|
|
refdb: look for reflog in commondir
|
|
e0a6c28e
|
2015-09-16T16:09:24
|
|
refdb: introduce commondir awareness
The refdb_fs_backend is not aware of the git commondir, which
stores common objects like the o bject database and packed/loose
refereensces when worktrees are used.
Make refdb_fs_backend aware of the common directory by
introducing a new commonpath variable that points to the actual
common path of the database and using it instead of the gitdir
for the mentioned objects.
|
|
79ab3ef6
|
2015-10-15T15:58:05
|
|
repository: introduce is_worktree variable
|
|
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.
|
|
807d57e7
|
2015-11-11T10:54:41
|
|
tests: implement worktree helpers
|