From: Jeff King Date: Sun, 15 Feb 2026 09:12:04 GMT Subject: Re: [PATCH v5 2/4] refs: forward and use the reference storage payload Message-ID: <20260215091204.GA696020@coredump.intra.peff.net> In-Reply-To: On Fri, Feb 13, 2026 at 06:45:20AM -0800, Karthik Nayak wrote: > > BTW, is it possible to have a gitdir string without a slash in it? I > > guess not if it is absolute, but I didn't look at the caller to see if > > that is always true. Anyway, I wonder if we should be checking the > > result of strrchr() here. > > Since this is called during the ref store initialization and that value > is generally set via: > > 1. `repo->gitdir`: Which is resolved to an absolute path > 2. `repo->commondir`: Which is user input, can be without slash > 3. `worktree dir`: Should contain a slash > 4. `submodule dir`: Should contain a slash > 5. `refs migration dir`: Should contain a slash > > But even with this, Gits understanding of linked worktrees are that they > are in a `$gitdir/worktrees/$wt_id`. So it should be safe to do this. > Nevertheless, I'll add in a check. Thanks. I figured it was something like that. Even a comment or a BUG() would be more than enough, I'd think. -Peff