Re: [PATCH] doc-diff: always use oids inside worktree
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Aug 30, 2018, 09:12 UTC
- Message-ID
- <CAPig+cRm80qBUXiykTtrHMxrMbzMLjYb3TvJB1UwoHNPFNxkkg@mail.gmail.com>
- In-Reply-To
- <20180830081202.GA10224@sigill.intra.peff.net>
On Thu, Aug 30, 2018 at 4:12 AM Jeff King <peff@peff.net> wrote:
Show 10 quoted lines
> The doc-diff script immediately resolves its two endpoints > to actual object ids, so that we can reuse cached results > even if they appear under a different name. But we still use > the original name the user fed us when running "git > checkout" in our temporary worktree. This can lead to > confusing results: > [...] > - we didn't pass --detach, which meant that using a branch > name would cause us to actually check out that branch, > making it unavailable to other worktrees.
Oof. The initial worktree creation correctly uses --detach, but indeed the later git-checkout doesn't. I missed that too when reading over this script.
> We can solve this by feeding the already-resolved object id > to git-checkout. That naturally forces a detached HEAD, but > just to make clear our expectation, let's explicitly pass > --detach.
Specifying --detach explicitly makes a lot of sense, even if it is implied in this case.
> Signed-off-by: Jeff King <peff@peff.net>