RE: [PATCH v2 5/5] remote: announce removal of "branches/" and "remotes/"
- From
rsbecker@nexbridge.com <rsbecker@nexbridge.com>
- Date
- Jan 7, 2025, 16:55 UTC
- Message-ID
- <006701db6124$f16f9420$d44ebc60$@nexbridge.com>
- In-Reply-To
- <xmqq4j2avaam.fsf@gitster.g>
On January 7, 2025 11:50 AM, Junio C Hamano wrote:
Show 14 quoted lines
>Junio C Hamano <gitster@pobox.com> writes: > >> Patrick Steinhardt <ps@pks.im> writes: >> >>> Makes sense indeed. We can easily add for something like below diff. >>> I'll roll that into the next version, thanks! >> >> It is a good start, but is probably a bit too noisy. Can we make them >> appear ONLY when the definitions read from these older sources are >> actually USED? >> >> Thanks. > >Something along this line is what I had in mind. Not even compile tested,
and I am
>not claiming that all the uses of remote will go thourgh the code paths to
use it with
Show 12 quoted lines
>a transport, but you hopefully got the idea. > > remote.c | 20 ++++++++++++++++++++ > remote.h | 2 ++ > transport.c | 2 ++ > 3 files changed, 24 insertions(+) > >diff --git c/remote.c w/remote.c >index f43cf5e7a4..1cca98215d 100644 >--- c/remote.c >+++ w/remote.c >@@ -2904,3 +2904,23 @@ char *relative_url(const char *remote_url, const
char
Show 29 quoted lines
>*url,
> free(out);
> return strbuf_detach(&sb, NULL);
> }
>+
>+void remote_stale_warning(const struct remote *remote) {
>+ const char *msg;
>+
>+ switch (remote->origin) {
>+ case REMOTE_REMOTES:
>+ msg = N_("Using remote '%s' read from the .git/remotes, "
>+ "whose support will be removed");
>+ break;
>+ case REMOTE_BRANCHES:
>+ msg = N_("Using remote '%s' read from the .git/branches, "
>+ "whose support will be removed");
>+ break;
>+ default:
>+ return;
>+ }
>+
>+ warning(_(msg), remote->name);
>+}
>diff --git c/remote.h w/remote.h
>index b901b56746..e29ceef3e4 100644
>--- c/remote.h
>+++ w/remote.h
>@@ -445,4 +445,6 @@ void apply_push_cas(struct push_cas_option *, struct
>remote *, struct ref *); char *relative_url(const char *remote_url, constchar *url,
Show 10 quoted lines
> const char *up_path); > >+void remote_stale_warning(const struct remote *remote); >+ > #endif >diff --git c/transport.c w/transport.c >index 12cc5b4d96..c153be9100 100644 >--- c/transport.c >+++ w/transport.c >@@ -1131,6 +1131,8 @@ struct transport *transport_get(struct remote
*remote,
Show 9 quoted lines
>const char *url) > ret->remote = remote; > helper = remote->foreign_vcs; > >+ remote_stale_warning(remote); >+ > if (!url) > url = remote->url.v[0]; > ret->url = url;
I like this but wonder whether there might be some way to inhibit the warnings one a user gets it and decides they will act but do not want to see the warnings any longer? I have had requests like this on other products. Just a thought.