diff options
author | shejialuo <shejialuo@gmail.com> | 2024-11-20 19:51:16 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-11-21 08:21:31 +0900 |
commit | 32dc1c7ec3c4e92704f221abbfee5cc1d50bf473 (patch) | |
tree | ed4350666679626cb952a1da1d3538efe19979a9 /builtin/diff-files.c | |
parent | 38cd6eead19f3d7359ebd34cae6f2a37de4ccc10 (diff) |
ref: check the full refname instead of basename
In "files-backend.c::files_fsck_refs_name", we validate the refname
format by using "check_refname_format" to check the basename of the
iterator with "REFNAME_ALLOW_ONELEVEL" flag.
However, this is a bad implementation. Although we doesn't allow a
single "@" in ".git" directory, we do allow "refs/heads/@". So, we will
report an error wrongly when there is a "refs/heads/@" ref by using one
level refname "@".
Because we just check one level refname, we either cannot check the
other parts of the full refname. And we will ignore the following
errors:
"refs/heads/ new-feature/test"
"refs/heads/~new-feature/test"
In order to fix the above problem, enhance "files_fsck_refs_name" to use
the full name for "check_refname_format". Then, replace the tests which
are related to "@" and add tests to exercise the above situations using
for loop to avoid repetition.
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>
Diffstat (limited to 'builtin/diff-files.c')
0 files changed, 0 insertions, 0 deletions