Skip to content

Commit 53c4031

Browse files
jherlandgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ed863a commit 53c4031

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

Documentation/config.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,8 @@ push.default::
15911591
* `matching` - push all matching branches.
15921592
All branches having the same name in both ends are considered to be
15931593
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`.
15951596
* `current` - push the current branch to a branch of the same name.
15961597

15971598
rebase.stat::

builtin/push.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ static void set_refspecs(const char **refs, int nr)
6464
}
6565
}
6666

67-
static void setup_push_tracking(void)
67+
static void setup_push_upstream(void)
6868
{
6969
struct strbuf refspec = STRBUF_INIT;
7070
struct branch *branch = branch_get(NULL);
7171
if (!branch)
7272
die("You are not currently on a branch.");
7373
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.",
7575
branch->name);
7676
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, "
7878
"refusing to push.", branch->name);
7979
strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
8080
add_refspec(refspec.buf);
@@ -88,8 +88,8 @@ static void setup_default_push_refspecs(void)
8888
add_refspec(":");
8989
break;
9090

91-
case PUSH_DEFAULT_TRACKING:
92-
setup_push_tracking();
91+
case PUSH_DEFAULT_UPSTREAM:
92+
setup_push_upstream();
9393
break;
9494

9595
case PUSH_DEFAULT_CURRENT:

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ enum rebase_setup_type {
608608
enum push_default_type {
609609
PUSH_DEFAULT_NOTHING = 0,
610610
PUSH_DEFAULT_MATCHING,
611-
PUSH_DEFAULT_TRACKING,
611+
PUSH_DEFAULT_UPSTREAM,
612612
PUSH_DEFAULT_CURRENT
613613
};
614614

config.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,10 @@ static int git_default_push_config(const char *var, const char *value)
737737
push_default = PUSH_DEFAULT_NOTHING;
738738
else if (!strcmp(value, "matching"))
739739
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;
742744
else if (!strcmp(value, "current"))
743745
push_default = PUSH_DEFAULT_CURRENT;
744746
else {

0 commit comments

Comments
 (0)