Hi, this patch series addresses some shortcomings when parsing `ref@{n}` syntax via `read_ref_at()` when the reflog is missing or empty: - First, as reported by Yasushi, git-show-branch(1) would segfault because the function does not report when the 0th entry wasn't found. - Second, `ref@{0}` would fall back to return the object ID of ref itself in case the reflog is empty or missing. This behaviour is quite confusing and only works by chance. The series addresses both of these issues by detecting and reporting the case where the reflog is empty or missing. Patrick Patrick Steinhardt (2): object-name: detect and report empty reflogs builtin/show-branch: detect empty reflogs builtin/show-branch.c | 2 ++ object-name.c | 10 ++++++---- refs.c | 3 ++- t/t1506-rev-parse-diagnosis.sh | 8 ++++++++ t/t1508-at-combinations.sh | 29 +++++++++++++++++++++++++---- t/t3202-show-branch.sh | 25 +++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 9 deletions(-) -- 2.44.0-rc1
Attachment:
signature.asc
Description: PGP signature