All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH 0/5] refs: remove functions without ref store
Date: Tue, 7 May 2024 07:56:49 +0200	[thread overview]
Message-ID: <ZjnCoaVP9_wuYiHh@tanuki> (raw)
In-Reply-To: <xmqqseyu3ojk.fsf@gitster.g>

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

On Mon, May 06, 2024 at 09:14:55AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > ... But honestly, I doubt
> > that it would be faster for any author of a patch series to figure out
> > that they now need to a define something compared to just adding the
> > `refs_` prefix to their functions.
> 
> The authors would not bother figuring that out while your series is
> not yet in 'master'.  The alternative they have is to base their
> series on top of yours.  You may have "what changes are needed on
> the callers side" in your head, but they don't.

Yeah, that is fair indeed. Theoretically one could re-run Coccinelle
whenever merging a new topic. But that would of course put the burden on
you, which is something we definitely want to avoid.

> Somebody brought up the approach used in <banned.h> to move the
> problem to link time, but in the context the only message we are
> giving is "it is banned - do not use it", which is sufficient over
> there, but probably not in this context.  "it was removed - use this
> instead by adding this suffix and add that as the first parameter"
> is the message I want whoever needs to deal with the fallout to see.

Unfortunately we cannot quite get there at compile time because it is
not possible to expand a macro into an error macro with an arbitrary
message. The best I could come up with is the following:

    #define REPLACED_REFS_FUNC(func) func ## was_replaced_by_refs_### func

Which results in compiler errors like this:

    bisect.c:712:6: error: use of undeclared identifier 'read_ref_was_replaced_by_refs_read_ref'
      712 |         if (read_ref("BISECT_EXPECTED_REV", &expected_oid))

What is still missing is the bit of informatino that you need to pass in
`get_main_ref_store()`. But maybe this is good enough?

Patrick

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

  reply	other threads:[~2024-05-07  5:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03  6:27 [PATCH 0/5] refs: remove functions without ref store Patrick Steinhardt
2024-05-03  6:27 ` [PATCH 1/5] refs: introduce missing functions that accept a `struct ref_store` Patrick Steinhardt
2024-05-03 17:11   ` Junio C Hamano
2024-05-03  6:28 ` [PATCH 2/5] refs: add `exclude_patterns` parameter to `for_each_fullref_in()` Patrick Steinhardt
2024-05-03 18:44   ` Taylor Blau
2024-05-03  6:28 ` [PATCH 3/5] cocci: introduce rules to transform "refs" to pass ref store Patrick Steinhardt
2024-05-03  6:28 ` [PATCH 4/5] cocci: apply rules to rewrite callers of "refs" interfaces Patrick Steinhardt
2024-05-03 18:48   ` Taylor Blau
2024-05-03 19:20     ` Junio C Hamano
2024-05-06  6:35       ` Patrick Steinhardt
2024-05-03  6:28 ` [PATCH 5/5] refs: remove functions without ref store Patrick Steinhardt
2024-05-06  1:15   ` James Liu
2024-05-03 17:24 ` [PATCH 0/5] " Junio C Hamano
2024-05-03 17:35   ` Jeff King
2024-05-03 18:24     ` Junio C Hamano
2024-05-06  6:44       ` Patrick Steinhardt
2024-05-06 16:14         ` Junio C Hamano
2024-05-07  5:56           ` Patrick Steinhardt [this message]
2024-05-07  6:20             ` Junio C Hamano
2024-05-07  6:30               ` Patrick Steinhardt
2024-05-07 15:46                 ` Junio C Hamano
2024-05-09 16:55         ` Jeff King
2024-05-10  5:54           ` Patrick Steinhardt
2024-05-03 18:58     ` Taylor Blau
2024-05-03 19:35       ` Junio C Hamano
2024-05-07  7:11 ` [PATCH v2 " Patrick Steinhardt
2024-05-07  7:11   ` [PATCH v2 1/5] refs: introduce missing functions that accept a `struct ref_store` Patrick Steinhardt
2024-05-07  7:11   ` [PATCH v2 2/5] refs: add `exclude_patterns` parameter to `for_each_fullref_in()` Patrick Steinhardt
2024-05-07  7:11   ` [PATCH v2 3/5] cocci: introduce rules to transform "refs" to pass ref store Patrick Steinhardt
2024-05-07  7:11   ` [PATCH v2 4/5] cocci: apply rules to rewrite callers of "refs" interfaces Patrick Steinhardt
2024-05-07  7:11   ` [PATCH v2 5/5] refs: remove functions without ref store Patrick Steinhardt
2024-05-07 17:27   ` [PATCH v2 0/5] " Taylor Blau

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=ZjnCoaVP9_wuYiHh@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.