Subject: Re: [PATCH 1/5] refs: make branchname helpers repository aware

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 27 Mar 2026 08:49:57 +0100

On Wed, Mar 25, 2026 at 10:14:18PM +0530, Shreyansh Paliwal wrote:
> diff --git a/branch.h b/branch.h
> index 3dc6e2a0ff..3aa53eb243 100644
> --- a/branch.h
> +++ b/branch.h
> @@ -111,7 +111,7 @@ const char *branch_checked_out(const char *refname);
>   * Return 1 if the named branch already exists; return 0 otherwise.
>   * Fill ref with the full refname for the branch.
>   */
> -int validate_branchname(const char *name, struct strbuf *ref);
> +int validate_branchname(const char *name, struct strbuf *ref, struct repository *repo);
>  
>  /*
>   * Check if a branch 'name' can be created as a new branch; die otherwise.
> @@ -119,7 +119,8 @@ int validate_branchname(const char *name, struct strbuf *ref);
>   * Return 1 if the named branch already exists; return 0 otherwise.
>   * Fill ref with the full refname for the branch.
>   */
> -int validate_new_branchname(const char *name, struct strbuf *ref, int force);
> +int validate_new_branchname(const char *name, struct strbuf *ref, int force,
> +			    struct repository *repo);
>  
>  /*
>   * Remove information about the merge state on the current

It's more customary in our code base to have the repository be the first
parameter. Other than that this patch looks good to me.

Patrick