From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH 0/5] refs: remove functions without ref store
Date: Fri, 3 May 2024 13:35:53 -0400 [thread overview]
Message-ID: <20240503173553.GC3631237@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqikzu95cf.fsf@gitster.g>
On Fri, May 03, 2024 at 10:24:00AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > It is quite likely that this patch series will impact in-flight patch
> > series. I'd be quite happy to drop the last patch that removes the old
> > interfaces to make this a bit less painful.
>
> The last step could replace these deprecated-to-be-removed functions
> with a stub that BUG()s out [*], with a comment to instruct how a
> caller can be rewritten to use the corresponding refs_ variant with
> a call to get_main_ref_store(the_repository) as the first parameter,
> which would help out of tree and in-flight series to migrate.
>
> [Footnote]
>
> * The exact mechanism to cause an attempted use of an old function
> fail is immaterial. We can remove the definition of these
> functions while retaining the old implementation as comments, or
> wrap them in an #ifdef USE_REF_STORE_LESS_FUNCTIONS .. #endif
> pair _without_ defining USE_REF_STORE_LESS_FUNCTIONS, purely for
> the documentation value to help us migration.
I prefer strict removal, as then the problem is caught by the compiler,
rather than runtime/tests. The error message does not point the user in
the right direction, but IMHO that is trumped by finding it sooner in
the edit-compile-test cycle.
Though maybe an even more radical proposal: now that read_ref_full(),
etc, are gone, and we have only refs_read_ref_full(), could/should we
shorten the latter to drop the "refs_" prefix? Its original purpose of
distinguishing the "takes a ref store vs using the_repository" variants
is now done, and shorter names are less annoying. But:
- maybe there is value in having ref-related functions namespaced? We
certainly don't cover all ref functions here, though, and aside from
tight OO-ish APIs (e.g. strbuf) we don't usually do so at all.
- the error message for in-flight callers of the "old" names will be
even more confusing (it will not be "foo() does not exist" but
rather "you did not pass enough arguments to foo()").
-Peff
next prev parent reply other threads:[~2024-05-03 17:36 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 [this message]
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
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240503173553.GC3631237@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ps@pks.im \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).