Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
81a71734
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,发现更多精彩内容 >>
提交
81a71734
编写于
9月 02, 2006
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Make it possible to set up libgit directly (instead of from the environment)"
This reverts commit
0270083d
.
上级
9594b326
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
24 addition
and
114 deletion
+24
-114
cache.h
cache.h
+0
-3
commit.c
commit.c
+4
-19
environment.c
environment.c
+6
-39
perl/Git.pm
perl/Git.pm
+5
-6
perl/Git.xs
perl/Git.xs
+1
-15
sha1_file.c
sha1_file.c
+6
-24
sha1_name.c
sha1_name.c
+2
-8
未找到文件。
cache.h
浏览文件 @
81a71734
...
...
@@ -117,9 +117,6 @@ extern unsigned int active_nr, active_alloc, active_cache_changed;
extern
struct
cache_tree
*
active_cache_tree
;
extern
int
cache_errno
;
extern
void
setup_git
(
char
*
new_git_dir
,
char
*
new_git_object_dir
,
char
*
new_git_index_file
,
char
*
new_git_graft_file
);
#define GIT_DIR_ENVIRONMENT "GIT_DIR"
#define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
...
...
commit.c
浏览文件 @
81a71734
...
...
@@ -163,14 +163,6 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups)
return
0
;
}
void
free_commit_grafts
(
void
)
{
int
pos
=
commit_graft_nr
;
while
(
pos
>=
0
)
free
(
commit_graft
[
pos
--
]);
commit_graft_nr
=
0
;
}
struct
commit_graft
*
read_graft_line
(
char
*
buf
,
int
len
)
{
/* The format is just "Commit Parent1 Parent2 ...\n" */
...
...
@@ -223,18 +215,11 @@ int read_graft_file(const char *graft_file)
static
void
prepare_commit_graft
(
void
)
{
static
int
commit_graft_prepared
;
static
char
*
last_graft_file
;
char
*
graft_file
=
get_graft_file
();
if
(
last_graft_file
)
{
if
(
!
strcmp
(
graft_file
,
last_graft_file
))
return
;
free_commit_grafts
();
}
if
(
last_graft_file
)
free
(
last_graft_file
);
last_graft_file
=
strdup
(
graft_file
);
char
*
graft_file
;
if
(
commit_graft_prepared
)
return
;
graft_file
=
get_graft_file
();
read_graft_file
(
graft_file
);
commit_graft_prepared
=
1
;
}
...
...
environment.c
浏览文件 @
81a71734
...
...
@@ -25,61 +25,28 @@ int zlib_compression_level = Z_DEFAULT_COMPRESSION;
int
pager_in_use
;
int
pager_use_color
=
1
;
static
int
dyn_git_object_dir
,
dyn_git_index_file
,
dyn_git_graft_file
;
static
char
*
git_dir
,
*
git_object_dir
,
*
git_index_file
,
*
git_refs_dir
,
*
git_graft_file
;
void
setup_git
(
char
*
new_git_dir
,
char
*
new_git_object_dir
,
char
*
new_git_index_file
,
char
*
new_git_graft_file
)
static
void
setup_git_env
(
void
)
{
git_dir
=
new_git_dir
;
git_dir
=
getenv
(
GIT_DIR_ENVIRONMENT
)
;
if
(
!
git_dir
)
git_dir
=
DEFAULT_GIT_DIR_ENVIRONMENT
;
if
(
dyn_git_object_dir
)
free
(
git_object_dir
);
git_object_dir
=
new_git_object_dir
;
git_object_dir
=
getenv
(
DB_ENVIRONMENT
);
if
(
!
git_object_dir
)
{
git_object_dir
=
xmalloc
(
strlen
(
git_dir
)
+
9
);
sprintf
(
git_object_dir
,
"%s/objects"
,
git_dir
);
dyn_git_object_dir
=
1
;
}
else
{
dyn_git_object_dir
=
0
;
}
if
(
git_refs_dir
)
free
(
git_refs_dir
);
git_refs_dir
=
xmalloc
(
strlen
(
git_dir
)
+
6
);
sprintf
(
git_refs_dir
,
"%s/refs"
,
git_dir
);
if
(
dyn_git_index_file
)
free
(
git_index_file
);
git_index_file
=
new_git_index_file
;
git_index_file
=
getenv
(
INDEX_ENVIRONMENT
);
if
(
!
git_index_file
)
{
git_index_file
=
xmalloc
(
strlen
(
git_dir
)
+
7
);
sprintf
(
git_index_file
,
"%s/index"
,
git_dir
);
dyn_git_index_file
=
1
;
}
else
{
dyn_git_index_file
=
0
;
}
if
(
dyn_git_graft_file
)
free
(
git_graft_file
);
git_graft_file
=
new_git_graft_file
;
if
(
!
git_graft_file
)
{
git_graft_file
=
getenv
(
GRAFT_ENVIRONMENT
);
if
(
!
git_graft_file
)
git_graft_file
=
strdup
(
git_path
(
"info/grafts"
));
dyn_git_graft_file
=
1
;
}
else
{
dyn_git_graft_file
=
0
;
}
}
static
void
setup_git_env
(
void
)
{
setup_git
(
getenv
(
GIT_DIR_ENVIRONMENT
),
getenv
(
DB_ENVIRONMENT
),
getenv
(
INDEX_ENVIRONMENT
),
getenv
(
GRAFT_ENVIRONMENT
));
}
char
*
get_git_dir
(
void
)
...
...
perl/Git.pm
浏览文件 @
81a71734
...
...
@@ -98,8 +98,6 @@ =head1 DESCRIPTION
}
my
$instance_id
=
0
;
=head1 CONSTRUCTORS
...
...
@@ -217,7 +215,7 @@ sub repository {
delete
$opts
{
Directory
};
}
$self
=
{
opts
=>
\
%opts
,
id
=>
$instance_id
++
};
$self
=
{
opts
=>
\
%opts
};
bless
$self
,
$class
;
}
...
...
@@ -835,10 +833,11 @@ sub _call_gate {
if
(
defined
$self
)
{
# XXX: We ignore the WorkingCopy! To properly support
# that will require heavy changes in libgit.
# For now, when we will need to do it we could temporarily
# chdir() there and then chdir() back after the call is done.
xs__call_gate
(
$self
->
{
id
},
$self
->
repo_path
());
# XXX: And we ignore everything else as well. libgit
# at least needs to be extended to let us specify
# the $GIT_DIR instead of looking it up in environment.
#xs_call_gate($self->{opts}->{Repository});
}
# Having to call throw from the C code is a sure path to insanity.
...
...
perl/Git.xs
浏览文件 @
81a71734
...
...
@@ -52,21 +52,7 @@ BOOT:
}
void
xs__call_gate(repoid, git_dir)
long repoid;
char *git_dir;
CODE:
{
static long last_repoid;
if (repoid != last_repoid) {
setup_git(git_dir,
getenv(DB_ENVIRONMENT),
getenv(INDEX_ENVIRONMENT),
getenv(GRAFT_ENVIRONMENT));
last_repoid = repoid;
}
}
# /* TODO: xs_call_gate(). See Git.pm. */
char *
...
...
sha1_file.c
浏览文件 @
81a71734
...
...
@@ -126,22 +126,16 @@ static void fill_sha1_path(char *pathbuf, const unsigned char *sha1)
char
*
sha1_file_name
(
const
unsigned
char
*
sha1
)
{
static
char
*
name
,
*
base
;
static
const
char
*
last_objdir
;
const
char
*
sha1_file_directory
=
get_object_directory
();
if
(
!
last_objdir
||
strcmp
(
last_objdir
,
sha1_file_directory
))
{
if
(
!
base
)
{
const
char
*
sha1_file_directory
=
get_object_directory
();
int
len
=
strlen
(
sha1_file_directory
);
if
(
base
)
free
(
base
);
base
=
xmalloc
(
len
+
60
);
memcpy
(
base
,
sha1_file_directory
,
len
);
memset
(
base
+
len
,
0
,
60
);
base
[
len
]
=
'/'
;
base
[
len
+
3
]
=
'/'
;
name
=
base
+
len
+
1
;
if
(
last_objdir
)
free
((
char
*
)
last_objdir
);
last_objdir
=
strdup
(
sha1_file_directory
);
}
fill_sha1_path
(
name
,
sha1
);
return
base
;
...
...
@@ -151,20 +145,14 @@ char *sha1_pack_name(const unsigned char *sha1)
{
static
const
char
hex
[]
=
"0123456789abcdef"
;
static
char
*
name
,
*
base
,
*
buf
;
static
const
char
*
last_objdir
;
const
char
*
sha1_file_directory
=
get_object_directory
();
int
i
;
if
(
!
last_objdir
||
strcmp
(
last_objdir
,
sha1_file_directory
))
{
if
(
!
base
)
{
const
char
*
sha1_file_directory
=
get_object_directory
();
int
len
=
strlen
(
sha1_file_directory
);
if
(
base
)
free
(
base
);
base
=
xmalloc
(
len
+
60
);
sprintf
(
base
,
"%s/pack/pack-1234567890123456789012345678901234567890.pack"
,
sha1_file_directory
);
name
=
base
+
len
+
11
;
if
(
last_objdir
)
free
((
char
*
)
last_objdir
);
last_objdir
=
strdup
(
sha1_file_directory
);
}
buf
=
name
;
...
...
@@ -182,20 +170,14 @@ char *sha1_pack_index_name(const unsigned char *sha1)
{
static
const
char
hex
[]
=
"0123456789abcdef"
;
static
char
*
name
,
*
base
,
*
buf
;
static
const
char
*
last_objdir
;
const
char
*
sha1_file_directory
=
get_object_directory
();
int
i
;
if
(
!
last_objdir
||
strcmp
(
last_objdir
,
sha1_file_directory
))
{
if
(
!
base
)
{
const
char
*
sha1_file_directory
=
get_object_directory
();
int
len
=
strlen
(
sha1_file_directory
);
if
(
base
)
free
(
base
);
base
=
xmalloc
(
len
+
60
);
sprintf
(
base
,
"%s/pack/pack-1234567890123456789012345678901234567890.idx"
,
sha1_file_directory
);
name
=
base
+
len
+
11
;
if
(
last_objdir
)
free
((
char
*
)
last_objdir
);
last_objdir
=
strdup
(
sha1_file_directory
);
}
buf
=
name
;
...
...
sha1_name.c
浏览文件 @
81a71734
...
...
@@ -12,21 +12,15 @@ static int find_short_object_filename(int len, const char *name, unsigned char *
char
hex
[
40
];
int
found
=
0
;
static
struct
alternate_object_database
*
fakeent
;
static
const
char
*
last_objdir
;
const
char
*
objdir
=
get_object_directory
();
if
(
!
last_objdir
||
strcmp
(
last_objdir
,
objdir
))
{
if
(
!
fakeent
)
{
const
char
*
objdir
=
get_object_directory
();
int
objdir_len
=
strlen
(
objdir
);
int
entlen
=
objdir_len
+
43
;
if
(
fakeent
)
free
(
fakeent
);
fakeent
=
xmalloc
(
sizeof
(
*
fakeent
)
+
entlen
);
memcpy
(
fakeent
->
base
,
objdir
,
objdir_len
);
fakeent
->
name
=
fakeent
->
base
+
objdir_len
+
1
;
fakeent
->
name
[
-
1
]
=
'/'
;
if
(
last_objdir
)
free
((
char
*
)
last_objdir
);
last_objdir
=
strdup
(
objdir
);
}
fakeent
->
next
=
alt_odb_list
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录