From: Junio C Hamano <gitster@pobox.com>
To: kristofferhaugsbakk@fastmail.com
Cc: git@vger.kernel.org, Kristoffer Haugsbakk <code@khaugsbakk.name>,
Jeff King <peff@peff.net>, Teng Long <dyroneteng@gmail.com>,
"D . Ben Knoble" <ben.knoble@gmail.com>
Subject: Re: [PATCH v2 6/9] doc: notes: clearly state that --stripspace is the default
Date: Fri, 23 May 2025 14:36:07 -0700 [thread overview]
Message-ID: <xmqqiklrvwl4.fsf@gitster.g> (raw)
In-Reply-To: <be89c3349d24e47a38f04538d3d1e3730dfc37a9.1748028010.git.code@khaugsbakk.name> (kristofferhaugsbakk@fastmail.com's message of "Fri, 23 May 2025 21:29:52 +0200")
kristofferhaugsbakk@fastmail.com writes:
> See the review on the patch:
>
> https://lore.kernel.org/git/xmqq4jp326oj.fsf@gitster.g/
>
> There was concern about the order of options:
>
> > ... One more thing need to note is "the order of
> > the options matter", [...]
>
> This sounds more like a design/implementation mistake that we may
> want to fix.
That is a comment on the 8th iteration of the series, which is
different from what you are documenting, which is 11th if I am
reading the thread correctly.
Comparing [v8 6/6] with [v11 6/7],
https://lore.kernel.org/git/f60f743203d78a489b90df81472e71391b45367d.1682429602.git.dyroneteng@gmail.com/
https://lore.kernel.org/git/19865941bb29c28a690ed3e28fc4f6870e352923.1685174012.git.dyroneteng@gmail.com/
I notice that the later version has .stripspace member in note_msg
as well as note_data. note_data has a collection of multiple
note_msg instances. Each of note_msg comes from various sources,
like '-m', '-C', etc., and each of these types have hardcoded
default values for note_msg.stripspace (mostly to strip but note_msg
that comes from an existing note blob has stripspace unset). When
concat_messages() takes note_msg instances in a note_data together,
it _could_ do:
- if note_data.stripspace is explicitly specified, use that,
otherwise use note_msg.stripspace, to cleanse the message
contained in note_msg.
and concatenate the results. But even at v11 of the series, the
implementation of concat_messages() uses the stripspace determined
to instead cleanse the concatenated result.
Which I think is simply buggy.
What it should do probably is
- Loop over d->messages[] and:
- if d->stripspace is set or d->messages[]->stripspace is set,
cleanse the message (i.e. d->messages[]->buf) and append to d->buf
- otherwise append d->messages[]->buf as-is to d->buf
- If d->stripspace is set, cleanse d->buf (may not be necessary, as
the messages that are concatenated have _all_ lost leading and
trailing blank lines before concatenation).
and that would truly fix the problem pointed out during the review
of v8.
> +--
> ++
> +`--stripspace` is the default except for
> +`-C`/`--reuse-message`. However, keep in mind that this depends on the
> +order of similar options. For example, for `-C <object> -m<message>`,
> +`--stripspace` will be used because the default for `-m` overrides the
> +previous `-C`.
So, I think this is an accurate description of the current
behaviour, but we might want to phrase the part that comes after
"however" as documenting a known bug, which we would want to fix
later.
Thanks.
next prev parent reply other threads:[~2025-05-23 21:36 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-20 17:57 [PATCH 0/6] doc: --stdin on notes and core.commentChar mentions kristofferhaugsbakk
2025-05-20 17:57 ` [PATCH 1/6] doc: stripspace: mention where the default comes from kristofferhaugsbakk
2025-05-20 19:06 ` Junio C Hamano
2025-05-21 15:04 ` Kristoffer Haugsbakk
2025-05-20 17:57 ` [PATCH 2/6] doc: config: mention core.commentChar on commit.cleanup kristofferhaugsbakk
2025-05-20 17:57 ` [PATCH 3/6] doc: notes: split out options with negations kristofferhaugsbakk
2025-05-20 19:11 ` Junio C Hamano
2025-05-21 13:14 ` Junio C Hamano
2025-05-21 14:42 ` Kristoffer Haugsbakk
2025-05-21 15:47 ` Junio C Hamano
2025-05-21 15:52 ` Kristoffer Haugsbakk
2025-05-20 17:57 ` [PATCH 4/6] doc: notes: mention comment character configuration kristofferhaugsbakk
2025-05-20 19:14 ` Junio C Hamano
2025-05-20 17:57 ` [PATCH 5/6] doc: notes: point out copy --stdin use with argv kristofferhaugsbakk
2025-05-20 19:15 ` Junio C Hamano
2025-05-20 17:57 ` [PATCH 6/6] doc: notes: treat --stdin equally between copy/remove kristofferhaugsbakk
2025-05-20 19:19 ` Junio C Hamano
2025-05-21 14:49 ` Kristoffer Haugsbakk
2025-05-21 13:19 ` D. Ben Knoble
2025-05-21 14:44 ` Kristoffer Haugsbakk
2025-05-21 15:50 ` Junio C Hamano
2025-05-23 19:29 ` [PATCH v2 0/9] doc: --stdin on notes and core.commentChar mentions kristofferhaugsbakk
2025-05-23 19:29 ` [PATCH v2 1/9] doc: stripspace: mention where the default comes from kristofferhaugsbakk
2025-05-23 19:29 ` [PATCH v2 2/9] doc: config: mention core.commentChar on commit.cleanup kristofferhaugsbakk
2025-05-23 19:29 ` [PATCH v2 3/9] doc: notes: split out options with negated forms kristofferhaugsbakk
2025-05-23 19:29 ` [PATCH v2 4/9] doc: notes: rework --[no-]stripspace kristofferhaugsbakk
2025-05-23 19:29 ` [PATCH v2 5/9] doc: notes: remove stripspace discussion from other options kristofferhaugsbakk
2025-05-23 19:29 ` [PATCH v2 6/9] doc: notes: clearly state that --stripspace is the default kristofferhaugsbakk
2025-05-23 21:36 ` Junio C Hamano [this message]
2025-05-23 19:29 ` [PATCH v2 7/9] doc: notes: point out copy --stdin use with argv kristofferhaugsbakk
2025-05-23 19:29 ` [PATCH v2 8/9] doc: notes: treat --stdin equally between copy/remove kristofferhaugsbakk
2025-05-23 21:40 ` Junio C Hamano
2025-05-23 19:29 ` [PATCH v2 9/9] doc: notes: use stuck form throughout kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 0/9] doc: --stdin on notes and core.commentChar mentions kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 1/9] doc: stripspace: mention where the default comes from kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 2/9] doc: config: mention core.commentChar on commit.cleanup kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 3/9] doc: notes: split out options with negated forms kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 4/9] doc: notes: rework --[no-]stripspace kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 5/9] doc: notes: remove stripspace discussion from other options kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 6/9] doc: notes: clearly state that --stripspace is the default kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 7/9] doc: notes: point out copy --stdin use with argv kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 8/9] doc: notes: treat --stdin equally between copy/remove kristofferhaugsbakk
2025-05-27 21:19 ` [PATCH v3 9/9] doc: notes: use stuck form throughout kristofferhaugsbakk
2025-05-27 22:33 ` [PATCH v3 0/9] doc: --stdin on notes and core.commentChar mentions Junio C Hamano
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=xmqqiklrvwl4.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=code@khaugsbakk.name \
--cc=dyroneteng@gmail.com \
--cc=git@vger.kernel.org \
--cc=kristofferhaugsbakk@fastmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.