forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> [jc: with a small tweak to the help message] Signed-off-by: Junio C Hamano <[email protected]>
- Loading branch information
Showing
9 changed files
with
99 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,6 +154,31 @@ Cf. <[email protected]>, | |
<CAKvOHKAFXQwt4D8yUCCkf_TQL79mYaJ=KAKhtpDNTvHJFuX1NA@mail.gmail.com>, | ||
<[email protected]>, | ||
|
||
* Support for storing shorthands for remote URLs in "$GIT_COMMON_DIR/branches/" | ||
and "$GIT_COMMON_DIR/remotes/" has been long superseded by storing remotes in | ||
the repository configuration. | ||
+ | ||
The mechanism has originally been introduced in f170e4b39d ([PATCH] fetch/pull: | ||
short-hand notation for remote repositories., 2005-07-16) and was superseded by | ||
6687f8fea2 ([PATCH] Use .git/remote/origin, not .git/branches/origin., | ||
2005-08-20), where we switched from ".git/branches/" to ".git/remotes/". That | ||
commit already mentions an upcoming deprecation of the ".git/branches/" | ||
directory, and starting with a1d4aa7424 (Add repository-layout document., | ||
2005-09-01) we have also marked this layout as deprecated. Eventually we also | ||
started to migrate away from ".git/remotes/" in favor of config-based remotes, | ||
and we have marked the directory as legacy in 3d3d282146 (Documentation: | ||
Grammar correction, wording fixes and cleanup, 2011-08-23) | ||
+ | ||
As our documentation mentions, these directories are not to be found in modern | ||
repositories at all and most users aren't even aware of these mechanisms. They | ||
have been deprecated for almost 20 years and 14 years respectively, and we are | ||
not aware of any active users that have complained about this deprecation. | ||
Furthermore, the ".git/branches/" directory is nowadays misleadingly named and | ||
may cause confusion as "branches" are almost exclusively used in the context of | ||
references. | ||
+ | ||
These features will be removed. | ||
|
||
== Superseded features that will not be deprecated | ||
|
||
Some features have gained newer replacements that aim to improve the design in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,13 +293,29 @@ 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)) | ||
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 <[email protected]>."), | ||
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)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters