Skip to content

Commit 050f76b

Browse files
felipecgitster
authored andcommitted
push: rename !triangular to same_remote
The typical case is what git was designed for: distributed remotes. It's only the atypical case--fetching and pushing to the same remote--that we need to keep an eye on. No functional changes. Liked-by: Junio C Hamano <[email protected]> Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48bf2fa commit 050f76b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

builtin/push.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static const char message_detached_head_die[] =
186186
" git push %s HEAD:<name-of-remote-branch>\n");
187187

188188
static void setup_push_upstream(struct remote *remote, struct branch *branch,
189-
int triangular, int simple)
189+
int same_remote, int simple)
190190
{
191191
if (!branch)
192192
die(_(message_detached_head_die), remote->name);
@@ -201,7 +201,7 @@ static void setup_push_upstream(struct remote *remote, struct branch *branch,
201201
if (branch->merge_nr != 1)
202202
die(_("The current branch %s has multiple upstream branches, "
203203
"refusing to push."), branch->name);
204-
if (triangular)
204+
if (!same_remote)
205205
die(_("You are pushing to remote '%s', which is not the upstream of\n"
206206
"your current branch '%s', without telling me what to push\n"
207207
"to update which remote branch."),
@@ -223,16 +223,16 @@ static void setup_push_current(struct remote *remote, struct branch *branch)
223223
refspec_appendf(&rs, "%s:%s", branch->refname, branch->refname);
224224
}
225225

226-
static int is_workflow_triangular(struct remote *remote)
226+
static int is_same_remote(struct remote *remote)
227227
{
228228
struct remote *fetch_remote = remote_get(NULL);
229-
return (fetch_remote && fetch_remote != remote);
229+
return (!fetch_remote || fetch_remote == remote);
230230
}
231231

232232
static void setup_default_push_refspecs(struct remote *remote)
233233
{
234234
struct branch *branch = branch_get(NULL);
235-
int triangular = is_workflow_triangular(remote);
235+
int same_remote = is_same_remote(remote);
236236

237237
switch (push_default) {
238238
default:
@@ -242,14 +242,14 @@ static void setup_default_push_refspecs(struct remote *remote)
242242

243243
case PUSH_DEFAULT_UNSPECIFIED:
244244
case PUSH_DEFAULT_SIMPLE:
245-
if (triangular)
245+
if (!same_remote)
246246
setup_push_current(remote, branch);
247247
else
248-
setup_push_upstream(remote, branch, triangular, 1);
248+
setup_push_upstream(remote, branch, same_remote, 1);
249249
break;
250250

251251
case PUSH_DEFAULT_UPSTREAM:
252-
setup_push_upstream(remote, branch, triangular, 0);
252+
setup_push_upstream(remote, branch, same_remote, 0);
253253
break;
254254

255255
case PUSH_DEFAULT_CURRENT:

0 commit comments

Comments
 (0)