Skip to content

Commit

Permalink
push.default: Rename 'tracking' to 'upstream'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johan Herland authored and Junio C Hamano committed Feb 16, 2011
1 parent 7ed863a commit 53c4031
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,8 @@ push.default::
* `matching` - push all matching branches.
All branches having the same name in both ends are considered to be
matching. This is the default.
* `tracking` - push the current branch to its upstream branch.
* `upstream` - push the current branch to its upstream branch.
* `tracking` - deprecated synonym for `upstream`.
* `current` - push the current branch to a branch of the same name.

rebase.stat::
Expand Down
10 changes: 5 additions & 5 deletions builtin/push.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ static void set_refspecs(const char **refs, int nr)
}
}

static void setup_push_tracking(void)
static void setup_push_upstream(void)
{
struct strbuf refspec = STRBUF_INIT;
struct branch *branch = branch_get(NULL);
if (!branch)
die("You are not currently on a branch.");
if (!branch->merge_nr || !branch->merge)
die("The current branch %s is not tracking anything.",
die("The current branch %s has no upstream branch.",
branch->name);
if (branch->merge_nr != 1)
die("The current branch %s is tracking multiple branches, "
die("The current branch %s has multiple upstream branches, "
"refusing to push.", branch->name);
strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
add_refspec(refspec.buf);
Expand All @@ -88,8 +88,8 @@ static void setup_default_push_refspecs(void)
add_refspec(":");
break;

case PUSH_DEFAULT_TRACKING:
setup_push_tracking();
case PUSH_DEFAULT_UPSTREAM:
setup_push_upstream();
break;

case PUSH_DEFAULT_CURRENT:
Expand Down
2 changes: 1 addition & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ enum rebase_setup_type {
enum push_default_type {
PUSH_DEFAULT_NOTHING = 0,
PUSH_DEFAULT_MATCHING,
PUSH_DEFAULT_TRACKING,
PUSH_DEFAULT_UPSTREAM,
PUSH_DEFAULT_CURRENT
};

Expand Down
6 changes: 4 additions & 2 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,10 @@ static int git_default_push_config(const char *var, const char *value)
push_default = PUSH_DEFAULT_NOTHING;
else if (!strcmp(value, "matching"))
push_default = PUSH_DEFAULT_MATCHING;
else if (!strcmp(value, "tracking"))
push_default = PUSH_DEFAULT_TRACKING;
else if (!strcmp(value, "upstream"))
push_default = PUSH_DEFAULT_UPSTREAM;
else if (!strcmp(value, "tracking")) /* deprecated */
push_default = PUSH_DEFAULT_UPSTREAM;
else if (!strcmp(value, "current"))
push_default = PUSH_DEFAULT_CURRENT;
else {
Expand Down

0 comments on commit 53c4031

Please sign in to comment.