diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-01-22 12:31:33 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-01-24 08:08:56 -0800 |
| commit | 8ccc75c2452b5814d2445d60d54266293ca48674 (patch) | |
| tree | 9efd49c1295b4afe1cdd049242b46ef53f9de245 /remote.c | |
| parent | builtin/pack-redundant: remove subcommand with breaking changes (diff) | |
| download | git-8ccc75c2452b5814d2445d60d54266293ca48674.tar.gz git-8ccc75c2452b5814d2445d60d54266293ca48674.zip | |
remote: announce removal of "branches/" and "remotes/"
Back when Git was in its infancy, remotes were configured via separate
files in "branches/" (back in 2005). This mechanism was replaced later
that year with the "remotes/" directory. Both mechanisms have eventually
been replaced by config-based remotes, and it is very unlikely that
anybody still uses these directories to configure their remotes.
Both of these directories have been marked as deprecated, one in 2005
and the other one in 2011. Follow through with the deprecation and
finally announce the removal of these features in Git 3.0.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
[jc: with a small tweak to the help message]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
| -rw-r--r-- | remote.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -293,6 +293,7 @@ static void add_instead_of(struct rewrite *rewrite, const char *instead_of) rewrite->instead_of_nr++; } +#ifndef WITH_BREAKING_CHANGES static const char *skip_spaces(const char *s) { while (isspace(*s)) @@ -300,6 +301,21 @@ static const char *skip_spaces(const char *s) return s; } +static void warn_about_deprecated_remote_type(const char *type, + const struct remote *remote) +{ + warning(_("reading remote from \"%s/%s\", which is nominated for removal.\n" + "\n" + "If you still use the \"remotes/\" directory it is recommended to\n" + "migrate to config-based remotes:\n" + "\n" + "\tgit remote rename %s %s\n" + "\n" + "If you cannot, please let us know why you still need to use it by\n" + "sending an e-mail to <git@vger.kernel.org>."), + type, remote->name, remote->name, remote->name); +} + static void read_remotes_file(struct remote_state *remote_state, struct remote *remote) { @@ -308,6 +324,9 @@ static void read_remotes_file(struct remote_state *remote_state, if (!f) return; + + warn_about_deprecated_remote_type("remotes", remote); + remote->configured_in_repo = 1; remote->origin = REMOTE_REMOTES; while (strbuf_getline(&buf, f) != EOF) { @@ -337,6 +356,8 @@ static void read_branches_file(struct remote_state *remote_state, if (!f) return; + warn_about_deprecated_remote_type("branches", remote); + strbuf_getline_lf(&buf, f); fclose(f); strbuf_trim(&buf); @@ -374,6 +395,7 @@ static void read_branches_file(struct remote_state *remote_state, strbuf_release(&buf); free(to_free); } +#endif /* WITH_BREAKING_CHANGES */ static int handle_config(const char *key, const char *value, const struct config_context *ctx, void *cb) @@ -572,6 +594,7 @@ static void read_config(struct repository *repo, int early) alias_all_urls(repo->remote_state); } +#ifndef WITH_BREAKING_CHANGES static int valid_remote_nick(const char *name) { if (!name[0] || is_dot_or_dotdot(name)) @@ -583,6 +606,7 @@ static int valid_remote_nick(const char *name) return 0; return 1; } +#endif /* WITH_BREAKING_CHANGES */ static const char *remotes_remote_for_branch(struct remote_state *remote_state, struct branch *branch, @@ -725,12 +749,14 @@ remotes_remote_get_1(struct remote_state *remote_state, const char *name, &name_given); ret = make_remote(remote_state, name, 0); +#ifndef WITH_BREAKING_CHANGES if (valid_remote_nick(name) && have_git_dir()) { if (!valid_remote(ret)) read_remotes_file(remote_state, ret); if (!valid_remote(ret)) read_branches_file(remote_state, ret); } +#endif /* WITH_BREAKING_CHANGES */ if (name_given && !valid_remote(ret)) add_url_alias(remote_state, ret, name); if (!valid_remote(ret)) |
