diff mbox series

[15/15] push: rename !triangular to same_remote

Message ID 20210529074458.1916817-16-felipe.contreras@gmail.com (mailing list archive)
State Superseded
Headers show
Series Unconvolutize push.default=simple | expand

Commit Message

Felipe Contreras May 29, 2021, 7:44 a.m. UTC
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.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 builtin/push.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Junio C Hamano May 31, 2021, 7:54 a.m. UTC | #1
Felipe Contreras <felipe.contreras@gmail.com> writes:

> 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.

Yup.  Avoiding the phrase "centralized" and using "same_remote"
makes quite a lot of sense, too.

Overall the end-result of the series is quite pleasant read, even
though some intermediate states in the middle risked readers to
worry about "are we going in the right direction?"

Well done.
diff mbox series

Patch

diff --git a/builtin/push.c b/builtin/push.c
index 2f30a97b97..f1ac531252 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -206,7 +206,7 @@  static void setup_default_push_refspecs(struct remote *remote)
 {
 	struct branch *branch;
 	const char *dst;
-	int triangular;
+	int same_remote;
 
 	switch (push_default) {
 	case PUSH_DEFAULT_MATCHING:
@@ -225,20 +225,20 @@  static void setup_default_push_refspecs(struct remote *remote)
 		die(_(message_detached_head_die), remote->name);
 
 	dst = branch->refname;
-	triangular = strcmp(remote->name, remote_for_branch(branch, NULL));
+	same_remote = !strcmp(remote->name, remote_for_branch(branch, NULL));
 
 	switch (push_default) {
 	default:
 	case PUSH_DEFAULT_UNSPECIFIED:
 	case PUSH_DEFAULT_SIMPLE:
-		if (triangular)
+		if (!same_remote)
 			break;
 		if (strcmp(branch->refname, get_upstream_ref(branch, remote->name)))
 			die_push_simple(branch, remote);
 		break;
 
 	case PUSH_DEFAULT_UPSTREAM:
-		if (triangular)
+		if (!same_remote)
 			die(_("You are pushing to remote '%s', which is not the upstream of\n"
 			      "your current branch '%s', without telling me what to push\n"
 			      "to update which remote branch."),