From: Marc Branchaud <marcn...@xiplink.com>

This prepares the code to handle a true remote.default configuration value.

Rename two variables:
  default_remote_name          --> effective_remote_name
  explicit_default_remote_name --> explicit_effective_remote_name

effective_remote_name is the remote name that is currently "in effect".
This is the currently checked-out branch's remote (in which case
explicit_effective_remote_name=1), or "origin" if the branch has no remote
(or the working tree is a detached HEAD).

The next commit re-introduces default_remote_name with its new semantics.

Signed-off-by: Marc Branchaud <marcn...@xiplink.com>
---
 remote.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/remote.c b/remote.c
index 6833538..6f371e0 100644
--- a/remote.c
+++ b/remote.c
@@ -47,8 +47,8 @@ static int branches_alloc;
 static int branches_nr;
 
 static struct branch *current_branch;
-static const char *default_remote_name;
-static int explicit_default_remote_name;
+static const char *effective_remote_name;
+static int explicit_effective_remote_name;
 
 static struct rewrites rewrites;
 static struct rewrites rewrites_push;
@@ -360,8 +360,8 @@ static int handle_config(const char *key, const char 
*value, void *cb)
                                return config_error_nonbool(key);
                        branch->remote_name = xstrdup(value);
                        if (branch == current_branch) {
-                               default_remote_name = branch->remote_name;
-                               explicit_default_remote_name = 1;
+                               effective_remote_name = branch->remote_name;
+                               explicit_effective_remote_name = 1;
                        }
                } else if (!strcmp(subkey, ".merge")) {
                        if (!value)
@@ -481,9 +481,9 @@ static void read_config(void)
        unsigned char sha1[20];
        const char *head_ref;
        int flag;
-       if (default_remote_name) /* did this already */
+       if (effective_remote_name) /* did this already */
                return;
-       default_remote_name = xstrdup("origin");
+       effective_remote_name = xstrdup("origin");
        current_branch = NULL;
        head_ref = resolve_ref_unsafe("HEAD", sha1, 0, &flag);
        if (head_ref && (flag & REF_ISSYMREF) &&
@@ -680,8 +680,8 @@ struct remote *remote_get(const char *name)
        if (name)
                name_given = 1;
        else {
-               name = default_remote_name;
-               name_given = explicit_default_remote_name;
+               name = effective_remote_name;
+               name_given = explicit_effective_remote_name;
        }
 
        ret = make_remote(name, 0);
-- 
1.7.11.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to