git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: karthik nayak <karthik.188@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: shejialuo <shejialuo@gmail.com>,
	git@vger.kernel.org, ps@pks.im,
	 Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH v2] builtin: allow passing custom data to sub-commands
Date: Wed, 27 Nov 2024 04:23:07 -0800	[thread overview]
Message-ID: <CAOLa=ZRj8SiZu3AiBTGHwp+SiuBNBj3VAsVG9PppTjyKuz9oyA@mail.gmail.com> (raw)
In-Reply-To: <CAOLa=ZQgKv4SEPRqQix8pJo1nr30Fpg2oF-LdDX1ynHeSjDcGw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]

karthik nayak <karthik.188@gmail.com> writes:

> Junio C Hamano <gitster@pobox.com> writes:
>
>> karthik nayak <karthik.188@gmail.com> writes:
>>
>>> Could you elaborate on why you think this is an over-optimization? We
>>> don't loose functionality with this, nor do we have to have add
>>> additional code to handle the typecasting to `struct repository *` if
>>> needed. But would definitely like to resolve anything I missed.
>>
>> I do not know if it is an optimization, but if you know it is of a
>> specific type, casting back and force with "void *" loses type
>> safety, no?
>
> That is true of course, I just thought that is the price to pay in C for
> having to deal with generic data propagation. In the end I'm okay with
> both scenarios, I see merits both ways. I do tend to incline on the
> generic version in v2, since it is a lot more expandable.

That said, I see v1 is merged into `next` [1]. I think we should keep it
that way and like you said modify it in the future if needed to add
varargs or another `void *` argument.

Thanks

[1]: https://github.com/gitster/git/commit/668c0913f5803ebcc3b0b1f13e6cd49503194869

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]

      reply	other threads:[~2024-11-27 12:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 14:55 [PATCH] builtin: pass repository to sub commands Karthik Nayak
2024-11-26  8:46 ` Christian Couder
2024-11-26  9:50   ` karthik nayak
2024-11-26  8:56 ` Patrick Steinhardt
2024-11-26  9:56   ` karthik nayak
2024-11-26 19:26   ` Junio C Hamano
2024-11-26 11:19 ` [PATCH v2] builtin: allow passing custom data to sub-commands Karthik Nayak
2024-11-26 11:57   ` shejialuo
2024-11-26 16:41     ` karthik nayak
2024-11-26 19:27       ` Junio C Hamano
2024-11-27  9:15         ` karthik nayak
2024-11-27 12:23           ` karthik nayak [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='CAOLa=ZRj8SiZu3AiBTGHwp+SiuBNBj3VAsVG9PppTjyKuz9oyA@mail.gmail.com' \
    --to=karthik.188@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ps@pks.im \
    --cc=shejialuo@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).