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
8915a140
Commit
8915a140
authored
May 01, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Report a couple object error conditions
parent
734c6fc1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
src/object.c
+14
-8
No files found.
src/object.c
View file @
8915a140
...
@@ -122,8 +122,10 @@ int git_object_lookup_prefix(
...
@@ -122,8 +122,10 @@ int git_object_lookup_prefix(
assert
(
repo
&&
object_out
&&
id
);
assert
(
repo
&&
object_out
&&
id
);
if
(
len
<
GIT_OID_MINPREFIXLEN
)
if
(
len
<
GIT_OID_MINPREFIXLEN
)
{
giterr_set
(
GITERR_OBJECT
,
"Ambiguous lookup - OID prefix is too short"
);
return
GIT_EAMBIGUOUS
;
return
GIT_EAMBIGUOUS
;
}
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
);
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
);
if
(
error
<
0
)
if
(
error
<
0
)
...
@@ -311,18 +313,22 @@ int git_object_peel(
...
@@ -311,18 +313,22 @@ int git_object_peel(
git_object
*
source
,
*
deref
=
NULL
;
git_object
*
source
,
*
deref
=
NULL
;
int
error
;
int
error
;
if
(
target_type
!=
GIT_OBJ_TAG
&&
target_type
!=
GIT_OBJ_COMMIT
&&
target_type
!=
GIT_OBJ_TREE
&&
target_type
!=
GIT_OBJ_BLOB
&&
target_type
!=
GIT_OBJ_ANY
)
return
GIT_EINVALIDSPEC
;
assert
(
object
&&
peeled
);
assert
(
object
&&
peeled
);
if
(
git_object_type
(
object
)
==
target_type
)
if
(
git_object_type
(
object
)
==
target_type
)
return
git_object_dup
(
peeled
,
(
git_object
*
)
object
);
return
git_object_dup
(
peeled
,
(
git_object
*
)
object
);
if
(
target_type
!=
GIT_OBJ_TAG
&&
target_type
!=
GIT_OBJ_COMMIT
&&
target_type
!=
GIT_OBJ_TREE
&&
target_type
!=
GIT_OBJ_BLOB
&&
target_type
!=
GIT_OBJ_ANY
)
{
giterr_set
(
GITERR_OBJECT
,
"Cannot peel to object type %d"
,
(
int
)
target_type
);
return
GIT_EINVALIDSPEC
;
}
source
=
(
git_object
*
)
object
;
source
=
(
git_object
*
)
object
;
while
(
!
(
error
=
dereference_object
(
&
deref
,
source
)))
{
while
(
!
(
error
=
dereference_object
(
&
deref
,
source
)))
{
...
...
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