git/refs
Nguyễn Thái Ngọc Duy 3a3b9d8cde refs: new ref types to make per-worktree refs visible to all worktrees
One of the problems with multiple worktree is accessing per-worktree
refs of one worktree from another worktree. This was sort of solved by
multiple ref store, where the code can open the ref store of another
worktree and has access to the ref space of that worktree.

The problem with this is reporting. "HEAD" in another ref space is
also called "HEAD" like in the current ref space. In order to
differentiate them, all the code must somehow carry the ref store
around and print something like "HEAD from this ref store".

But that is not feasible (or possible with a _lot_ of work). With the
current design, we pass a reference around as a string (so called
"refname"). Extending this design to pass a string _and_ a ref store
is a nightmare, especially when handling extended SHA-1 syntax.

So we do it another way. Instead of entering a separate ref space, we
make refs from other worktrees available in the current ref space. So
"HEAD" is always HEAD of the current worktree, but then we can have
"worktrees/blah/HEAD" to denote HEAD from a worktree named
"blah". This syntax coincidentally matches the underlying directory
structure which makes implementation a bit easier.

The main worktree has to be treated specially because well... it's
special from the beginning. So HEAD from the main worktree is
acccessible via the name "main-worktree/HEAD" instead of
"worktrees/main/HEAD" because "main" could be just another secondary
worktree.

This patch also makes it possible to specify refs from one worktree in
another one, e.g.

    git log worktrees/foo/HEAD

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-22 13:32:29 +09:00
..
files-backend.c refs: new ref types to make per-worktree refs visible to all worktrees 2018-10-22 13:32:29 +09:00
iterator.c Replace all die("BUG: ...") calls by BUG() ones 2018-05-06 19:06:13 +09:00
packed-backend.c convert "oidcmp() != 0" to "!oideq()" 2018-08-29 11:32:49 -07:00
packed-backend.h files-backend: don't rewrite the packed-refs file unnecessarily 2017-10-30 09:45:15 +09:00
ref-cache.c convert "oidcmp() != 0" to "!oideq()" 2018-08-29 11:32:49 -07:00
ref-cache.h ref_cache: remove support for storing peeled values 2017-09-25 18:02:46 +09:00
refs-internal.h Merge branch 'bp/log-ref-write-fd-with-strbuf' 2018-07-24 14:50:47 -07:00