Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
ff27adf3
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,发现更多精彩内容 >>
提交
ff27adf3
编写于
8月 24, 2005
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support +<src>:<dst> format in push as well.
Signed-off-by:
N
Junio C Hamano
<
junkio@cox.net
>
上级
efe9bf0f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
6 deletion
+24
-6
cache.h
cache.h
+1
-0
connect.c
connect.c
+15
-2
send-pack.c
send-pack.c
+8
-4
未找到文件。
cache.h
浏览文件 @
ff27adf3
...
...
@@ -309,6 +309,7 @@ struct ref {
struct
ref
*
next
;
unsigned
char
old_sha1
[
20
];
unsigned
char
new_sha1
[
20
];
unsigned
char
force
;
struct
ref
*
peer_ref
;
/* when renaming */
char
name
[
0
];
};
...
...
connect.c
浏览文件 @
ff27adf3
...
...
@@ -82,15 +82,26 @@ int path_match(const char *path, int nr, char **match)
struct
refspec
{
char
*
src
;
char
*
dst
;
char
force
;
};
/*
* A:B means fast forward remote B with local A.
* +A:B means overwrite remote B with local A.
* +A is a shorthand for +A:A.
* A is a shorthand for A:A.
*/
static
struct
refspec
*
parse_ref_spec
(
int
nr_refspec
,
char
**
refspec
)
{
int
i
;
struct
refspec
*
rs
=
x
malloc
(
sizeof
(
*
rs
)
*
(
nr_refspec
+
1
));
struct
refspec
*
rs
=
x
calloc
(
sizeof
(
*
rs
),
(
nr_refspec
+
1
));
for
(
i
=
0
;
i
<
nr_refspec
;
i
++
)
{
char
*
sp
,
*
dp
,
*
ep
;
sp
=
refspec
[
i
];
if
(
*
sp
==
'+'
)
{
rs
[
i
].
force
=
1
;
sp
++
;
}
ep
=
strchr
(
sp
,
':'
);
if
(
ep
)
{
dp
=
ep
+
1
;
...
...
@@ -216,8 +227,10 @@ static int match_explicit_refs(struct ref *src, struct ref *dst,
error
(
"dst ref %s receives from more than one src."
,
matched_dst
->
name
);
}
else
else
{
matched_dst
->
peer_ref
=
matched_src
;
matched_dst
->
force
=
rs
[
i
].
force
;
}
}
return
-
errs
;
}
...
...
send-pack.c
浏览文件 @
ff27adf3
...
...
@@ -206,7 +206,8 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
/* This part determines what can overwrite what.
* The rules are:
*
* (0) you can always use --force.
* (0) you can always use --force or +A:B notation to
* selectively force individual ref pairs.
*
* (1) if the old thing does not exist, it is OK.
*
...
...
@@ -218,16 +219,19 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
* descendant of old, it is OK.
*/
if
(
!
force_update
&&
!
is_zero_sha1
(
ref
->
old_sha1
))
{
if
(
!
force_update
&&
!
is_zero_sha1
(
ref
->
old_sha1
)
&&
!
ref
->
force
)
{
if
(
!
has_sha1_file
(
ref
->
old_sha1
))
{
error
(
"remote '%s' object %s does not "
"exist on local"
,
ref
->
name
,
sha1_to_hex
(
ref
->
old_sha1
));
continue
;
}
/* We assume that local is fsck-clean. Otherwise
* you _could_ have a old tag which points at
* something you do not have which may or may not
* you _could_ have a
n
old tag which points at
* something you do not have
,
which may or may not
* be a commit.
*/
if
(
!
ref_newer
(
ref
->
peer_ref
->
new_sha1
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录