Commit Graph

9 Commits

Author SHA1 Message Date
Jongmin Kim
ac3d33df5d New upstream version 0.28.1+dfsg.1 2019-05-12 00:29:21 +09:00
Patrick Steinhardt
3017ba94a3 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.
2017-03-17 09:26:13 +01:00
Patrick Steinhardt
fdb3e24ac4 tests: worktree: unify init/cleanup in open tests 2017-03-15 14:24:45 +01:00
Patrick Steinhardt
aa593a65df tests: worktree: move submodule tests into own suite 2017-03-15 12:01:02 +01:00
Patrick Steinhardt
3f3a4ce7bc worktree: test opening worktree via gitlink, gitdir and worktree 2017-02-13 11:12:01 +01:00
Patrick Steinhardt
1fd6e035dd worktree: test opening discovered submodule worktrees 2017-02-13 11:09:57 +01:00
Patrick Steinhardt
39abd3adaa 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.
2017-02-13 11:08:57 +01:00
Patrick Steinhardt
79ab3ef69f repository: introduce is_worktree variable 2017-02-13 10:28:15 +01:00
Patrick Steinhardt
c09fd54e2e 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.
2017-02-13 10:13:02 +01:00