Subject: Re: [PATCH v2 5/5] remote: announce removal of "branches/" and "remotes/"

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 7 Jan 2025 13:48:42 +0100

On Mon, Jan 06, 2025 at 07:53:46AM -0800, Junio C Hamano wrote:
> Christian Couder <[email-masked]> writes:
> 
> > What I like about the removal of git-pack-redundant(1) in the previous
> > patch is that we started to emit a user-visible warning in 2020 and
> > now users even have to pass an `--i-still-use-this` option to be able
> > to use the command. This really makes sure users cannot ignore the
> > fact that the command is deprecated.
> >
> > Accordingly I think it would be nice if we started to emit warnings
> > (that could possibly be disabled) when we find a repo still uses stuff
> > in "branches/" and "remotes/". These would be much more difficult to
> > miss or ignore than doc changes.
> 
> That's an excellent suggestion.  Even though this topic is about
> introducing breaking changes, saying "we waited for long enough",
> making sure we have prepared the user base for such changes to
> lesson the impact of "breaking" changes is a very prudent thing to
> do.
> 
> I guess everything is contained within remote.c these days?
> Patches welcome ;-)

Makes sense indeed. We can easily add for something like below diff.
I'll roll that into the next version, thanks!

Patrick

diff --git a/remote.c b/remote.c
index 55e91fab47..8c104c6ee1 100644
--- a/remote.c
+++ b/remote.c
@@ -309,6 +309,13 @@ static void read_remotes_file(struct remote_state *remote_state,
 
 	if (!f)
 		return;
+
+	warning(_("Reading remote from \"remotes/%s\", which is nominated\n"
+		  "for removal. If you still use the \"remotes/\" directory\n"
+		  "it is recommended to migrate to config-based remotes. If\n"
+		  "you cannot, please let us know you still use it by sending\n"
+		  "an e-mail to <[email-masked]>."), remote->name);
+
 	remote->configured_in_repo = 1;
 	remote->origin = REMOTE_REMOTES;
 	while (strbuf_getline(&buf, f) != EOF) {
@@ -338,6 +345,12 @@ static void read_branches_file(struct remote_state *remote_state,
 	if (!f)
 		return;
 
+	warning(_("Reading remote from \"branches/%s\", which is nominated\n"
+		  "for removal. If you still use the \"branches/\" directory\n"
+		  "it is recommended to migrate to config-based remotes. If\n"
+		  "you cannot, please let us know you still use it by sending\n"
+		  "an e-mail to <[email-masked]>."), remote->name);
+
 	strbuf_getline_lf(&buf, f);
 	fclose(f);
 	strbuf_trim(&buf);