Re: [PATCH v8 5/6] branch: add --recurse-submodules option for branch creation
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 4, 2022, 16:15 UTC
- Message-ID
- <xmqqmtj6obft.fsf@gitster.g>
- In-Reply-To
- <kl6lwnibzbb6.fsf@chooglen-macbookpro.roam.corp.google.com>
Glen Choo <chooglen@google.com> writes:
> I tested this series some more and found a silly bug. > Let me know if I should just send v9 instead.
As long as the log message of this new thing does not have to be retained, I can squash it in for you.
And in this case, we can lose the message below---it just talks about a mistake in the version that was submitted, and will become irrelevant once the change is squashed in.
Thanks.
Show 26 quoted lines
> ----- >8 --------- >8 --------- >8 --------- >8 --------- >8 ----
>
> Subject: [PATCH] submodule-config.c: remove accidental pointer reuse
>
> List entries allocated by traverse_tree_submodules() are sharing the
> .name_entry pointer, but each of them needs their own pointer. Fix this.
>
> Signed-off-by: Glen Choo <chooglen@google.com>
> ---
> submodule-config.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/submodule-config.c b/submodule-config.c
> index 24b8d1a700..c9f54bc72d 100644
> --- a/submodule-config.c
> +++ b/submodule-config.c
> @@ -757,7 +757,8 @@ static void traverse_tree_submodules(struct repository *r,
> if (S_ISGITLINK(name_entry->mode) &&
> is_tree_submodule_active(r, root_tree, tree_path)) {
> st_entry = xmalloc(sizeof(*st_entry));
> - st_entry->name_entry = name_entry;
> + st_entry->name_entry = xmalloc(sizeof(*st_entry->name_entry));
> + *st_entry->name_entry = *name_entry;
> st_entry->submodule =
> submodule_from_path(r, root_tree, tree_path);
> st_entry->repo = xmalloc(sizeof(*st_entry->repo));