Skip to content

Detect empty or missing reflogs with `ref@{0}`

Patrick Steinhardt git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2object-name: detect and report empty reflogsobject-name.c refs.c t/t1506-rev-parse-diagnosis.sh +1 more+41 -93 replies
2/2builtin/show-branch: detect empty reflogsbuiltin/show-branch.c t/t3202-show-branch.sh+27 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Detect empty or missing reflogs with `ref@{0}`

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(-)
Signature · 1 line
2.44.0-rc1