Merge branch 'jk/remote-wo-url'

Memory ownership rules for the in-core representation of
remote.*.url configuration values have been straightened out, which
resulted in a few leak fixes and code clarification.

* jk/remote-wo-url:
  remote: drop checks for zero-url case
  remote: always require at least one url in a remote
  t5801: test remote.*.vcs config
  t5801: make remote-testgit GIT_DIR setup more robust
  remote: allow resetting url list
  config: document remote.*.url/pushurl interaction
  remote: simplify url/pushurl selection
  remote: use strvecs to store remote url/pushurl
  remote: transfer ownership of memory in add_url(), etc
  remote: refactor alias_url() memory ownership
  archive: fix check for missing url
This commit is contained in:
Junio C Hamano
2024-07-02 09:59:01 -07:00
15 changed files with 174 additions and 162 deletions

View File

@ -4,6 +4,7 @@
#include "hash.h"
#include "hashmap.h"
#include "refspec.h"
#include "strvec.h"
struct option;
struct transport_ls_refs_options;
@ -68,16 +69,9 @@ struct remote {
char *foreign_vcs;
/* An array of all of the url_nr URLs configured for the remote */
const char **url;
int url_nr;
int url_alloc;
struct strvec url;
/* An array of all of the pushurl_nr push URLs configured for the remote */
const char **pushurl;
int pushurl_nr;
int pushurl_alloc;
struct strvec pushurl;
struct refspec push;
@ -129,6 +123,7 @@ typedef int each_remote_fn(struct remote *remote, void *priv);
int for_each_remote(each_remote_fn fn, void *priv);
int remote_has_url(struct remote *remote, const char *url);
struct strvec *push_url_of_remote(struct remote *remote);
struct ref_push_report {
const char *ref_name;