From: Junio C Hamano <gitster@pobox•com>
To: Jonathan Tan <jonathantanmy@google•com>
Cc: git@vger•kernel.org, Dragan Simic <dsimic@manjaro•org>,
Phillip Wood <phillip.wood123@gmail•com>
Subject: Re: [PATCH v2 4/4] strbuf: move env-using functions to environment.c
Date: Wed, 01 Nov 2023 13:37:16 +0900 [thread overview]
Message-ID: <xmqqy1fit7gj.fsf@gitster.g> (raw)
In-Reply-To: <4097385820973b30a78f2e45741444a3f6eee98d.1698791220.git.jonathantanmy@google.com> (Jonathan Tan's message of "Tue, 31 Oct 2023 15:28:33 -0700")
Jonathan Tan <jonathantanmy@google•com> writes:
> diff --git a/environment.h b/environment.h
> index e5351c9dd9..f801dbe36e 100644
> --- a/environment.h
> +++ b/environment.h
> @@ -229,4 +229,18 @@ extern const char *excludes_file;
> */
> int print_sha1_ellipsis(void);
>
> +/**
> + * Add a formatted string prepended by a comment character and a
> + * blank to the buffer.
> + */
> +__attribute__((format (printf, 2, 3)))
> +void strbuf_commented_addf(struct strbuf *sb, const char *fmt, ...);
> +
> +/**
> + * Add a NUL-terminated string to the buffer. Each line will be prepended
> + * by a comment character and a blank.
> + */
> +void strbuf_add_commented_lines(struct strbuf *out,
> + const char *buf, size_t size);
> +
What's your plans for globals kept in ident.c for example?
The reason why I ask is because I do not quite see how making the
use of the global comment-line-char variable hidden like this patch
does would help your libification effort. There are many settings
that are reasonably expected to be used by many places, and if you
want to avoid them, it appears to me that your only way forward
after applying this patch would be to recreate the implementation
the public git has in environment.[ch] in your version of Git.
You'd have to do something similar for what is in ident.c for the
same reason.
The relative size of the logic necessary to split the original
into lines and prefix the comment prefix character (which is much
larger) and the idea that there is a system wide setting of what the
comment prefix character should be (which is miniscule) makes me
wonder if this is going in the right direction.
Thanks.
prev parent reply other threads:[~2023-11-01 4:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-30 5:10 [PATCH 0/2] Avoid passing global comment_line_char repeatedly Junio C Hamano
2023-10-30 5:10 ` [PATCH 1/2] strbuf_commented_addf(): drop the comment_line_char parameter Junio C Hamano
2023-10-30 5:10 ` [PATCH 2/2] strbuf_add_commented_lines(): " Junio C Hamano
2023-10-30 5:36 ` [PATCH 0/2] Avoid passing global comment_line_char repeatedly Dragan Simic
2023-10-30 9:59 ` Phillip Wood
2023-10-30 20:22 ` [RFC PATCH 0/3] " Jonathan Tan
2023-10-30 20:22 ` [RFC PATCH 1/3] strbuf: make add_lines() public Jonathan Tan
2023-10-30 23:53 ` Junio C Hamano
2023-10-31 6:01 ` Junio C Hamano
2023-10-30 20:22 ` [RFC PATCH 2/3] strbuf_commented_addf(): drop the comment_line_char parameter Jonathan Tan
2023-10-31 5:19 ` Junio C Hamano
2023-10-31 22:24 ` Jonathan Tan
2023-10-31 23:54 ` Junio C Hamano
2023-10-30 20:22 ` [RFC PATCH 3/3] strbuf_add_commented_lines(): " Jonathan Tan
2023-10-31 22:28 ` [PATCH v2 0/4] Avoid passing global comment_line_char repeatedly Jonathan Tan
2023-10-31 22:28 ` [PATCH v2 1/4] strbuf_commented_addf(): drop the comment_line_char parameter Jonathan Tan
2023-10-31 22:28 ` [PATCH v2 2/4] strbuf_add_commented_lines(): " Jonathan Tan
2023-10-31 22:28 ` [PATCH v2 3/4] strbuf: make add_lines() public Jonathan Tan
2023-11-01 4:14 ` Junio C Hamano
2023-10-31 22:28 ` [PATCH v2 4/4] strbuf: move env-using functions to environment.c Jonathan Tan
2023-11-01 4:37 ` Junio C Hamano [this message]
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=xmqqy1fit7gj.fsf@gitster.g \
--to=gitster@pobox$(echo .)com \
--cc=dsimic@manjaro$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=jonathantanmy@google$(echo .)com \
--cc=phillip.wood123@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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