From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Mathew George <mathewegeorge@gmail.com>, git@vger.kernel.org
Subject: [PATCH 0/11] allow overriding remote.*.url
Date: Fri, 14 Jun 2024 06:24:39 -0400	[thread overview]
Message-ID: <20240614102439.GA222287@coredump.intra.peff.net> (raw)
In-Reply-To: <20240613102409.GE817573@coredump.intra.peff.net>
On Thu, Jun 13, 2024 at 06:24:09AM -0400, Jeff King wrote:
> > I was expecting (with excitement) a mess, but the above is as clean
> > as we can make the idea, I would say.  Lack of documentation and
> > tests do count as incompleteness though of course.
> 
> Yeah, and we should probably do the same for pushurl. And I think there
> could be some cleanup of the memory ownership handling of add_url().
So as always with this crufty 2009-era code, there turned out to be some
subtleties. ;)
The good news is that I think dealing with them left the code in a
better place. It's easier to reason about, and a few possible leaks have
been plugged (I don't know if they were triggered in the test suite or
not; if so they weren't enough to tip any scripts over to being
leak-free).
We can split the series into segments:
  [01/11]: archive: fix check for missing url
    A nearby trivial bugfix.
  [02/11]: remote: refactor alias_url() memory ownership
  [03/11]: remote: transfer ownership of memory in add_url(), etc
  [04/11]: remote: use strvecs to store remote url/pushurl
  [05/11]: remote: simplify url/pushurl selection
    Fixing memory handling weirdness, which is a necessary prereq for
    the "reset" operation to avoid leaking. The switch to using a strvec
    isn't strictly necessary, but it does make the code (including the
    later patch 7) simpler.
  [06/11]: config: document remote.*.url/pushurl interaction
  [07/11]: remote: allow resetting url list
    The actual change is in patch 7 here, but it was hard to add new
    docs to the rather anemic existing ones. Hence patch 6.
  [08/11]: t5801: make remote-testgit GIT_DIR setup more robust
  [09/11]: t5801: test remote.*.vcs config
  [10/11]: remote: always require at least one url in a remote
  [11/11]: remote: drop checks for zero-url case
    This is a related cleanup I found while working in the area.
    Arguably it could be a separate topic, though it does depend
    textually on what came before.
 Documentation/config/remote.txt | 11 +++-
 builtin/archive.c               |  4 +-
 builtin/clone.c                 |  4 +-
 builtin/ls-remote.c             |  6 +--
 builtin/push.c                  | 28 ++--------
 builtin/remote.c                | 88 +++++++++---------------------
 remote-curl.c                   |  2 +-
 remote.c                        | 94 ++++++++++++++++++---------------
 remote.h                        | 13 ++---
 t/helper/test-bundle-uri.c      |  2 -
 t/t5505-remote.sh               | 36 +++++++++++++
 t/t5801-remote-helpers.sh       | 23 ++++++++
 t/t5801/git-remote-nourl        |  3 ++
 t/t5801/git-remote-testgit      |  3 +-
 transport.c                     | 19 +++----
 15 files changed, 174 insertions(+), 162 deletions(-)
 create mode 100755 t/t5801/git-remote-nourl
-Peff
next prev parent reply	other threads:[~2024-06-14 10:24 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-09  6:51 Cannot override `remote.origin.url` with `-c` option Mathew George
2024-06-11  7:51 ` Jeff King
2024-06-11 15:28   ` Junio C Hamano
2024-06-13 10:24     ` Jeff King
2024-06-14 10:24       ` Jeff King [this message]
2024-06-14 10:25         ` [PATCH 01/11] archive: fix check for missing url Jeff King
2024-06-14 10:26         ` [PATCH 02/11] remote: refactor alias_url() memory ownership Jeff King
2024-06-14 17:05           ` Junio C Hamano
2024-06-14 10:27         ` [PATCH 03/11] remote: transfer ownership of memory in add_url(), etc Jeff King
2024-06-14 17:04           ` Junio C Hamano
2024-06-16  4:59             ` Jeff King
2024-06-17 17:42               ` Junio C Hamano
2024-06-25 17:30           ` Elijah Newren
2024-06-14 10:28         ` [PATCH 04/11] remote: use strvecs to store remote url/pushurl Jeff King
2024-06-25 17:32           ` Elijah Newren
2024-06-14 10:29         ` [PATCH 05/11] remote: simplify url/pushurl selection Jeff King
2024-06-25 17:33           ` Elijah Newren
2024-06-14 10:30         ` [PATCH 06/11] config: document remote.*.url/pushurl interaction Jeff King
2024-06-25 17:34           ` Elijah Newren
2024-06-14 10:31         ` [PATCH 07/11] remote: allow resetting url list Jeff King
2024-06-25 17:35           ` Elijah Newren
2024-06-14 10:31         ` [PATCH 08/11] t5801: make remote-testgit GIT_DIR setup more robust Jeff King
2024-06-25 17:36           ` Elijah Newren
2024-06-14 10:34         ` [PATCH 09/11] t5801: test remote.*.vcs config Jeff King
2024-06-14 10:37         ` [PATCH 10/11] remote: always require at least one url in a remote Jeff King
2024-06-14 10:42         ` [PATCH 11/11] remote: drop checks for zero-url case Jeff King
2024-06-25 17:37           ` Elijah Newren
2024-06-25 17:44         ` [PATCH 0/11] allow overriding remote.*.url Elijah Newren
2024-06-26 20:40           ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=20240614102439.GA222287@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mathewegeorge@gmail.com \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).