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

Re: [PATCH 1/2] remote: pass repository to push tracking helper

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 20, 2026, 18:23 UTC
Message-ID
<xmqqfr1dcygh.fsf@gitster.g>
In-Reply-To
<fc70895732f406ecdbaea7a5b9a3fda4fb03df67.1784538618.git.gitgitgadget@gmail.com>
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 5 quoted lines
> From: Harald Nordgren <haraldnordgren@gmail.com>
>
> The push tracking helper currently only needs the push remote. However,
> resolving a URL-valued remote requires access to the repository's list
> of configured remotes.

It is unclear to me what 'resolving a URL-valued remote' means. Could you describe what you are trying to achieve, without relying on unexplained terms like 'to resolve' and 'URL-valued remote', which seem to carry specialized meanings in this context?

Thanks.
Show 57 quoted lines
> Pass the repository through the existing callers and mark the parameter
> as unused for now. This prepares the helper for that lookup without
> changing its behavior.
>
> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
> ---
>  remote.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/remote.c b/remote.c
> index e6c52c850c..89d0f9e2d8 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -1887,7 +1887,8 @@ const char *branch_get_upstream(struct branch *branch, struct strbuf *err)
>  	return branch->merge[0]->dst;
>  }
>  
> -static char *tracking_for_push_dest(struct remote *remote,
> +static char *tracking_for_push_dest(struct repository *repo UNUSED,
> +				    struct remote *remote,
>  				    const char *refname,
>  				    struct strbuf *err)
>  {
> @@ -1925,13 +1926,13 @@ static char *branch_get_push_1(struct repository *repo,
>  					 _("push refspecs for '%s' do not include '%s'"),
>  					 remote->name, branch->name);
>  
> -		ret = tracking_for_push_dest(remote, dst, err);
> +		ret = tracking_for_push_dest(repo, remote, dst, err);
>  		free(dst);
>  		return ret;
>  	}
>  
>  	if (remote->mirror)
> -		return tracking_for_push_dest(remote, branch->refname, err);
> +		return tracking_for_push_dest(repo, remote, branch->refname, err);
>  
>  	switch (push_default) {
>  	case PUSH_DEFAULT_NOTHING:
> @@ -1939,7 +1940,7 @@ static char *branch_get_push_1(struct repository *repo,
>  
>  	case PUSH_DEFAULT_MATCHING:
>  	case PUSH_DEFAULT_CURRENT:
> -		return tracking_for_push_dest(remote, branch->refname, err);
> +		return tracking_for_push_dest(repo, remote, branch->refname, err);
>  
>  	case PUSH_DEFAULT_UPSTREAM:
>  		return xstrdup_or_null(branch_get_upstream(branch, err));
> @@ -1953,7 +1954,7 @@ static char *branch_get_push_1(struct repository *repo,
>  			up = branch_get_upstream(branch, err);
>  			if (!up)
>  				return NULL;
> -			cur = tracking_for_push_dest(remote, branch->refname, err);
> +			cur = tracking_for_push_dest(repo, remote, branch->refname, err);
>  			if (!cur)
>  				return NULL;
>  			if (strcmp(cur, up)) {
Previous: Harald Nordgren via GitGitGadgetNext: Harald Nordgren via GitGitGadget
Message 3 of 23 in “remote: resolve url push tracking”
  1. 0/2 remote: resolve url push trackingHarald Nordgren via GitGitGadget, Jul 20, 2026
  2. 1/2 remote: pass repository to push tracking helperHarald Nordgren via GitGitGadget, Jul 20, 2026
  3. Junio C HamanoJul 20, 2026
  4. 2/2 remote: resolve URL-valued push tracking remotesHarald Nordgren via GitGitGadget, Jul 20, 2026
  5. Junio C HamanoJul 20, 2026
  6. Harald NordgrenJul 20, 2026
  7. Junio C HamanoJul 20, 2026
  8. Junio C HamanoJul 21, 2026
  9. 0/2 remote: renamed remote push trackingHarald Nordgren via GitGitGadget, Jul 21, 2026
  10. 1/2 remote: pass repository to push tracking helperHarald Nordgren via GitGitGadget, Jul 21, 2026
  11. 2/2 remote: find tracking branches for URL push destinationsHarald Nordgren via GitGitGadget, Jul 21, 2026
  12. D. Ben KnobleJul 21, 2026
  13. Harald NordgrenJul 21, 2026
  14. 0/2 remote: url-based pushRemote with renamed remotesHarald Nordgren via GitGitGadget, Jul 21, 2026
  15. 1/2 remote: pass repository to push tracking helperHarald Nordgren via GitGitGadget, Jul 21, 2026
  16. 2/2 remote: find tracking branches for URL push destinationsHarald Nordgren via GitGitGadget, Jul 21, 2026
  17. Junio C HamanoJul 21, 2026
  18. Ben KnobleJul 22, 2026
  19. 0/2 remote: url-based pushRemote with renamed remotesHarald Nordgren via GitGitGadget, Jul 22, 2026
  20. 1/2 remote: pass repository to push tracking helperHarald Nordgren via GitGitGadget, Jul 22, 2026
  21. 2/2 remote: find tracking branches for URL push destinationsHarald Nordgren via GitGitGadget, Jul 22, 2026
  22. Junio C HamanoJul 22, 2026
  23. Junio C HamanoJul 23, 2026

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.