git/refs
shejialuo d996b4475c ref: check whether the target of the symref is a ref
Ideally, we want to the users use "git symbolic-ref" to create symrefs
instead of writing raw contents into the filesystem. However, "git
symbolic-ref" is strict with the refname but not strict with the
referent. For example, we can make the "referent" located at the
"$(gitdir)/logs/aaa" and manually write the content into this where we
can still successfully parse this symref by using "git rev-parse".

  $ git init repo && cd repo && git commit --allow-empty -mx
  $ git symbolic-ref refs/heads/test logs/aaa
  $ echo $(git rev-parse HEAD) > .git/logs/aaa
  $ git rev-parse test

We may need to add some restrictions for "referent" parameter when using
"git symbolic-ref" to create symrefs because ideally all the
nonpseudo-refs should be located under the "refs" directory and we may
tighten this in the future.

In order to tell the user we may tighten the above situation, create
a new fsck message "symrefTargetIsNotARef" to notify the user that this
may become an error in the future.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-11-21 08:21:33 +09:00
..
debug.c ref: support multiple worktrees check for refs 2024-11-21 08:21:32 +09:00
files-backend.c ref: check whether the target of the symref is a ref 2024-11-21 08:21:33 +09:00
iterator.c refs: add referent to each_ref_fn 2024-08-09 08:47:34 -07:00
packed-backend.c ref: support multiple worktrees check for refs 2024-11-21 08:21:32 +09:00
packed-backend.h refs/files: use heuristic to decide whether to repack with `--auto` 2024-09-04 08:03:24 -07:00
ref-cache.c refs: keep track of unresolved reference value in iterators 2024-08-09 08:47:33 -07:00
ref-cache.h refs: keep track of unresolved reference value in iterators 2024-08-09 08:47:33 -07:00
refs-internal.h ref: add more strict checks for regular refs 2024-11-21 08:21:33 +09:00
reftable-backend.c ref: support multiple worktrees check for refs 2024-11-21 08:21:32 +09:00