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
f0957589
Commit
f0957589
authored
Mar 04, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stash: refactor to use merge_iterators
parent
90f8408d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
include/git2/stash.h
+6
-6
src/stash.c
+0
-0
tests/stash/apply.c
+12
-12
No files found.
include/git2/stash.h
View file @
f0957589
...
...
@@ -97,10 +97,9 @@ typedef enum {
* the workdir and index will be left untouched.
*
* @param repo The owning repository.
*
* @param index The position within the stash list. 0 points to the
* most recent stashed state.
*
*
most recent stashed state.
*
@param checkout_options Options to control how files are checked out
* @param flags Flags to control the applying process. (see GIT_APPLY_* above)
*
* @return 0 on success, GIT_ENOTFOUND if there's no stashed state for the given
...
...
@@ -109,6 +108,7 @@ typedef enum {
GIT_EXTERN
(
int
)
git_stash_apply
(
git_repository
*
repo
,
size_t
index
,
const
git_checkout_options
*
checkout_options
,
unsigned
int
flags
);
/**
...
...
@@ -167,10 +167,9 @@ GIT_EXTERN(int) git_stash_drop(
* if successful.
*
* @param repo The owning repository.
*
* @param index The position within the stash list. 0 points to the
* most recent stashed state.
*
*
most recent stashed state.
*
@param checkout_options Options to control how files are checked out
* @param flags Flags to control the applying process. (see GIT_APPLY_* above)
*
* @return 0 on success, GIT_ENOTFOUND if there's no stashed state for the given
...
...
@@ -179,6 +178,7 @@ GIT_EXTERN(int) git_stash_drop(
GIT_EXTERN
(
int
)
git_stash_pop
(
git_repository
*
repo
,
size_t
index
,
const
git_checkout_options
*
checkout_options
,
unsigned
int
flags
);
/** @} */
...
...
src/stash.c
View file @
f0957589
This diff is collapsed.
Click to expand it.
tests/stash/apply.c
View file @
f0957589
...
...
@@ -63,7 +63,7 @@ void test_stash_apply__cleanup(void)
void
test_stash_apply__with_default
(
void
)
{
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_DEFAULT
));
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_DEFAULT
));
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
...
...
@@ -74,7 +74,7 @@ void test_stash_apply__with_default(void)
void
test_stash_apply__with_reinstate_index
(
void
)
{
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_REINSTATE_INDEX
));
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_REINSTATE_INDEX
));
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
...
...
@@ -93,7 +93,7 @@ void test_stash_apply__conflict_index_with_default(void)
cl_git_pass
(
git_index_add_bypath
(
repo_index
,
"who"
));
cl_git_pass
(
git_index_write
(
repo_index
));
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_DEFAULT
));
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_DEFAULT
));
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
1
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_INDEX_MODIFIED
);
...
...
@@ -108,7 +108,7 @@ void test_stash_apply__conflict_index_with_reinstate_index(void)
cl_git_pass
(
git_index_add_bypath
(
repo_index
,
"who"
));
cl_git_pass
(
git_index_write
(
repo_index
));
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_REINSTATE_INDEX
),
GIT_EUNMERGED
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_REINSTATE_INDEX
),
GIT_EUNMERGED
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
...
...
@@ -121,7 +121,7 @@ void test_stash_apply__conflict_untracked_with_default(void)
{
cl_git_mkfile
(
"stash/when"
,
"nothing
\n
"
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_DEFAULT
),
GIT_EMERGECONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_DEFAULT
),
GIT_EMERGECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
...
...
@@ -134,7 +134,7 @@ void test_stash_apply__conflict_untracked_with_reinstate_index(void)
{
cl_git_mkfile
(
"stash/when"
,
"nothing
\n
"
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_REINSTATE_INDEX
),
GIT_EMERGECONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_REINSTATE_INDEX
),
GIT_EMERGECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_CURRENT
);
...
...
@@ -147,7 +147,7 @@ void test_stash_apply__conflict_workdir_with_default(void)
{
cl_git_rewritefile
(
"stash/what"
,
"ciao
\n
"
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_DEFAULT
),
GIT_EMERGECONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_DEFAULT
),
GIT_EMERGECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
...
...
@@ -160,7 +160,7 @@ void test_stash_apply__conflict_workdir_with_reinstate_index(void)
{
cl_git_rewritefile
(
"stash/what"
,
"ciao
\n
"
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_REINSTATE_INDEX
),
GIT_EMERGECONFLICT
);
cl_git_fail_with
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_REINSTATE_INDEX
),
GIT_EMERGECONFLICT
);
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
0
);
assert_status
(
repo
,
"what"
,
GIT_STATUS_WT_MODIFIED
);
...
...
@@ -179,7 +179,7 @@ void test_stash_apply__conflict_commit_with_default(void)
cl_git_pass
(
git_index_add_bypath
(
repo_index
,
"what"
));
cl_repo_commit_from_index
(
NULL
,
repo
,
signature
,
0
,
"Other commit"
);
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_DEFAULT
));
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_DEFAULT
));
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
1
);
cl_git_pass
(
git_index_conflict_get
(
&
ancestor
,
&
our
,
&
their
,
repo_index
,
"what"
));
/* unmerged */
...
...
@@ -198,7 +198,7 @@ void test_stash_apply__conflict_commit_with_reinstate_index(void)
cl_git_pass
(
git_index_add_bypath
(
repo_index
,
"what"
));
cl_repo_commit_from_index
(
NULL
,
repo
,
signature
,
0
,
"Other commit"
);
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
GIT_APPLY_REINSTATE_INDEX
));
cl_git_pass
(
git_stash_apply
(
repo
,
0
,
NULL
,
GIT_APPLY_REINSTATE_INDEX
));
cl_assert_equal_i
(
git_index_has_conflicts
(
repo_index
),
1
);
cl_git_pass
(
git_index_conflict_get
(
&
ancestor
,
&
our
,
&
their
,
repo_index
,
"what"
));
/* unmerged */
...
...
@@ -209,7 +209,7 @@ void test_stash_apply__conflict_commit_with_reinstate_index(void)
void
test_stash_apply__pop
(
void
)
{
cl_git_pass
(
git_stash_pop
(
repo
,
0
,
GIT_APPLY_DEFAULT
));
cl_git_pass
(
git_stash_pop
(
repo
,
0
,
NULL
,
GIT_APPLY_DEFAULT
));
cl_git_fail_with
(
git_stash_pop
(
repo
,
0
,
GIT_APPLY_DEFAULT
),
GIT_ENOTFOUND
);
cl_git_fail_with
(
git_stash_pop
(
repo
,
0
,
NULL
,
GIT_APPLY_DEFAULT
),
GIT_ENOTFOUND
);
}
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