Merge branch 'jh/push-default-upstream-configname' into maint
* jh/push-default-upstream-configname: push.default: Rename 'tracking' to 'upstream'maint
commit
61a6f1faec
|
@ -1582,7 +1582,8 @@ push.default::
|
||||||
* `matching` - push all matching branches.
|
* `matching` - push all matching branches.
|
||||||
All branches having the same name in both ends are considered to be
|
All branches having the same name in both ends are considered to be
|
||||||
matching. This is the default.
|
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.
|
* `current` - push the current branch to a branch of the same name.
|
||||||
|
|
||||||
rebase.stat::
|
rebase.stat::
|
||||||
|
|
|
@ -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 strbuf refspec = STRBUF_INIT;
|
||||||
struct branch *branch = branch_get(NULL);
|
struct branch *branch = branch_get(NULL);
|
||||||
if (!branch)
|
if (!branch)
|
||||||
die("You are not currently on a branch.");
|
die("You are not currently on a branch.");
|
||||||
if (!branch->merge_nr || !branch->merge)
|
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);
|
branch->name);
|
||||||
if (branch->merge_nr != 1)
|
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);
|
"refusing to push.", branch->name);
|
||||||
strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
|
strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
|
||||||
add_refspec(refspec.buf);
|
add_refspec(refspec.buf);
|
||||||
|
@ -88,8 +88,8 @@ static void setup_default_push_refspecs(void)
|
||||||
add_refspec(":");
|
add_refspec(":");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PUSH_DEFAULT_TRACKING:
|
case PUSH_DEFAULT_UPSTREAM:
|
||||||
setup_push_tracking();
|
setup_push_upstream();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PUSH_DEFAULT_CURRENT:
|
case PUSH_DEFAULT_CURRENT:
|
||||||
|
|
2
cache.h
2
cache.h
|
@ -607,7 +607,7 @@ enum rebase_setup_type {
|
||||||
enum push_default_type {
|
enum push_default_type {
|
||||||
PUSH_DEFAULT_NOTHING = 0,
|
PUSH_DEFAULT_NOTHING = 0,
|
||||||
PUSH_DEFAULT_MATCHING,
|
PUSH_DEFAULT_MATCHING,
|
||||||
PUSH_DEFAULT_TRACKING,
|
PUSH_DEFAULT_UPSTREAM,
|
||||||
PUSH_DEFAULT_CURRENT
|
PUSH_DEFAULT_CURRENT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
6
config.c
6
config.c
|
@ -729,8 +729,10 @@ static int git_default_push_config(const char *var, const char *value)
|
||||||
push_default = PUSH_DEFAULT_NOTHING;
|
push_default = PUSH_DEFAULT_NOTHING;
|
||||||
else if (!strcmp(value, "matching"))
|
else if (!strcmp(value, "matching"))
|
||||||
push_default = PUSH_DEFAULT_MATCHING;
|
push_default = PUSH_DEFAULT_MATCHING;
|
||||||
else if (!strcmp(value, "tracking"))
|
else if (!strcmp(value, "upstream"))
|
||||||
push_default = PUSH_DEFAULT_TRACKING;
|
push_default = PUSH_DEFAULT_UPSTREAM;
|
||||||
|
else if (!strcmp(value, "tracking")) /* deprecated */
|
||||||
|
push_default = PUSH_DEFAULT_UPSTREAM;
|
||||||
else if (!strcmp(value, "current"))
|
else if (!strcmp(value, "current"))
|
||||||
push_default = PUSH_DEFAULT_CURRENT;
|
push_default = PUSH_DEFAULT_CURRENT;
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue