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
ae5a9352
Commit
ae5a9352
authored
Sep 30, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure submodule repos and indices are freed
...before the helper's cleanup method tries to delete their files.
parent
526d4c94
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
tests-clar/stash/submodules.c
+16
-4
No files found.
tests-clar/stash/submodules.c
View file @
ae5a9352
...
...
@@ -6,9 +6,7 @@ static git_repository *repo;
static
git_signature
*
signature
;
static
git_oid
stash_tip_oid
;
static
git_index
*
smindex
;
static
git_submodule
*
sm
;
static
git_repository
*
smrepo
;
void
test_stash_submodules__initialize
(
void
)
{
...
...
@@ -17,8 +15,6 @@ void test_stash_submodules__initialize(void)
repo
=
setup_fixture_submodules
();
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
repo
,
"testrepo"
));
cl_git_pass
(
git_submodule_open
(
&
smrepo
,
sm
));
cl_git_pass
(
git_repository_index
(
&
smindex
,
smrepo
));
}
void
test_stash_submodules__cleanup
(
void
)
...
...
@@ -29,6 +25,9 @@ void test_stash_submodules__cleanup(void)
void
test_stash_submodules__does_not_stash_modified_submodules
(
void
)
{
static
git_index
*
smindex
;
static
git_repository
*
smrepo
;
assert_status
(
repo
,
"modified"
,
GIT_STATUS_WT_MODIFIED
);
/* modify file in submodule */
...
...
@@ -36,6 +35,8 @@ void test_stash_submodules__does_not_stash_modified_submodules(void)
assert_status
(
repo
,
"testrepo"
,
GIT_STATUS_WT_MODIFIED
);
/* add file to index in submodule */
cl_git_pass
(
git_submodule_open
(
&
smrepo
,
sm
));
cl_git_pass
(
git_repository_index
(
&
smindex
,
smrepo
));
cl_git_pass
(
git_index_add_bypath
(
smindex
,
"README"
));
/* commit changed index of submodule */
...
...
@@ -46,10 +47,16 @@ void test_stash_submodules__does_not_stash_modified_submodules(void)
assert_status
(
repo
,
"testrepo"
,
GIT_STATUS_WT_MODIFIED
);
assert_status
(
repo
,
"modified"
,
GIT_STATUS_CURRENT
);
git_index_free
(
smindex
);
git_repository_free
(
smrepo
);
}
void
test_stash_submodules__stash_is_empty_with_modified_submodules
(
void
)
{
static
git_index
*
smindex
;
static
git_repository
*
smrepo
;
cl_git_pass
(
git_stash_save
(
&
stash_tip_oid
,
repo
,
signature
,
NULL
,
GIT_STASH_DEFAULT
));
assert_status
(
repo
,
"modified"
,
GIT_STATUS_CURRENT
);
...
...
@@ -58,6 +65,8 @@ void test_stash_submodules__stash_is_empty_with_modified_submodules(void)
assert_status
(
repo
,
"testrepo"
,
GIT_STATUS_WT_MODIFIED
);
/* add file to index in submodule */
cl_git_pass
(
git_submodule_open
(
&
smrepo
,
sm
));
cl_git_pass
(
git_repository_index
(
&
smindex
,
smrepo
));
cl_git_pass
(
git_index_add_bypath
(
smindex
,
"README"
));
/* commit changed index of submodule */
...
...
@@ -65,4 +74,7 @@ void test_stash_submodules__stash_is_empty_with_modified_submodules(void)
assert_status
(
repo
,
"testrepo"
,
GIT_STATUS_WT_MODIFIED
);
cl_git_fail_with
(
git_stash_save
(
&
stash_tip_oid
,
repo
,
signature
,
NULL
,
GIT_STASH_DEFAULT
),
GIT_ENOTFOUND
);
git_index_free
(
smindex
);
git_repository_free
(
smrepo
);
}
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