git/refs
Han-Wen Nienhuys 71e5473493 refs: unify parse_worktree_ref() and ref_type()
The logic to handle worktree refs (worktrees/NAME/REF and
main-worktree/REF) existed in two places:

* ref_type() in refs.c

* parse_worktree_ref() in worktree.c

Collapse this logic together in one function parse_worktree_ref():
this avoids having to cross-check the result of parse_worktree_ref()
and ref_type().

Introduce enum ref_worktree_type, which is slightly different from
enum ref_type. The latter is a misleading name (one would think that
'ref_type' would have the symref option).

Instead, enum ref_worktree_type only makes explicit how a refname
relates to a worktree. From this point of view, HEAD and
refs/bisect/abc are the same: they specify the current worktree
implicitly.

The files-backend must avoid packing refs/bisect/* and friends into
packed-refs, so expose is_per_worktree_ref() separately.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-09-19 11:11:11 -07:00
..
debug.c refs debug: add a wrapper for "read_symbolic_ref" 2022-03-17 10:40:14 -07:00
files-backend.c refs: unify parse_worktree_ref() and ref_type() 2022-09-19 11:11:11 -07:00
iterator.c git-compat-util.h: use "UNUSED", not "UNUSED(var)" 2022-09-01 10:49:48 -07:00
packed-backend.c refs: unify parse_worktree_ref() and ref_type() 2022-09-19 11:11:11 -07:00
packed-backend.h Revert "Merge branch 'ps/avoid-unnecessary-hook-invocation-with-packed-refs'" 2022-04-13 15:51:33 -07:00
ref-cache.c Merge branch 'ep/maint-equals-null-cocci' 2022-05-20 15:26:59 -07:00
ref-cache.h Merge branch 'jt/no-abuse-alternate-odb-for-submodules' 2021-10-25 16:06:56 -07:00
refs-internal.h Revert "Merge branch 'ps/avoid-unnecessary-hook-invocation-with-packed-refs'" 2022-04-13 15:51:33 -07:00