Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] archive: pass export-subst attribute value as parameter
Date: Sat, 28 Nov 2026 14:38:09 -0800	[thread overview]
Message-ID: <xmqqv75gtwdq.fsf@gitster.g> (raw)
In-Reply-To: <6c09fc91-b461-451d-90d6-512a4f785d8a@web.de> ("René Scharfe"'s message of "Sat, 28 Nov 2026 19:47:49 +0100")

René Scharfe <l.s.r@web.de> writes:

> The member "convert" of struct archiver_args is used to pass the value
> of blob attribute export-subst to object_file_to_archive().  That's an
> unusual place and a misleading name.  Add and use an appropriately named
> parameter to that function instead.
>
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
>  archive.c | 12 +++++++-----
>  archive.h |  1 -
>  2 files changed, 7 insertions(+), 6 deletions(-)

The name is misleading indeed.  Why it is "an unusual place" needs a bit
of explanation to convince others, I am afraid, so let me try to spell
out the reason why, as I understand it, and see if that matches yours
(and if so, "an unusual place" above may want to be strengthened by the
reason why).

There are two ways this function and write_entry() (and possibly others)
receive settings from their caller, write_archive_entry().

The archiver_args structure is meant to hold the settings common across
different entries to be written.  In addition, per-call parameters give
information specific to each entry being written by a particular call,
like the path of the entry and its file mode.

The 'export_subst' setting is per path and specified via attributes, so
it definitely is not common across entries.  It does not belong there,
and making it a parameter passed to object_file_to_archive() moves it to
the right place.  And with a more correct name, which is very nice ;-)

Now, are there members other than '.convert' in the archiver_args that
should be moved out of there for the same reason?  The '.convert' member
needs to be reset in write_archive_entry() for each and every path
because of this misplacement.  If there is no longer any member that is
not common across entries, perhaps many of the consumers of
'struct archiver_args *' can take a const pointer, most notably the
write_archive_entry() function?  It needs to propagate the constness
down to write_entry(), and is better left outside this patch, perhaps.

The patch of looks good to me.  Thanks.

  reply	other threads:[~2026-11-28 22:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 18:47 [PATCH] archive: pass export-subst attribute value as parameter René Scharfe
2026-11-28 22:38 ` Junio C Hamano [this message]
2026-11-30 15:55   ` René Scharfe

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=xmqqv75gtwdq.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /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