summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-03-03 16:12:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-03 22:56:05 (GMT)
commitaf8ccd8ade1e2dd1bf332067b98dd4459e29c1d3 (patch)
tree480dc5d3ae79acb6b50b826fb3b3c6ab22ffa3d3 /remote.c
parent2f268890c2cd2f115424936bbee27f8269080e5e (diff)
downloadgit-af8ccd8ade1e2dd1bf332067b98dd4459e29c1d3.zip
git-af8ccd8ade1e2dd1bf332067b98dd4459e29c1d3.tar.gz
git-af8ccd8ade1e2dd1bf332067b98dd4459e29c1d3.tar.bz2
remote: drop "explicit" parameter from remote_ref_for_branch()
Commit 9700fae5ee (for-each-ref: let upstream/push report the remote ref name, 2017-11-07) added a remote_ref_for_branch() helper, which is modeled after remote_for_branch(). This includes providing an "explicit" out-parameter that tells the caller whether the remote was configured by the user, or whether we picked a default name like "origin". But unlike remote names, there is no default name when the user didn't configure one. The only way the "explicit" parameter is used by the caller is to use the value returned from the helper when it is set, and use an empty string otherwise, ignoring the returned value from the helper. Let's drop the "explicit" out-parameter, and return NULL when the returned value from the helper should be ignored, to simplify the function interface. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Damien Robert <damien.olivier.robert+git@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/remote.c b/remote.c
index 593ce29..c43196e 100644
--- a/remote.c
+++ b/remote.c
@@ -516,14 +516,11 @@ const char *pushremote_for_branch(struct branch *branch, int *explicit)
return remote_for_branch(branch, explicit);
}
-const char *remote_ref_for_branch(struct branch *branch, int for_push,
- int *explicit)
+const char *remote_ref_for_branch(struct branch *branch, int for_push)
{
if (branch) {
if (!for_push) {
if (branch->merge_nr) {
- if (explicit)
- *explicit = 1;
return branch->merge_name[0];
}
} else {
@@ -534,15 +531,11 @@ const char *remote_ref_for_branch(struct branch *branch, int for_push,
if (remote && remote->push.nr &&
(dst = apply_refspecs(&remote->push,
branch->refname))) {
- if (explicit)
- *explicit = 1;
return dst;
}
}
}
- if (explicit)
- *explicit = 0;
- return "";
+ return NULL;
}
static struct remote *remote_get_1(const char *name,