diff options
| author | Jeff King <peff@peff.net> | 2024-06-14 06:28:01 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-14 09:34:38 -0700 |
| commit | 8e804415fd3183f56ced0dcc168f8cb4aa790473 (patch) | |
| tree | d5a44014ca781a900782abe13218f3bfec2440ed /builtin/push.c | |
| parent | 52595c155a66076020a42197c10a32086d7c4ada (diff) | |
| download | git-8e804415fd3183f56ced0dcc168f8cb4aa790473.tar.xz | |
remote: use strvecs to store remote url/pushurl
Now that the url/pushurl fields of "struct remote" own their strings, we
can switch from bare arrays to strvecs. This has a few advantages:
- push/clear are now one-liners
- likewise the free+assigns in alias_all_urls() can use
strvec_replace()
- we now use size_t for storage, avoiding possible overflow
- this will enable some further cleanups in future patches
There's quite a bit of fallout in the code that reads these fields, as
it tends to access these arrays directly. But it's mostly a mechanical
replacement of "url_nr" with "url.nr", and "url[i]" with "url.v[i]",
with a few variations (e.g. "*url" could become "*url.v", but I used
"url.v[0]" for consistency).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
| -rw-r--r-- | builtin/push.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/push.c b/builtin/push.c index 2fbb31c3ad..61b5d3afdd 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -143,12 +143,12 @@ static void set_refspecs(const char **refs, int nr, const char *repo) static int push_url_of_remote(struct remote *remote, const char ***url_p) { - if (remote->pushurl_nr) { - *url_p = remote->pushurl; - return remote->pushurl_nr; + if (remote->pushurl.nr) { + *url_p = remote->pushurl.v; + return remote->pushurl.nr; } - *url_p = remote->url; - return remote->url_nr; + *url_p = remote->url.v; + return remote->url.nr; } static NORETURN void die_push_simple(struct branch *branch, |
