Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
ddf95324
Commit
ddf95324
authored
Dec 29, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2783 from libgit2/cmn/treebuilder-new
treebuilder: rename _create() to _new()
parents
61cf3823
208a2c8a
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
22 deletions
+26
-22
CHANGELOG.md
+7
-3
include/git2/tree.h
+1
-1
src/notes.c
+1
-1
src/tree.c
+2
-2
tests/object/tree/attributes.c
+3
-3
tests/object/tree/duplicateentries.c
+1
-1
tests/object/tree/write.c
+10
-10
tests/repo/iterator.c
+1
-1
No files found.
CHANGELOG.md
View file @
ddf95324
...
@@ -142,9 +142,13 @@ v0.21 + 1
...
@@ -142,9 +142,13 @@ v0.21 + 1
initializations of the library, so consumers may schedule work on the
initializations of the library, so consumers may schedule work on the
first initialization.
first initialization.
*
git_treebuilder_create now takes a repository so that it can query
*
git_treebuilder_new (was git_treebuilder_create) now takes a
repository configuration. Subsequently, git_treebuilder_write no
repository so that it can query repository configuration.
longer takes a repository.
Subsequently, git_treebuilder_write no longer takes a repository.
*
git_treebuilder_create was renamed to git_treebuilder_new to better
reflect it being a constructor rather than something which writes to
disk.
*
git_checkout now handles case-changing renames correctly on
*
git_checkout now handles case-changing renames correctly on
case-insensitive filesystems; for example renaming "readme" to "README".
case-insensitive filesystems; for example renaming "readme" to "README".
...
...
include/git2/tree.h
View file @
ddf95324
...
@@ -251,7 +251,7 @@ GIT_EXTERN(int) git_tree_entry_to_object(
...
@@ -251,7 +251,7 @@ GIT_EXTERN(int) git_tree_entry_to_object(
* @param source Source tree to initialize the builder (optional)
* @param source Source tree to initialize the builder (optional)
* @return 0 on success; error code otherwise
* @return 0 on success; error code otherwise
*/
*/
GIT_EXTERN
(
int
)
git_treebuilder_
create
(
GIT_EXTERN
(
int
)
git_treebuilder_
new
(
git_treebuilder
**
out
,
git_repository
*
repo
,
const
git_tree
*
source
);
git_treebuilder
**
out
,
git_repository
*
repo
,
const
git_tree
*
source
);
/**
/**
...
...
src/notes.c
View file @
ddf95324
...
@@ -107,7 +107,7 @@ static int tree_write(
...
@@ -107,7 +107,7 @@ static int tree_write(
const
git_tree_entry
*
entry
;
const
git_tree_entry
*
entry
;
git_oid
tree_oid
;
git_oid
tree_oid
;
if
((
error
=
git_treebuilder_
create
(
&
tb
,
repo
,
source_tree
))
<
0
)
if
((
error
=
git_treebuilder_
new
(
&
tb
,
repo
,
source_tree
))
<
0
)
goto
cleanup
;
goto
cleanup
;
if
(
object_oid
)
{
if
(
object_oid
)
{
...
...
src/tree.c
View file @
ddf95324
...
@@ -490,7 +490,7 @@ static int write_tree(
...
@@ -490,7 +490,7 @@ static int write_tree(
return
(
int
)
find_next_dir
(
dirname
,
index
,
start
);
return
(
int
)
find_next_dir
(
dirname
,
index
,
start
);
}
}
if
((
error
=
git_treebuilder_
create
(
&
bld
,
repo
,
NULL
))
<
0
||
bld
==
NULL
)
if
((
error
=
git_treebuilder_
new
(
&
bld
,
repo
,
NULL
))
<
0
||
bld
==
NULL
)
return
-
1
;
return
-
1
;
/*
/*
...
@@ -624,7 +624,7 @@ int git_tree__write_index(
...
@@ -624,7 +624,7 @@ int git_tree__write_index(
return
ret
;
return
ret
;
}
}
int
git_treebuilder_
create
(
int
git_treebuilder_
new
(
git_treebuilder
**
builder_p
,
git_treebuilder
**
builder_p
,
git_repository
*
repo
,
git_repository
*
repo
,
const
git_tree
*
source
)
const
git_tree
*
source
)
...
...
tests/object/tree/attributes.c
View file @
ddf95324
...
@@ -23,7 +23,7 @@ void test_object_tree_attributes__ensure_correctness_of_attributes_on_insertion(
...
@@ -23,7 +23,7 @@ void test_object_tree_attributes__ensure_correctness_of_attributes_on_insertion(
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
blob_oid
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
blob_oid
));
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
repo
,
NULL
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
"one.txt"
,
&
oid
,
(
git_filemode_t
)
0777777
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
"one.txt"
,
&
oid
,
(
git_filemode_t
)
0777777
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
"one.txt"
,
&
oid
,
(
git_filemode_t
)
0100666
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
"one.txt"
,
&
oid
,
(
git_filemode_t
)
0100666
));
...
@@ -58,7 +58,7 @@ void test_object_tree_attributes__treebuilder_reject_invalid_filemode(void)
...
@@ -58,7 +58,7 @@ void test_object_tree_attributes__treebuilder_reject_invalid_filemode(void)
const
git_tree_entry
*
entry
;
const
git_tree_entry
*
entry
;
cl_git_pass
(
git_oid_fromstr
(
&
bid
,
blob_oid
));
cl_git_pass
(
git_oid_fromstr
(
&
bid
,
blob_oid
));
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
repo
,
NULL
));
cl_git_fail
(
git_treebuilder_insert
(
cl_git_fail
(
git_treebuilder_insert
(
&
entry
,
&
entry
,
...
@@ -80,7 +80,7 @@ void test_object_tree_attributes__normalize_attributes_when_creating_a_tree_from
...
@@ -80,7 +80,7 @@ void test_object_tree_attributes__normalize_attributes_when_creating_a_tree_from
cl_git_pass
(
git_oid_fromstr
(
&
tid
,
tree_oid
));
cl_git_pass
(
git_oid_fromstr
(
&
tid
,
tree_oid
));
cl_git_pass
(
git_tree_lookup
(
&
tree
,
repo
,
&
tid
));
cl_git_pass
(
git_tree_lookup
(
&
tree
,
repo
,
&
tid
));
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
repo
,
tree
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
repo
,
tree
));
entry
=
git_treebuilder_get
(
builder
,
"old_mode.txt"
);
entry
=
git_treebuilder_get
(
builder
,
"old_mode.txt"
);
cl_assert_equal_i
(
cl_assert_equal_i
(
...
...
tests/object/tree/duplicateentries.c
View file @
ddf95324
...
@@ -57,7 +57,7 @@ static void tree_creator(git_oid *out, void (*fn)(git_treebuilder *))
...
@@ -57,7 +57,7 @@ static void tree_creator(git_oid *out, void (*fn)(git_treebuilder *))
{
{
git_treebuilder
*
builder
;
git_treebuilder
*
builder
;
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
_repo
,
NULL
));
fn
(
builder
);
fn
(
builder
);
...
...
tests/object/tree/write.c
View file @
ddf95324
...
@@ -35,7 +35,7 @@ void test_object_tree_write__from_memory(void)
...
@@ -35,7 +35,7 @@ void test_object_tree_write__from_memory(void)
* on REPOSITORY_FOLDER.
* on REPOSITORY_FOLDER.
*/
*/
cl_git_pass
(
git_tree_lookup
(
&
tree
,
g_repo
,
&
id
));
cl_git_pass
(
git_tree_lookup
(
&
tree
,
g_repo
,
&
id
));
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
tree
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
tree
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
""
,
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
""
,
&
bid
,
GIT_FILEMODE_BLOB
));
&
bid
,
GIT_FILEMODE_BLOB
));
...
@@ -75,7 +75,7 @@ void test_object_tree_write__subtree(void)
...
@@ -75,7 +75,7 @@ void test_object_tree_write__subtree(void)
git_oid_fromstr
(
&
bid
,
blob_oid
);
git_oid_fromstr
(
&
bid
,
blob_oid
);
/* create subtree */
/* create subtree */
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_insert
(
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
builder
,
"new.txt"
,
&
bid
,
GIT_FILEMODE_BLOB
));
/* -V536 */
NULL
,
builder
,
"new.txt"
,
&
bid
,
GIT_FILEMODE_BLOB
));
/* -V536 */
cl_git_pass
(
git_treebuilder_write
(
&
subtree_id
,
builder
));
cl_git_pass
(
git_treebuilder_write
(
&
subtree_id
,
builder
));
...
@@ -83,7 +83,7 @@ void test_object_tree_write__subtree(void)
...
@@ -83,7 +83,7 @@ void test_object_tree_write__subtree(void)
/* create parent tree */
/* create parent tree */
cl_git_pass
(
git_tree_lookup
(
&
tree
,
g_repo
,
&
id
));
cl_git_pass
(
git_tree_lookup
(
&
tree
,
g_repo
,
&
id
));
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
tree
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
tree
));
cl_git_pass
(
git_treebuilder_insert
(
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
builder
,
"new"
,
&
subtree_id
,
GIT_FILEMODE_TREE
));
/* -V536 */
NULL
,
builder
,
"new"
,
&
subtree_id
,
GIT_FILEMODE_TREE
));
/* -V536 */
cl_git_pass
(
git_treebuilder_write
(
&
id_hiearar
,
builder
));
cl_git_pass
(
git_treebuilder_write
(
&
id_hiearar
,
builder
));
...
@@ -135,7 +135,7 @@ void test_object_tree_write__sorted_subtrees(void)
...
@@ -135,7 +135,7 @@ void test_object_tree_write__sorted_subtrees(void)
memset
(
&
blank_oid
,
0x0
,
sizeof
(
blank_oid
));
memset
(
&
blank_oid
,
0x0
,
sizeof
(
blank_oid
));
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
NULL
));
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
entries
);
++
i
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
entries
);
++
i
)
{
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
...
@@ -192,7 +192,7 @@ void test_object_tree_write__removing_and_re_adding_in_treebuilder(void)
...
@@ -192,7 +192,7 @@ void test_object_tree_write__removing_and_re_adding_in_treebuilder(void)
memset
(
&
blank_oid
,
0x0
,
sizeof
(
blank_oid
));
memset
(
&
blank_oid
,
0x0
,
sizeof
(
blank_oid
));
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
NULL
));
cl_assert_equal_i
(
0
,
(
int
)
git_treebuilder_entrycount
(
builder
));
cl_assert_equal_i
(
0
,
(
int
)
git_treebuilder_entrycount
(
builder
));
...
@@ -283,7 +283,7 @@ void test_object_tree_write__filtering(void)
...
@@ -283,7 +283,7 @@ void test_object_tree_write__filtering(void)
memset
(
&
blank_oid
,
0x0
,
sizeof
(
blank_oid
));
memset
(
&
blank_oid
,
0x0
,
sizeof
(
blank_oid
));
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
NULL
));
for
(
i
=
0
;
_entries
[
i
].
filename
;
++
i
)
for
(
i
=
0
;
_entries
[
i
].
filename
;
++
i
)
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
...
@@ -346,7 +346,7 @@ void test_object_tree_write__cruel_paths(void)
...
@@ -346,7 +346,7 @@ void test_object_tree_write__cruel_paths(void)
git_oid_fromstr
(
&
bid
,
blob_oid
);
git_oid_fromstr
(
&
bid
,
blob_oid
);
/* create tree */
/* create tree */
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
NULL
));
for
(
scan
=
the_paths
;
*
scan
;
++
scan
)
{
for
(
scan
=
the_paths
;
*
scan
;
++
scan
)
{
cl_git_pass
(
git_treebuilder_insert
(
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
builder
,
*
scan
,
&
bid
,
GIT_FILEMODE_BLOB
));
NULL
,
builder
,
*
scan
,
&
bid
,
GIT_FILEMODE_BLOB
));
...
@@ -374,7 +374,7 @@ void test_object_tree_write__cruel_paths(void)
...
@@ -374,7 +374,7 @@ void test_object_tree_write__cruel_paths(void)
git_tree_free
(
tree
);
git_tree_free
(
tree
);
/* let's try longer paths */
/* let's try longer paths */
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
NULL
));
for
(
scan
=
the_paths
;
*
scan
;
++
scan
)
{
for
(
scan
=
the_paths
;
*
scan
;
++
scan
)
{
cl_git_pass
(
git_treebuilder_insert
(
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
builder
,
*
scan
,
&
id
,
GIT_FILEMODE_TREE
));
NULL
,
builder
,
*
scan
,
&
id
,
GIT_FILEMODE_TREE
));
...
@@ -409,7 +409,7 @@ void test_object_tree_write__protect_filesystems(void)
...
@@ -409,7 +409,7 @@ void test_object_tree_write__protect_filesystems(void)
/* Ensure that (by default) we can write objects with funny names on
/* Ensure that (by default) we can write objects with funny names on
* platforms that are not affected.
* platforms that are not affected.
*/
*/
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
NULL
));
#ifndef GIT_WIN32
#ifndef GIT_WIN32
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
builder
,
".git."
,
&
bid
,
GIT_FILEMODE_BLOB
));
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
builder
,
".git."
,
&
bid
,
GIT_FILEMODE_BLOB
));
...
@@ -430,7 +430,7 @@ void test_object_tree_write__protect_filesystems(void)
...
@@ -430,7 +430,7 @@ void test_object_tree_write__protect_filesystems(void)
cl_repo_set_bool
(
g_repo
,
"core.protectHFS"
,
true
);
cl_repo_set_bool
(
g_repo
,
"core.protectHFS"
,
true
);
cl_repo_set_bool
(
g_repo
,
"core.protectNTFS"
,
true
);
cl_repo_set_bool
(
g_repo
,
"core.protectNTFS"
,
true
);
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
g_repo
,
NULL
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
".git."
,
&
bid
,
GIT_FILEMODE_BLOB
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
".git."
,
&
bid
,
GIT_FILEMODE_BLOB
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
"git~1"
,
&
bid
,
GIT_FILEMODE_BLOB
));
cl_git_fail
(
git_treebuilder_insert
(
NULL
,
builder
,
"git~1"
,
&
bid
,
GIT_FILEMODE_BLOB
));
...
...
tests/repo/iterator.c
View file @
ddf95324
...
@@ -427,7 +427,7 @@ static void build_test_tree(
...
@@ -427,7 +427,7 @@ static void build_test_tree(
git_buf
name
=
GIT_BUF_INIT
;
git_buf
name
=
GIT_BUF_INIT
;
va_list
arglist
;
va_list
arglist
;
cl_git_pass
(
git_treebuilder_
create
(
&
builder
,
repo
,
NULL
));
/* start builder */
cl_git_pass
(
git_treebuilder_
new
(
&
builder
,
repo
,
NULL
));
/* start builder */
va_start
(
arglist
,
fmt
);
va_start
(
arglist
,
fmt
);
while
(
*
scan
)
{
while
(
*
scan
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment