From: Junio C Hamano <gitster@pobox.com>
To: Deveshi Dwivedi <deveshigurgaon@gmail.com>
Cc: git@vger.kernel.org, peff@peff.net
Subject: Re: [PATCH v1 1/2] worktree: do not pass strbuf by value
Date: Mon, 09 Mar 2026 07:48:16 -0700 [thread overview]
Message-ID: <xmqqh5qp6oun.fsf@gitster.g> (raw)
In-Reply-To: <20260308180359.31188-2-deveshigurgaon@gmail.com> (Deveshi Dwivedi's message of "Sun, 8 Mar 2026 18:03:58 +0000")
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.
> - 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.
next prev parent reply other threads:[~2026-03-09 14:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-08 18:03 [PATCH v1 0/2] avoid unnecessary strbuf_split*() and strbuf-by-value usage Deveshi Dwivedi
2026-03-08 18:03 ` [PATCH v1 1/2] worktree: do not pass strbuf by value Deveshi Dwivedi
2026-03-09 14:48 ` Junio C Hamano [this message]
2026-03-09 19:26 ` coccinelle to catch pass-by-value?, was: " Jeff King
2026-03-08 18:03 ` [PATCH v1 2/2] list-objects-filter-options: avoid strbuf_split_str() Deveshi Dwivedi
2026-03-09 15:38 ` Junio C Hamano
2026-03-09 19:01 ` Jeff King
2026-03-09 19:08 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh5qp6oun.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=deveshigurgaon@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox