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
785d8c48
Commit
785d8c48
authored
Mar 04, 2016
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3653 from libgit2/cmn/treebuilder-submodule
treebuilder: don't try to verify submodules exist in the odb
parents
16099833
ea5bf6bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
+14
-1
src/tree.c
+2
-1
tests/object/tree/write.c
+12
-0
No files found.
src/tree.c
View file @
785d8c48
...
@@ -757,7 +757,8 @@ int git_treebuilder_insert(
...
@@ -757,7 +757,8 @@ int git_treebuilder_insert(
if
(
!
valid_entry_name
(
bld
->
repo
,
filename
))
if
(
!
valid_entry_name
(
bld
->
repo
,
filename
))
return
tree_error
(
"Failed to insert entry. Invalid name for a tree entry"
,
filename
);
return
tree_error
(
"Failed to insert entry. Invalid name for a tree entry"
,
filename
);
if
(
!
git_object__is_valid
(
bld
->
repo
,
id
,
otype_from_mode
(
filemode
)))
if
(
filemode
!=
GIT_FILEMODE_COMMIT
&&
!
git_object__is_valid
(
bld
->
repo
,
id
,
otype_from_mode
(
filemode
)))
return
tree_error
(
"Failed to insert entry; invalid object specified"
,
filename
);
return
tree_error
(
"Failed to insert entry; invalid object specified"
,
filename
);
pos
=
git_strmap_lookup_index
(
bld
->
map
,
filename
);
pos
=
git_strmap_lookup_index
(
bld
->
map
,
filename
);
...
...
tests/object/tree/write.c
View file @
785d8c48
...
@@ -490,13 +490,25 @@ static void test_invalid_objects(bool should_allow_invalid)
...
@@ -490,13 +490,25 @@ static void test_invalid_objects(bool should_allow_invalid)
git_treebuilder_free
(
builder
);
git_treebuilder_free
(
builder
);
}
}
static
void
test_inserting_submodule
(
void
)
{
git_treebuilder
*
bld
;
git_oid
sm_id
;
cl_git_pass
(
git_treebuilder_new
(
&
bld
,
g_repo
,
NULL
));
cl_git_pass
(
git_treebuilder_insert
(
NULL
,
bld
,
"sm"
,
&
sm_id
,
GIT_FILEMODE_COMMIT
));
git_treebuilder_free
(
bld
);
}
void
test_object_tree_write__object_validity
(
void
)
void
test_object_tree_write__object_validity
(
void
)
{
{
/* Ensure that we cannot add invalid objects by default */
/* Ensure that we cannot add invalid objects by default */
test_invalid_objects
(
false
);
test_invalid_objects
(
false
);
test_inserting_submodule
();
/* Ensure that we can turn off validation */
/* Ensure that we can turn off validation */
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
,
0
));
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION
,
0
));
test_invalid_objects
(
true
);
test_invalid_objects
(
true
);
test_inserting_submodule
();
}
}
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