Re: [PATCH v2 1/5] refs: make branchname helpers repository aware
- From
Tian Yuchen <a3205153416@gmail.com>
- Date
- Mar 28, 2026, 16:54 UTC
- Message-ID
- <c3f032e4-d50b-4e35-846f-5f5da95f82a6@gmail.com>
- In-Reply-To
- <20260328141146.1095115-2-shreyanshpaliwalcmsmn@gmail.com>
Hi Shreyansh,
On 3/28/26 22:09, Shreyansh Paliwal wrote:
Show 5 quoted lines
> @@ -5,6 +5,7 @@ > #include "refs.h" > #include "setup.h" > #include "strbuf.h" > +#include "repository.c"
I'm surprised that it doesn't cause any errors. Or maybe you haven't build it yet?
---
Show 9 quoted lines
> -int check_branch_ref(struct strbuf *sb, const char *name)
> +int check_branch_ref(struct repository *repo, struct strbuf *sb, const char *name)
> {
> if (startup_info->have_repository)
> - copy_branchname(sb, name, INTERPRET_BRANCH_LOCAL);
> + copy_branchname(repo, sb, name, INTERPRET_BRANCH_LOCAL);
> else
> strbuf_addstr(sb, name);
> startup_info itself is a global variable, isn't it?
I think a more appropriate approach is something like:
if (repo && repo->gitdir) copy_branchname(repo, sb, name, INTERPRET_BRANCH_LOCAL);
I dunno, just a thought.
---
Regards, Yuchen