Subject: Re: cat-file: dies with --batch if reflog entry is out of bounds

From: Jeff King <[email-masked]>
Date: Wed, 11 Feb 2026 23:07:08 -0500

On Thu, Feb 12, 2026 at 12:13:36AM +0100, Kristoffer Haugsbakk wrote:

>     $ git cat-file --batch
>     HEAD@{7}
>     <commit>
>     branch@{20}
>     fatal: log for 'branch' only has 5 entries
>     [died]
> 
> This is a known limitation.

I expect there are others. E.g.:

  $ git checkout --detach
  $ echo @{upstream} | git cat-file --batch
  fatal: HEAD does not point to a branch

So I'd guess that there is probably a lot more work to be done on top of
393bbb21 to make GET_OID_GENTLY work consistently. But doing that will
incrementally take us in a good direction (for cat-file and for other
callers).

-Peff