Re: [PATCH v5 2/8] builtin/refs: get worktrees without reading head information
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Feb 25, 2025, 08:26 UTC
- Message-ID
- <Z71-zV-RL2niBdrn@pks.im>
- In-Reply-To
- <Z7NVZvAlNJ_00WX3@ArchLinux>
On Mon, Feb 17, 2025 at 11:27:34PM +0800, shejialuo wrote:
Show 12 quoted lines
> diff --git a/worktree.h b/worktree.h
> index 38145df80f..f7003a9c12 100644
> --- a/worktree.h
> +++ b/worktree.h
> @@ -30,6 +30,13 @@ struct worktree {
> */
> struct worktree **get_worktrees(void);
>
> +/*
> + * Like `get_worktrees`, but does not read HEAD. Skip reading HEAD allows to
> + * get the worktree without worrying about failures pertaining to parsing
> + * the HEAD ref. This is useful when we want to check the ref db consistency.Nit, not worth a reroll: this is highly specific to what you're doing. How about: "This is useful in contexts where it is assumed that the refdb may not be in a consistent state." That would also include cases like e.g. `repair_worktrees()`.
Patrick