Re: [PATCH v1 1/2] worktree: do not pass strbuf by value
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 9, 2026, 14:48 UTC
- Message-ID
- <xmqqh5qp6oun.fsf@gitster.g>
- In-Reply-To
- <20260308180359.31188-2-deveshigurgaon@gmail.com>
Deveshi Dwivedi <deveshigurgaon@gmail.com> writes:
> The function only needs the string values, not the strbuf machinery. > Switch it to take const char * and update all callers to pass .buf.
Makes perfect sense. Thanks for noticing and fixing these.
Show 7 quoted lines
> - write_worktree_linking_files(dotgit, gitdir, use_relative_paths);
> + write_worktree_linking_files(dotgit.buf, gitdir.buf, use_relative_paths);
> ...
> -void write_worktree_linking_files(struct strbuf dotgit, struct strbuf gitdir,
> +void write_worktree_linking_files(const char *dotgit, const char *gitdir,
> int use_relative_paths)
> {This updated function signature makes it plenty clear that the function does not modify anything in gitdir, so the caller shouldn't be affected. Nice.