Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
009055f3
G
git
项目概览
李少辉-开发者
/
git
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
git
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
009055f3
编写于
3月 07, 2014
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'jc/push-2.0-default-to-simple'
Finally update the "git push" default behaviour to "simple".
上级
6ab4ae2b
b2ed944a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
41 deletion
+17
-41
Documentation/config.txt
Documentation/config.txt
+4
-10
Documentation/git-push.txt
Documentation/git-push.txt
+6
-4
advice.c
advice.c
+0
-2
advice.h
advice.h
+0
-1
builtin/push.c
builtin/push.c
+7
-24
未找到文件。
Documentation/config.txt
浏览文件 @
009055f3
...
...
@@ -142,19 +142,13 @@ advice.*::
--
pushUpdateRejected::
Set this variable to 'false' if you want to disable
'pushNonFFCurrent',
'pushNonFFDefault',
'pushNonFFCurrent',
'pushNonFFMatching', 'pushAlreadyExists',
'pushFetchFirst', and 'pushNeedsForce'
simultaneously.
pushNonFFCurrent::
Advice shown when linkgit:git-push[1] fails due to a
non-fast-forward update to the current branch.
pushNonFFDefault::
Advice to set 'push.default' to 'upstream' or 'current'
when you ran linkgit:git-push[1] and pushed 'matching
refs' by default (i.e. you did not provide an explicit
refspec, and no 'push.default' configuration was set)
and it resulted in a non-fast-forward error.
pushNonFFMatching::
Advice shown when you ran linkgit:git-push[1] and pushed
'matching refs' explicitly (i.e. you used ':', or
...
...
@@ -1980,7 +1974,7 @@ When pushing to a remote that is different from the remote you normally
pull from, work as `current`. This is the safest option and is suited
for beginners.
+
This mode
will
become the default in Git 2.0.
This mode
has
become the default in Git 2.0.
* `matching` - push all branches having the same name on both ends.
This makes the repository you are pushing to remember the set of
...
...
@@ -1999,8 +1993,8 @@ suitable for pushing into a shared central repository, as other
people may add new branches there, or update the tip of existing
branches outside your control.
+
This
is currently the default, but Git 2.0 will change the default
to `simple`
.
This
used to be the default, but not since Git 2.0 (`simple` is the
new default)
.
--
...
...
Documentation/git-push.txt
浏览文件 @
009055f3
...
...
@@ -83,8 +83,8 @@ the local side, the remote side is updated if a branch of the same name
already exists on the remote side.
--all::
Instead of naming each ref to push, specifies that all
refs under `refs/heads/` be pushed
.
Push all branches (i.e. refs under `refs/heads/`); cannot be
used with other <refspec>
.
--prune::
Remove remote branches that don't have a local counterpart. For example
...
...
@@ -442,8 +442,10 @@ Examples
configured for the current branch).
`git push origin`::
Without additional configuration, works like
`git push origin :`.
Without additional configuration, pushes the current branch to
the configured upstream (`remote.origin.merge` configuration
variable) if it has the same name as the current branch, and
errors out without pushing otherwise.
+
The default behavior of this command when no <refspec> is given can be
configured by setting the `push` option of the remote, or the `push.default`
...
...
advice.c
浏览文件 @
009055f3
...
...
@@ -2,7 +2,6 @@
int
advice_push_update_rejected
=
1
;
int
advice_push_non_ff_current
=
1
;
int
advice_push_non_ff_default
=
1
;
int
advice_push_non_ff_matching
=
1
;
int
advice_push_already_exists
=
1
;
int
advice_push_fetch_first
=
1
;
...
...
@@ -23,7 +22,6 @@ static struct {
}
advice_config
[]
=
{
{
"pushupdaterejected"
,
&
advice_push_update_rejected
},
{
"pushnonffcurrent"
,
&
advice_push_non_ff_current
},
{
"pushnonffdefault"
,
&
advice_push_non_ff_default
},
{
"pushnonffmatching"
,
&
advice_push_non_ff_matching
},
{
"pushalreadyexists"
,
&
advice_push_already_exists
},
{
"pushfetchfirst"
,
&
advice_push_fetch_first
},
...
...
advice.h
浏览文件 @
009055f3
...
...
@@ -5,7 +5,6 @@
extern
int
advice_push_update_rejected
;
extern
int
advice_push_non_ff_current
;
extern
int
advice_push_non_ff_default
;
extern
int
advice_push_non_ff_matching
;
extern
int
advice_push_already_exists
;
extern
int
advice_push_fetch_first
;
...
...
builtin/push.c
浏览文件 @
009055f3
...
...
@@ -26,7 +26,6 @@ static struct push_cas_option cas;
static
const
char
**
refspec
;
static
int
refspec_nr
;
static
int
refspec_alloc
;
static
int
default_matching_used
;
static
void
add_refspec
(
const
char
*
ref
)
{
...
...
@@ -204,9 +203,9 @@ static void setup_push_current(struct remote *remote, struct branch *branch)
}
static
char
warn_unspecified_push_default_msg
[]
=
N_
(
"push.default is unset; its implicit value
is changing
in
\n
"
N_
(
"push.default is unset; its implicit value
has changed
in
\n
"
"Git 2.0 from 'matching' to 'simple'. To squelch this message
\n
"
"and maintain the
current behavior after the default changes
, use:
\n
"
"and maintain the
traditional behavior
, use:
\n
"
"
\n
"
" git config --global push.default matching
\n
"
"
\n
"
...
...
@@ -247,14 +246,14 @@ static void setup_default_push_refspecs(struct remote *remote)
switch
(
push_default
)
{
default:
case
PUSH_DEFAULT_UNSPECIFIED
:
default_matching_used
=
1
;
warn_unspecified_push_default_configuration
();
/* fallthru */
case
PUSH_DEFAULT_MATCHING
:
add_refspec
(
":"
);
break
;
case
PUSH_DEFAULT_UNSPECIFIED
:
warn_unspecified_push_default_configuration
();
/* fallthru */
case
PUSH_DEFAULT_SIMPLE
:
if
(
triangular
)
setup_push_current
(
remote
,
branch
);
...
...
@@ -283,12 +282,6 @@ static const char message_advice_pull_before_push[] =
"'git pull ...') before pushing again.
\n
"
"See the 'Note about fast-forwards' in 'git push --help' for details."
);
static
const
char
message_advice_use_upstream
[]
=
N_
(
"Updates were rejected because a pushed branch tip is behind its remote
\n
"
"counterpart. If you did not intend to push that branch, you may want to
\n
"
"specify branches to push or set the 'push.default' configuration variable
\n
"
"to 'simple', 'current' or 'upstream' to push only the current branch."
);
static
const
char
message_advice_checkout_pull_push
[]
=
N_
(
"Updates were rejected because a pushed branch tip is behind its remote
\n
"
"counterpart. Check out this branch and integrate the remote changes
\n
"
...
...
@@ -317,13 +310,6 @@ static void advise_pull_before_push(void)
advise
(
_
(
message_advice_pull_before_push
));
}
static
void
advise_use_upstream
(
void
)
{
if
(
!
advice_push_non_ff_default
||
!
advice_push_update_rejected
)
return
;
advise
(
_
(
message_advice_use_upstream
));
}
static
void
advise_checkout_pull_push
(
void
)
{
if
(
!
advice_push_non_ff_matching
||
!
advice_push_update_rejected
)
...
...
@@ -385,10 +371,7 @@ static int push_with_options(struct transport *transport, int flags)
if
(
reject_reasons
&
REJECT_NON_FF_HEAD
)
{
advise_pull_before_push
();
}
else
if
(
reject_reasons
&
REJECT_NON_FF_OTHER
)
{
if
(
default_matching_used
)
advise_use_upstream
();
else
advise_checkout_pull_push
();
advise_checkout_pull_push
();
}
else
if
(
reject_reasons
&
REJECT_ALREADY_EXISTS
)
{
advise_ref_already_exists
();
}
else
if
(
reject_reasons
&
REJECT_FETCH_FIRST
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录