Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
53bca91a
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,发现更多精彩内容 >>
提交
53bca91a
编写于
2月 28, 2007
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
index_fd(): pass optional path parameter as hint for blob conversion
Signed-off-by:
N
Junio C Hamano
<
junkio@cox.net
>
上级
edaec3fb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
6 addition
and
6 deletion
+6
-6
cache.h
cache.h
+1
-1
hash-object.c
hash-object.c
+1
-1
read-cache.c
read-cache.c
+1
-1
sha1_file.c
sha1_file.c
+3
-3
未找到文件。
cache.h
浏览文件 @
53bca91a
...
...
@@ -190,7 +190,7 @@ extern int ce_same_name(struct cache_entry *a, struct cache_entry *b);
extern
int
ce_match_stat
(
struct
cache_entry
*
ce
,
struct
stat
*
st
,
int
);
extern
int
ce_modified
(
struct
cache_entry
*
ce
,
struct
stat
*
st
,
int
);
extern
int
ce_path_match
(
const
struct
cache_entry
*
ce
,
const
char
**
pathspec
);
extern
int
index_fd
(
unsigned
char
*
sha1
,
int
fd
,
struct
stat
*
st
,
int
write_object
,
enum
object_type
type
);
extern
int
index_fd
(
unsigned
char
*
sha1
,
int
fd
,
struct
stat
*
st
,
int
write_object
,
enum
object_type
type
,
const
char
*
path
);
extern
int
read_pipe
(
int
fd
,
char
**
return_buf
,
unsigned
long
*
return_size
);
extern
int
index_pipe
(
unsigned
char
*
sha1
,
int
fd
,
const
char
*
type
,
int
write_object
);
extern
int
index_path
(
unsigned
char
*
sha1
,
const
char
*
path
,
struct
stat
*
st
,
int
write_object
);
...
...
hash-object.c
浏览文件 @
53bca91a
...
...
@@ -15,7 +15,7 @@ static void hash_object(const char *path, enum object_type type, int write_objec
fd
=
open
(
path
,
O_RDONLY
);
if
(
fd
<
0
||
fstat
(
fd
,
&
st
)
<
0
||
index_fd
(
sha1
,
fd
,
&
st
,
write_object
,
type
))
index_fd
(
sha1
,
fd
,
&
st
,
write_object
,
type
,
path
))
die
(
write_object
?
"Unable to add %s to database"
:
"Unable to hash %s"
,
path
);
...
...
read-cache.c
浏览文件 @
53bca91a
...
...
@@ -59,7 +59,7 @@ static int ce_compare_data(struct cache_entry *ce, struct stat *st)
if
(
fd
>=
0
)
{
unsigned
char
sha1
[
20
];
if
(
!
index_fd
(
sha1
,
fd
,
st
,
0
,
OBJ_BLOB
))
if
(
!
index_fd
(
sha1
,
fd
,
st
,
0
,
OBJ_BLOB
,
ce
->
name
))
match
=
hashcmp
(
sha1
,
ce
->
sha1
);
/* index_fd() closed the file descriptor already */
}
...
...
sha1_file.c
浏览文件 @
53bca91a
...
...
@@ -2054,7 +2054,7 @@ int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object)
}
int
index_fd
(
unsigned
char
*
sha1
,
int
fd
,
struct
stat
*
st
,
int
write_object
,
enum
object_type
type
)
enum
object_type
type
,
const
char
*
path
)
{
unsigned
long
size
=
st
->
st_size
;
void
*
buf
;
...
...
@@ -2074,7 +2074,7 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
if
(
type
==
OBJ_BLOB
)
{
unsigned
long
nsize
=
size
;
char
*
nbuf
=
buf
;
if
(
convert_to_git
(
NULL
,
&
nbuf
,
&
nsize
))
{
if
(
convert_to_git
(
path
,
&
nbuf
,
&
nsize
))
{
if
(
size
)
munmap
(
buf
,
size
);
size
=
nsize
;
...
...
@@ -2107,7 +2107,7 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write
if
(
fd
<
0
)
return
error
(
"open(
\"
%s
\"
): %s"
,
path
,
strerror
(
errno
));
if
(
index_fd
(
sha1
,
fd
,
st
,
write_object
,
OBJ_BLOB
)
<
0
)
if
(
index_fd
(
sha1
,
fd
,
st
,
write_object
,
OBJ_BLOB
,
path
)
<
0
)
return
error
(
"%s: failed to insert into database"
,
path
);
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录