git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 0/5] remote: announce removal of "branches/" and "remotes/"

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 22, 2025, 11:31 UTC
Message-ID
<20250122-pks-remote-branches-deprecation-v4-0-5cbf5b28afd5@pks.im>
In-Reply-To
<20241211-pks-remote-branches-deprecation-v1-0-1431e2369135@pks.im>
Hi,

back when Git was in its infancy, remotes were configured via separate files in "branches/" (back in 2005). Later that year we introduced a more powerful mechanism with the "remotes/" directory. These mechanism have eventually been superseded 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.

This patch series follows through with the deprecation of these and announces them for removal in Git 3.0. Furthermore, it creates the infra to compile Git with such breaking changes enabled and wires up a CI job both for GitHub and GitLab to test those breaking changes.

The series is based on top caacdb5dfd (The fifteenth batch, 2024-12-10) with ps/build at 904339edbd (Introduce support for the Meson build system, 2024-12-06) merged into it.

Changes in v2:
- Some small fixes to the deprecation notice of "branches/" and
  "remotes/".
- Some small fixes to commit messages.
- Link to v1: https://lore.kernel.org/r/20241211-pks-remote-branches-deprecation-v1-0-1431e2369135@pks.im
Changes in v3:
- Print warnings when reading remotes from "remotes/" or "branches/".
- A couple of commit mesasge improvements.
- Link to v2: https://lore.kernel.org/r/20250106-pks-remote-branches-deprecation-v2-0-2ce87c053536@pks.im
Changes in v4:
- Add migration instructions to the warning when reading deprecated
  remote types.
- Clarify the deprecation text a bit.
- Link to v3: https://lore.kernel.org/r/20250120-pks-remote-branches-deprecation-v3-0-c7e539b6a84f@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (5):
      Makefile: wire up build option for deprecated features
      ci: merge linux-gcc-default into linux-gcc
      ci: repurpose "linux-gcc" job for deprecations
      builtin/pack-redundant: remove subcommand with breaking changes
      remote: announce removal of "branches/" and "remotes/"
 .github/workflows/main.yml             |  6 +----
 .gitlab-ci.yml                         |  6 +----
 Documentation/BreakingChanges.txt      | 25 ++++++++++++++++++
 Documentation/gitrepository-layout.txt |  7 +++--
 GIT-BUILD-OPTIONS.in                   |  1 +
 Makefile                               |  7 +++++
 builtin/remote.c                       |  2 ++
 ci/lib.sh                              |  5 ----
 ci/run-build-and-tests.sh              |  3 ++-
 contrib/buildsystems/CMakeLists.txt    |  1 +
 git.c                                  |  2 ++
 meson.build                            |  6 +++++
 meson_options.txt                      |  2 ++
 remote.c                               | 26 +++++++++++++++++++
 remote.h                               |  2 ++
 t/t5323-pack-redundant.sh              |  6 +++++
 t/t5505-remote.sh                      |  6 ++---
 t/t5510-fetch.sh                       | 13 ++++------
 t/t5515-fetch-merge-logic.sh           | 47 ++++++++++++++++++----------------
 t/t5516-fetch-push.sh                  | 14 +++++-----
 t/test-lib.sh                          |  4 +++
 21 files changed, 132 insertions(+), 59 deletions(-)
