@matheusbsbs / matheus-bagliano / commits / 53c403116a
Fork 0

push.default: Rename 'tracking' to 'upstream'

Users are sometimes confused with two different types of "tracking" behavior in Git: "remote-tracking" branches (e.g. refs/remotes/*/*) versus the merge/rebase relationship between a local branch and its @{upstream} (controlled by branch.foo.remote and branch.foo.merge config settings). When the push.default is set to 'tracking', it specifies that a branch should be pushed to its @{upstream} branch. In other words, setting push.default to 'tracking' applies only to the latter of the above two types of "tracking" behavior. In order to make this more understandable to the user, we rename the push.default == 'tracking' option to push.default == 'upstream'. push.default == 'tracking' is left as a deprecated synonym for 'upstream'. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johan Herland committed Feb 16, 2011 at 01:54 UTC 53c403116a947c538132fc721f83196036f7a299
4 files changed +12 -9
Documentation/config.txt
+2 -1
@@ -1591,7 +1591,8 @@ push.default::
1591 * `matching` - push all matching branches.
1592 All branches having the same name in both ends are considered to be
1593 matching. This is the default.
1594 -* `tracking` - push the current branch to its upstream branch.
1594 +* `upstream` - push the current branch to its upstream branch.
1595 +* `tracking` - deprecated synonym for `upstream`.
1596 * `current` - push the current branch to a branch of the same name.
1597
1598 rebase.stat::
builtin/push.c
+5 -5
@@ -64,17 +64,17 @@ static void set_refspecs(const char **refs, int nr)
64 }
65 }
66
67 -static void setup_push_tracking(void)
67 +static void setup_push_upstream(void)
68 {
69 struct strbuf refspec = STRBUF_INIT;
70 struct branch *branch = branch_get(NULL);
71 if (!branch)
72 die("You are not currently on a branch.");
73 if (!branch->merge_nr || !branch->merge)
74 - die("The current branch %s is not tracking anything.",
74 + die("The current branch %s has no upstream branch.",
75 branch->name);
76 if (branch->merge_nr != 1)
77 - die("The current branch %s is tracking multiple branches, "
77 + die("The current branch %s has multiple upstream branches, "
78 "refusing to push.", branch->name);
79 strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
80 add_refspec(refspec.buf);
@@ -88,8 +88,8 @@ static void setup_default_push_refspecs(void)
88 add_refspec(":");
89 break;
90
91 - case PUSH_DEFAULT_TRACKING:
92 - setup_push_tracking();
91 + case PUSH_DEFAULT_UPSTREAM:
92 + setup_push_upstream();
93 break;
94
95 case PUSH_DEFAULT_CURRENT:
cache.h
+1 -1
@@ -608,7 +608,7 @@ enum rebase_setup_type {
608 enum push_default_type {
609 PUSH_DEFAULT_NOTHING = 0,
610 PUSH_DEFAULT_MATCHING,
611 - PUSH_DEFAULT_TRACKING,
611 + PUSH_DEFAULT_UPSTREAM,
612 PUSH_DEFAULT_CURRENT
613 };
614
config.c
+4 -2
@@ -737,8 +737,10 @@ static int git_default_push_config(const char *var, const char *value)
737 push_default = PUSH_DEFAULT_NOTHING;
738 else if (!strcmp(value, "matching"))
739 push_default = PUSH_DEFAULT_MATCHING;
740 - else if (!strcmp(value, "tracking"))
741 - push_default = PUSH_DEFAULT_TRACKING;
740 + else if (!strcmp(value, "upstream"))
741 + push_default = PUSH_DEFAULT_UPSTREAM;
742 + else if (!strcmp(value, "tracking")) /* deprecated */
743 + push_default = PUSH_DEFAULT_UPSTREAM;
744 else if (!strcmp(value, "current"))
745 push_default = PUSH_DEFAULT_CURRENT;
746 else {