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
f00db9ed
Commit
f00db9ed
authored
Jul 27, 2018
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tree: rename from_tree to validate and clarify the tree in the test
parent
2dff7e28
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
src/tree.c
+6
-6
tests/object/tree/update.c
+1
-0
No files found.
src/tree.c
View file @
f00db9ed
...
@@ -448,15 +448,15 @@ static int append_entry(
...
@@ -448,15 +448,15 @@ static int append_entry(
const
char
*
filename
,
const
char
*
filename
,
const
git_oid
*
id
,
const
git_oid
*
id
,
git_filemode_t
filemode
,
git_filemode_t
filemode
,
bool
from_tre
e
)
bool
validat
e
)
{
{
git_tree_entry
*
entry
;
git_tree_entry
*
entry
;
int
error
=
0
;
int
error
=
0
;
if
(
!
from_tre
e
&&
!
valid_entry_name
(
bld
->
repo
,
filename
))
if
(
validat
e
&&
!
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
(
!
from_tre
e
&&
git_oid_iszero
(
id
))
if
(
validat
e
&&
git_oid_iszero
(
id
))
return
tree_error
(
"failed to insert entry: invalid null OID for a tree entry"
,
filename
);
return
tree_error
(
"failed to insert entry: invalid null OID for a tree entry"
,
filename
);
entry
=
alloc_entry
(
filename
,
strlen
(
filename
),
id
);
entry
=
alloc_entry
(
filename
,
strlen
(
filename
),
id
);
...
@@ -554,12 +554,12 @@ static int write_tree(
...
@@ -554,12 +554,12 @@ static int write_tree(
last_comp
=
subdir
;
last_comp
=
subdir
;
}
}
error
=
append_entry
(
bld
,
last_comp
,
&
sub_oid
,
S_IFDIR
,
fals
e
);
error
=
append_entry
(
bld
,
last_comp
,
&
sub_oid
,
S_IFDIR
,
tru
e
);
git__free
(
subdir
);
git__free
(
subdir
);
if
(
error
<
0
)
if
(
error
<
0
)
goto
on_error
;
goto
on_error
;
}
else
{
}
else
{
error
=
append_entry
(
bld
,
filename
,
&
entry
->
id
,
entry
->
mode
,
fals
e
);
error
=
append_entry
(
bld
,
filename
,
&
entry
->
id
,
entry
->
mode
,
tru
e
);
if
(
error
<
0
)
if
(
error
<
0
)
goto
on_error
;
goto
on_error
;
}
}
...
@@ -658,7 +658,7 @@ int git_treebuilder_new(
...
@@ -658,7 +658,7 @@ int git_treebuilder_new(
bld
,
entry_src
->
filename
,
bld
,
entry_src
->
filename
,
entry_src
->
oid
,
entry_src
->
oid
,
entry_src
->
attr
,
entry_src
->
attr
,
tru
e
)
<
0
)
fals
e
)
<
0
)
goto
on_error
;
goto
on_error
;
}
}
}
}
...
...
tests/object/tree/update.c
View file @
f00db9ed
...
@@ -293,6 +293,7 @@ void test_object_tree_update__remove_invalid_submodule(void)
...
@@ -293,6 +293,7 @@ void test_object_tree_update__remove_invalid_submodule(void)
{
GIT_TREE_UPDATE_REMOVE
,
{{
0
}},
GIT_FILEMODE_BLOB
,
"submodule"
},
{
GIT_TREE_UPDATE_REMOVE
,
{{
0
}},
GIT_FILEMODE_BLOB
,
"submodule"
},
};
};
/* This tree contains a submodule with an all-zero commit for a submodule named 'submodule' */
cl_git_pass
(
git_oid_fromstr
(
&
baseline_id
,
"396c7f1adb7925f51ba13a75f48252f44c5a14a2"
));
cl_git_pass
(
git_oid_fromstr
(
&
baseline_id
,
"396c7f1adb7925f51ba13a75f48252f44c5a14a2"
));
cl_git_pass
(
git_tree_lookup
(
&
baseline
,
g_repo
,
&
baseline_id
));
cl_git_pass
(
git_tree_lookup
(
&
baseline
,
g_repo
,
&
baseline_id
));
cl_git_pass
(
git_tree_create_updated
(
&
updated_tree_id
,
g_repo
,
baseline
,
1
,
updates
));
cl_git_pass
(
git_tree_create_updated
(
&
updated_tree_id
,
g_repo
,
baseline
,
1
,
updates
));
...
...
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