libgit2/tests/worktree
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
..
config.c config: open configuration in commondir 2017-02-13 10:28:15 +01:00
merge.c repository: rename path_repository and path_gitlink 2017-02-13 11:07:52 +01:00
open.c worktree: compute workdir for worktrees opened via their gitdir 2017-02-13 11:08:57 +01:00
reflog.c refdb: look for reflog in commondir 2017-02-13 10:28:15 +01:00
refs.c repository: restrict checking out checked out branches 2017-02-13 11:06:52 +01:00
repository.c worktree: implement functions reading HEAD 2017-02-13 11:03:01 +01:00
worktree_helpers.c tests: implement worktree helpers 2017-02-13 10:13:02 +01:00
worktree_helpers.h tests: implement worktree helpers 2017-02-13 10:13:02 +01:00
worktree.c worktree: compute workdir for worktrees opened via their gitdir 2017-02-13 11:08:57 +01:00