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
fcbbe1bd
Commit
fcbbe1bd
authored
Mar 26, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2166 from ethomson/giterr_restore
clone: don't overwrite original error message
parents
451aaf86
1df8ad01
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
src/clone.c
+5
-0
tests/core/errors.c
+24
-0
No files found.
src/clone.c
View file @
fcbbe1bd
...
...
@@ -430,10 +430,15 @@ int git_clone(
}
if
(
error
!=
0
)
{
git_error_state
last_error
=
{
0
};
giterr_capture
(
&
last_error
,
error
);
git_repository_free
(
repo
);
repo
=
NULL
;
(
void
)
git_futils_rmdir_r
(
local_path
,
NULL
,
rmdir_flags
);
giterr_restore
(
&
last_error
);
}
*
out
=
repo
;
...
...
tests/core/errors.c
View file @
fcbbe1bd
...
...
@@ -85,3 +85,27 @@ void test_core_errors__new_school(void)
giterr_clear
();
}
void
test_core_errors__restore
(
void
)
{
git_error_state
err_state
=
{
0
};
giterr_clear
();
cl_assert
(
giterr_last
()
==
NULL
);
cl_assert_equal_i
(
0
,
giterr_capture
(
&
err_state
,
0
));
memset
(
&
err_state
,
0x0
,
sizeof
(
git_error_state
));
giterr_set
(
42
,
"Foo: %s"
,
"bar"
);
cl_assert_equal_i
(
-
1
,
giterr_capture
(
&
err_state
,
-
1
));
cl_assert
(
giterr_last
()
==
NULL
);
giterr_set
(
99
,
"Bar: %s"
,
"foo"
);
giterr_restore
(
&
err_state
);
cl_assert_equal_i
(
42
,
giterr_last
()
->
klass
);
cl_assert_equal_s
(
"Foo: bar"
,
giterr_last
()
->
message
);
}
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