Range-diff versus v3:
1:  c9ab464545 = 1:  b72e562c5a Makefile: wire up build option for deprecated features
2:  992c55543e = 2:  a6c0aa40f0 ci: merge linux-gcc-default into linux-gcc
3:  e9d9721fbf = 3:  c4aa9d092b ci: repurpose "linux-gcc" job for deprecations
4:  2588dff0f8 = 4:  7977a853ef builtin/pack-redundant: remove subcommand with breaking changes
5:  671a527782 ! 5:  c607948f6a remote: announce removal of "branches/" and "remotes/"
    @@ Documentation/BreakingChanges.txt: Cf. <xmqq1rjuz6n3.fsf_-_@gitster.c.googlers.c
     +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 reason why anybody would want to use these mechanisms.
    ++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.
    @@ remote.c: static void add_instead_of(struct rewrite *rewrite, const char *instea
      static const char *skip_spaces(const char *s)
      {
      	while (isspace(*s))
    +@@ remote.c: 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 you still use it by sending an\n"
    ++		  "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)
    + {
     @@ remote.c: 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 <git@vger.kernel.org>."), remote->name);
    ++	warn_about_deprecated_remote_type("remotes", remote);
     +
      	remote->configured_in_repo = 1;
      	remote->origin = REMOTE_REMOTES;
    @@ remote.c: 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 <git@vger.kernel.org>."), remote->name);
    ++	warn_about_deprecated_remote_type("branches", remote);
     +
      	strbuf_getline_lf(&buf, f);
      	fclose(f);

--- base-commit: 713ec79a9091cec60b110d605b418904759982ab change-id: 20241205-pks-remote-branches-deprecation-037a4389a377

Previous: Junio C HamanoNext: Patrick Steinhardt
Message 36 of 47 in “remote: announce removal of "branches/" and "remotes/"”
  1. 0/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Dec 11, 2024
  2. 1/5 Makefile: wire up build option for deprecated featuresPatrick Steinhardt, Dec 11, 2024
  3. Kristoffer HaugsbakkDec 11, 2024
  4. Patrick SteinhardtDec 13, 2024
  5. 2/5 ci: merge linux-gcc-default into linux-gccPatrick Steinhardt, Dec 11, 2024
  6. 3/5 ci: repurpose "linux-gcc" job for deprecationsPatrick Steinhardt, Dec 11, 2024
  7. 4/5 builtin/pack-redundant: remove subcommand with breaking changesPatrick Steinhardt, Dec 11, 2024
  8. 5/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Dec 11, 2024
  9. 0/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Jan 6, 2025
  10. 1/5 Makefile: wire up build option for deprecated featuresPatrick Steinhardt, Jan 6, 2025
  11. Christian CouderJan 6, 2025
  12. Christian CouderJan 6, 2025
  13. 2/5 ci: merge linux-gcc-default into linux-gccPatrick Steinhardt, Jan 6, 2025
  14. Christian CouderJan 6, 2025
  15. Junio C HamanoJan 6, 2025
  16. Patrick SteinhardtJan 7, 2025
  17. Christian CouderJan 7, 2025
  18. 3/5 ci: repurpose "linux-gcc" job for deprecationsPatrick Steinhardt, Jan 6, 2025
  19. 4/5 builtin/pack-redundant: remove subcommand with breaking changesPatrick Steinhardt, Jan 6, 2025
  20. 5/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Jan 6, 2025
  21. Christian CouderJan 6, 2025
  22. Junio C HamanoJan 6, 2025
  23. Patrick SteinhardtJan 7, 2025
  24. Junio C HamanoJan 7, 2025
  25. Junio C HamanoJan 7, 2025
  26. rsbecker@nexbridge.comJan 7, 2025
  27. Patrick SteinhardtJan 8, 2025
  28. Junio C HamanoJan 8, 2025
  29. Patrick SteinhardtJan 9, 2025
  30. Robert CoupJan 9, 2025
  31. Patrick SteinhardtJan 9, 2025
  32. Junio C HamanoJan 9, 2025
  33. Junio C HamanoJan 6, 2025
  34. Patrick SteinhardtJan 7, 2025
  35. Junio C HamanoJan 7, 2025
  36. 0/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Jan 22, 2025
  37. 1/5 Makefile: wire up build option for deprecated featuresPatrick Steinhardt, Jan 22, 2025
  38. 2/5 ci: merge linux-gcc-default into linux-gccPatrick Steinhardt, Jan 22, 2025
  39. 3/5 ci: repurpose "linux-gcc" job for deprecationsPatrick Steinhardt, Jan 22, 2025
  40. 4/5 builtin/pack-redundant: remove subcommand with breaking changesPatrick Steinhardt, Jan 22, 2025
  41. 5/5 remote: announce removal of "branches/" and "remotes/"Patrick Steinhardt, Jan 22, 2025
  42. Junio C HamanoJan 22, 2025
  43. Jakub WilkFeb 21, 2025
  44. Junio C HamanoFeb 21, 2025
  45. Patrick SteinhardtFeb 25, 2025
  46. Junio C HamanoFeb 25, 2025
  47. Patrick SteinhardtFeb 26, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.