remote: pass repository to push tracking helper
The next commit needs tracking_for_push_dest() to inspect the repository's configured remotes. Pass the repository through the existing callers and mark the new parameter as unused. No change in behavior. Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Harald Nordgren committed
Jul 22, 2026 at 18:08 UTC
8391f01768864373d27cf7b1267ea69d54675cf6
1 file changed
+6
-5
remote.c
+6
-5
@@ -1887,7 +1887,8 @@ const char *branch_get_upstream(struct branch *branch, struct strbuf *err)
1887
return branch->merge[0]->dst;
1888
}
1889
1890
-static char *tracking_for_push_dest(struct remote *remote,
1890
+static char *tracking_for_push_dest(struct repository *repo UNUSED,
1891
+ struct remote *remote,
1892
const char *refname,
1893
struct strbuf *err)
1894
{
@@ -1925,13 +1926,13 @@ static char *branch_get_push_1(struct repository *repo,
1926
_("push refspecs for '%s' do not include '%s'"),
1927
remote->name, branch->name);
1928
1928
- ret = tracking_for_push_dest(remote, dst, err);
1929
+ ret = tracking_for_push_dest(repo, remote, dst, err);
1930
free(dst);
1931
return ret;
1932
}
1933
1934
if (remote->mirror)
1934
- return tracking_for_push_dest(remote, branch->refname, err);
1935
+ return tracking_for_push_dest(repo, remote, branch->refname, err);
1936
1937
switch (push_default) {
1938
case PUSH_DEFAULT_NOTHING:
@@ -1939,7 +1940,7 @@ static char *branch_get_push_1(struct repository *repo,
1940
1941
case PUSH_DEFAULT_MATCHING:
1942
case PUSH_DEFAULT_CURRENT:
1942
- return tracking_for_push_dest(remote, branch->refname, err);
1943
+ return tracking_for_push_dest(repo, remote, branch->refname, err);
1944
1945
case PUSH_DEFAULT_UPSTREAM:
1946
return xstrdup_or_null(branch_get_upstream(branch, err));
@@ -1953,7 +1954,7 @@ static char *branch_get_push_1(struct repository *repo,
1954
up = branch_get_upstream(branch, err);
1955
if (!up)
1956
return NULL;
1956
- cur = tracking_for_push_dest(remote, branch->refname, err);
1957
+ cur = tracking_for_push_dest(repo, remote, branch->refname, err);
1958
if (!cur)
1959
return NULL;
1960
if (strcmp(cur, up)) {