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
7149a625
Commit
7149a625
authored
Apr 27, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Returning error if dereferencing operation fails.
parent
387d01b8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
+6
-1
src/revparse.c
+4
-1
tests-clar/refs/revparse.c
+2
-0
No files found.
src/revparse.c
View file @
7149a625
...
@@ -174,6 +174,10 @@ static int dereference_to_type(git_object **out, git_object *obj, git_otype targ
...
@@ -174,6 +174,10 @@ static int dereference_to_type(git_object **out, git_object *obj, git_otype targ
/* Dereference once, if possible. */
/* Dereference once, if possible. */
obj2
=
dereference_object
(
obj1
);
obj2
=
dereference_object
(
obj1
);
if
(
!
obj2
)
{
giterr_set
(
GITERR_REFERENCE
,
"Can't dereference to type"
);
return
GIT_ERROR
;
}
if
(
obj1
!=
obj
)
{
if
(
obj1
!=
obj
)
{
git_object_free
(
obj1
);
git_object_free
(
obj1
);
}
}
...
@@ -226,7 +230,6 @@ static int handle_caret_syntax(git_object **out, git_object *obj, const char *mo
...
@@ -226,7 +230,6 @@ static int handle_caret_syntax(git_object **out, git_object *obj, const char *mo
/* {...} -> Dereference until we reach an object of a certain type. */
/* {...} -> Dereference until we reach an object of a certain type. */
if
(
dereference_to_type
(
out
,
obj
,
parse_obj_type
(
movement
))
<
0
)
{
if
(
dereference_to_type
(
out
,
obj
,
parse_obj_type
(
movement
))
<
0
)
{
giterr_set
(
GITERR_REFERENCE
,
"Can't dereference to type"
);
return
GIT_ERROR
;
return
GIT_ERROR
;
}
}
return
0
;
return
0
;
...
...
tests-clar/refs/revparse.c
View file @
7149a625
...
@@ -105,6 +105,8 @@ void test_refs_revparse__to_type(void)
...
@@ -105,6 +105,8 @@ void test_refs_revparse__to_type(void)
oid_str_cmp
(
g_obj
,
"944c0f6e4dfa41595e6eb3ceecdb14f50fe18162"
);
oid_str_cmp
(
g_obj
,
"944c0f6e4dfa41595e6eb3ceecdb14f50fe18162"
);
cl_git_pass
(
git_revparse_single
(
&
g_obj
,
g_repo
,
"point_to_blob^{blob}"
));
cl_git_pass
(
git_revparse_single
(
&
g_obj
,
g_repo
,
"point_to_blob^{blob}"
));
oid_str_cmp
(
g_obj
,
"1385f264afb75a56a5bec74243be9b367ba4ca08"
);
oid_str_cmp
(
g_obj
,
"1385f264afb75a56a5bec74243be9b367ba4ca08"
);
cl_git_fail
(
git_revparse_single
(
&
g_obj
,
g_repo
,
"wrapped_tag^{blob}"
));
}
}
void
test_refs_revparse__reflog
(
void
)
void
test_refs_revparse__reflog
(
void
)
...
...
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