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
0ba4dca5
Commit
0ba4dca5
authored
Jul 22, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git_cherry_pick -> git_cherrypick
parent
091165c5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
88 additions
and
88 deletions
+88
-88
include/git2/cherrypick.h
+15
-15
include/git2/repository.h
+1
-1
src/cherrypick.c
+37
-37
src/refs.h
+1
-1
src/repository.c
+3
-3
tests/cherrypick/bare.c
+3
-3
tests/cherrypick/workdir.c
+26
-26
tests/repo/state.c
+2
-2
No files found.
include/git2/cherrypick.h
View file @
0ba4dca5
...
@@ -28,21 +28,21 @@ typedef struct {
...
@@ -28,21 +28,21 @@ typedef struct {
git_merge_options
merge_opts
;
git_merge_options
merge_opts
;
git_checkout_options
checkout_opts
;
git_checkout_options
checkout_opts
;
}
git_cherry
_
pick_options
;
}
git_cherrypick_options
;
#define GIT_CHERRY
_
PICK_OPTIONS_VERSION 1
#define GIT_CHERRYPICK_OPTIONS_VERSION 1
#define GIT_CHERRY
_PICK_OPTIONS_INIT {GIT_CHERRY_
PICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
#define GIT_CHERRY
PICK_OPTIONS_INIT {GIT_CHERRY
PICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
/**
/**
* Initializes a `git_cherry
_
pick_options` with default values. Equivalent to
* Initializes a `git_cherrypick_options` with default values. Equivalent to
* creating an instance with GIT_CHERRY
_
PICK_OPTIONS_INIT.
* creating an instance with GIT_CHERRYPICK_OPTIONS_INIT.
*
*
* @param opts the `git_cherry
_
pick_options` struct to initialize
* @param opts the `git_cherrypick_options` struct to initialize
* @param version Version of struct; pass `GIT_CHERRY
_
PICK_OPTIONS_VERSION`
* @param version Version of struct; pass `GIT_CHERRYPICK_OPTIONS_VERSION`
* @return Zero on success; -1 on failure.
* @return Zero on success; -1 on failure.
*/
*/
GIT_EXTERN
(
int
)
git_cherry
_
pick_init_options
(
GIT_EXTERN
(
int
)
git_cherrypick_init_options
(
git_cherry
_
pick_options
*
opts
,
git_cherrypick_options
*
opts
,
unsigned
int
version
);
unsigned
int
version
);
/**
/**
...
@@ -53,16 +53,16 @@ GIT_EXTERN(int) git_cherry_pick_init_options(
...
@@ -53,16 +53,16 @@ GIT_EXTERN(int) git_cherry_pick_init_options(
*
*
* @param out pointer to store the index result in
* @param out pointer to store the index result in
* @param repo the repository that contains the given commits
* @param repo the repository that contains the given commits
* @param cherry
_
pick_commit the commit to cherry-pick
* @param cherrypick_commit the commit to cherry-pick
* @param our_commit the commit to revert against (eg, HEAD)
* @param our_commit the commit to revert against (eg, HEAD)
* @param mainline the parent of the revert commit, if it is a merge
* @param mainline the parent of the revert commit, if it is a merge
* @param merge_options the merge options (or null for defaults)
* @param merge_options the merge options (or null for defaults)
* @return zero on success, -1 on failure.
* @return zero on success, -1 on failure.
*/
*/
GIT_EXTERN
(
int
)
git_cherry
_
pick_commit
(
GIT_EXTERN
(
int
)
git_cherrypick_commit
(
git_index
**
out
,
git_index
**
out
,
git_repository
*
repo
,
git_repository
*
repo
,
git_commit
*
cherry
_
pick_commit
,
git_commit
*
cherrypick_commit
,
git_commit
*
our_commit
,
git_commit
*
our_commit
,
unsigned
int
mainline
,
unsigned
int
mainline
,
const
git_merge_options
*
merge_options
);
const
git_merge_options
*
merge_options
);
...
@@ -72,13 +72,13 @@ GIT_EXTERN(int) git_cherry_pick_commit(
...
@@ -72,13 +72,13 @@ GIT_EXTERN(int) git_cherry_pick_commit(
*
*
* @param repo the repository to cherry-pick
* @param repo the repository to cherry-pick
* @param commit the commit to cherry-pick
* @param commit the commit to cherry-pick
* @param cherry
_
pick_options the cherry-pick options (or null for defaults)
* @param cherrypick_options the cherry-pick options (or null for defaults)
* @return zero on success, -1 on failure.
* @return zero on success, -1 on failure.
*/
*/
GIT_EXTERN
(
int
)
git_cherry
_
pick
(
GIT_EXTERN
(
int
)
git_cherrypick
(
git_repository
*
repo
,
git_repository
*
repo
,
git_commit
*
commit
,
git_commit
*
commit
,
const
git_cherry
_pick_options
*
cherry_
pick_options
);
const
git_cherry
pick_options
*
cherry
pick_options
);
/** @} */
/** @} */
GIT_END_DECL
GIT_END_DECL
...
...
include/git2/repository.h
View file @
0ba4dca5
...
@@ -662,7 +662,7 @@ typedef enum {
...
@@ -662,7 +662,7 @@ typedef enum {
GIT_REPOSITORY_STATE_NONE
,
GIT_REPOSITORY_STATE_NONE
,
GIT_REPOSITORY_STATE_MERGE
,
GIT_REPOSITORY_STATE_MERGE
,
GIT_REPOSITORY_STATE_REVERT
,
GIT_REPOSITORY_STATE_REVERT
,
GIT_REPOSITORY_STATE_CHERRY
_
PICK
,
GIT_REPOSITORY_STATE_CHERRYPICK
,
GIT_REPOSITORY_STATE_BISECT
,
GIT_REPOSITORY_STATE_BISECT
,
GIT_REPOSITORY_STATE_REBASE
,
GIT_REPOSITORY_STATE_REBASE
,
GIT_REPOSITORY_STATE_REBASE_INTERACTIVE
,
GIT_REPOSITORY_STATE_REBASE_INTERACTIVE
,
...
...
src/cherrypick.c
View file @
0ba4dca5
...
@@ -17,9 +17,9 @@
...
@@ -17,9 +17,9 @@
#include "git2/commit.h"
#include "git2/commit.h"
#include "git2/sys/commit.h"
#include "git2/sys/commit.h"
#define GIT_CHERRY
_
PICK_FILE_MODE 0666
#define GIT_CHERRYPICK_FILE_MODE 0666
static
int
write_cherry
_
pick_head
(
static
int
write_cherrypick_head
(
git_repository
*
repo
,
git_repository
*
repo
,
const
char
*
commit_oidstr
)
const
char
*
commit_oidstr
)
{
{
...
@@ -27,8 +27,8 @@ static int write_cherry_pick_head(
...
@@ -27,8 +27,8 @@ static int write_cherry_pick_head(
git_buf
file_path
=
GIT_BUF_INIT
;
git_buf
file_path
=
GIT_BUF_INIT
;
int
error
=
0
;
int
error
=
0
;
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_CHERRY
_
PICK_HEAD_FILE
))
>=
0
&&
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_CHERRYPICK_HEAD_FILE
))
>=
0
&&
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_FORCE
,
GIT_CHERRY
_
PICK_FILE_MODE
))
>=
0
&&
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_FORCE
,
GIT_CHERRYPICK_FILE_MODE
))
>=
0
&&
(
error
=
git_filebuf_printf
(
&
file
,
"%s
\n
"
,
commit_oidstr
))
>=
0
)
(
error
=
git_filebuf_printf
(
&
file
,
"%s
\n
"
,
commit_oidstr
))
>=
0
)
error
=
git_filebuf_commit
(
&
file
);
error
=
git_filebuf_commit
(
&
file
);
...
@@ -49,7 +49,7 @@ static int write_merge_msg(
...
@@ -49,7 +49,7 @@ static int write_merge_msg(
int
error
=
0
;
int
error
=
0
;
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_MERGE_MSG_FILE
))
<
0
||
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_MERGE_MSG_FILE
))
<
0
||
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_FORCE
,
GIT_CHERRY
_
PICK_FILE_MODE
))
<
0
||
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_FORCE
,
GIT_CHERRYPICK_FILE_MODE
))
<
0
||
(
error
=
git_filebuf_printf
(
&
file
,
"%s"
,
commit_msg
))
<
0
)
(
error
=
git_filebuf_printf
(
&
file
,
"%s"
,
commit_msg
))
<
0
)
goto
cleanup
;
goto
cleanup
;
...
@@ -64,10 +64,10 @@ cleanup:
...
@@ -64,10 +64,10 @@ cleanup:
return
error
;
return
error
;
}
}
static
int
cherry
_
pick_normalize_opts
(
static
int
cherrypick_normalize_opts
(
git_repository
*
repo
,
git_repository
*
repo
,
git_cherry
_
pick_options
*
opts
,
git_cherrypick_options
*
opts
,
const
git_cherry
_
pick_options
*
given
,
const
git_cherrypick_options
*
given
,
const
char
*
their_label
)
const
char
*
their_label
)
{
{
int
error
=
0
;
int
error
=
0
;
...
@@ -77,10 +77,10 @@ static int cherry_pick_normalize_opts(
...
@@ -77,10 +77,10 @@ static int cherry_pick_normalize_opts(
GIT_UNUSED
(
repo
);
GIT_UNUSED
(
repo
);
if
(
given
!=
NULL
)
if
(
given
!=
NULL
)
memcpy
(
opts
,
given
,
sizeof
(
git_cherry
_
pick_options
));
memcpy
(
opts
,
given
,
sizeof
(
git_cherrypick_options
));
else
{
else
{
git_cherry
_pick_options
default_opts
=
GIT_CHERRY_
PICK_OPTIONS_INIT
;
git_cherry
pick_options
default_opts
=
GIT_CHERRY
PICK_OPTIONS_INIT
;
memcpy
(
opts
,
&
default_opts
,
sizeof
(
git_cherry
_
pick_options
));
memcpy
(
opts
,
&
default_opts
,
sizeof
(
git_cherrypick_options
));
}
}
if
(
!
opts
->
checkout_opts
.
checkout_strategy
)
if
(
!
opts
->
checkout_opts
.
checkout_strategy
)
...
@@ -95,14 +95,14 @@ static int cherry_pick_normalize_opts(
...
@@ -95,14 +95,14 @@ static int cherry_pick_normalize_opts(
return
error
;
return
error
;
}
}
static
int
cherry
_
pick_state_cleanup
(
git_repository
*
repo
)
static
int
cherrypick_state_cleanup
(
git_repository
*
repo
)
{
{
const
char
*
state_files
[]
=
{
GIT_CHERRY
_
PICK_HEAD_FILE
,
GIT_MERGE_MSG_FILE
};
const
char
*
state_files
[]
=
{
GIT_CHERRYPICK_HEAD_FILE
,
GIT_MERGE_MSG_FILE
};
return
git_repository__cleanup_files
(
repo
,
state_files
,
ARRAY_SIZE
(
state_files
));
return
git_repository__cleanup_files
(
repo
,
state_files
,
ARRAY_SIZE
(
state_files
));
}
}
static
int
cherry
_
pick_seterr
(
git_commit
*
commit
,
const
char
*
fmt
)
static
int
cherrypick_seterr
(
git_commit
*
commit
,
const
char
*
fmt
)
{
{
char
commit_oidstr
[
GIT_OID_HEXSZ
+
1
];
char
commit_oidstr
[
GIT_OID_HEXSZ
+
1
];
...
@@ -112,60 +112,60 @@ static int cherry_pick_seterr(git_commit *commit, const char *fmt)
...
@@ -112,60 +112,60 @@ static int cherry_pick_seterr(git_commit *commit, const char *fmt)
return
-
1
;
return
-
1
;
}
}
int
git_cherry
_
pick_commit
(
int
git_cherrypick_commit
(
git_index
**
out
,
git_index
**
out
,
git_repository
*
repo
,
git_repository
*
repo
,
git_commit
*
cherry
_
pick_commit
,
git_commit
*
cherrypick_commit
,
git_commit
*
our_commit
,
git_commit
*
our_commit
,
unsigned
int
mainline
,
unsigned
int
mainline
,
const
git_merge_options
*
merge_opts
)
const
git_merge_options
*
merge_opts
)
{
{
git_commit
*
parent_commit
=
NULL
;
git_commit
*
parent_commit
=
NULL
;
git_tree
*
parent_tree
=
NULL
,
*
our_tree
=
NULL
,
*
cherry
_
pick_tree
=
NULL
;
git_tree
*
parent_tree
=
NULL
,
*
our_tree
=
NULL
,
*
cherrypick_tree
=
NULL
;
int
parent
=
0
,
error
=
0
;
int
parent
=
0
,
error
=
0
;
assert
(
out
&&
repo
&&
cherry
_
pick_commit
&&
our_commit
);
assert
(
out
&&
repo
&&
cherrypick_commit
&&
our_commit
);
if
(
git_commit_parentcount
(
cherry
_
pick_commit
)
>
1
)
{
if
(
git_commit_parentcount
(
cherrypick_commit
)
>
1
)
{
if
(
!
mainline
)
if
(
!
mainline
)
return
cherry
_pick_seterr
(
cherry_
pick_commit
,
return
cherry
pick_seterr
(
cherry
pick_commit
,
"Mainline branch is not specified but %s is a merge commit"
);
"Mainline branch is not specified but %s is a merge commit"
);
parent
=
mainline
;
parent
=
mainline
;
}
else
{
}
else
{
if
(
mainline
)
if
(
mainline
)
return
cherry
_pick_seterr
(
cherry_
pick_commit
,
return
cherry
pick_seterr
(
cherry
pick_commit
,
"Mainline branch specified but %s is not a merge commit"
);
"Mainline branch specified but %s is not a merge commit"
);
parent
=
git_commit_parentcount
(
cherry
_
pick_commit
);
parent
=
git_commit_parentcount
(
cherrypick_commit
);
}
}
if
(
parent
&&
if
(
parent
&&
((
error
=
git_commit_parent
(
&
parent_commit
,
cherry
_
pick_commit
,
(
parent
-
1
)))
<
0
||
((
error
=
git_commit_parent
(
&
parent_commit
,
cherrypick_commit
,
(
parent
-
1
)))
<
0
||
(
error
=
git_commit_tree
(
&
parent_tree
,
parent_commit
))
<
0
))
(
error
=
git_commit_tree
(
&
parent_tree
,
parent_commit
))
<
0
))
goto
done
;
goto
done
;
if
((
error
=
git_commit_tree
(
&
cherry
_pick_tree
,
cherry_
pick_commit
))
<
0
||
if
((
error
=
git_commit_tree
(
&
cherry
pick_tree
,
cherry
pick_commit
))
<
0
||
(
error
=
git_commit_tree
(
&
our_tree
,
our_commit
))
<
0
)
(
error
=
git_commit_tree
(
&
our_tree
,
our_commit
))
<
0
)
goto
done
;
goto
done
;
error
=
git_merge_trees
(
out
,
repo
,
parent_tree
,
our_tree
,
cherry
_
pick_tree
,
merge_opts
);
error
=
git_merge_trees
(
out
,
repo
,
parent_tree
,
our_tree
,
cherrypick_tree
,
merge_opts
);
done:
done:
git_tree_free
(
parent_tree
);
git_tree_free
(
parent_tree
);
git_tree_free
(
our_tree
);
git_tree_free
(
our_tree
);
git_tree_free
(
cherry
_
pick_tree
);
git_tree_free
(
cherrypick_tree
);
git_commit_free
(
parent_commit
);
git_commit_free
(
parent_commit
);
return
error
;
return
error
;
}
}
int
git_cherry
_
pick
(
int
git_cherrypick
(
git_repository
*
repo
,
git_repository
*
repo
,
git_commit
*
commit
,
git_commit
*
commit
,
const
git_cherry
_
pick_options
*
given_opts
)
const
git_cherrypick_options
*
given_opts
)
{
{
git_cherry
_
pick_options
opts
;
git_cherrypick_options
opts
;
git_reference
*
our_ref
=
NULL
;
git_reference
*
our_ref
=
NULL
;
git_commit
*
our_commit
=
NULL
;
git_commit
*
our_commit
=
NULL
;
char
commit_oidstr
[
GIT_OID_HEXSZ
+
1
];
char
commit_oidstr
[
GIT_OID_HEXSZ
+
1
];
...
@@ -176,7 +176,7 @@ int git_cherry_pick(
...
@@ -176,7 +176,7 @@ int git_cherry_pick(
assert
(
repo
&&
commit
);
assert
(
repo
&&
commit
);
GITERR_CHECK_VERSION
(
given_opts
,
GIT_CHERRY
_PICK_OPTIONS_VERSION
,
"git_cherry_
pick_options"
);
GITERR_CHECK_VERSION
(
given_opts
,
GIT_CHERRY
PICK_OPTIONS_VERSION
,
"git_cherry
pick_options"
);
if
((
error
=
git_repository__ensure_not_bare
(
repo
,
"cherry-pick"
))
<
0
)
if
((
error
=
git_repository__ensure_not_bare
(
repo
,
"cherry-pick"
))
<
0
)
return
error
;
return
error
;
...
@@ -191,11 +191,11 @@ int git_cherry_pick(
...
@@ -191,11 +191,11 @@ int git_cherry_pick(
if
((
error
=
write_merge_msg
(
repo
,
commit_msg
))
<
0
||
if
((
error
=
write_merge_msg
(
repo
,
commit_msg
))
<
0
||
(
error
=
git_buf_printf
(
&
their_label
,
"%.7s... %s"
,
commit_oidstr
,
commit_summary
))
<
0
||
(
error
=
git_buf_printf
(
&
their_label
,
"%.7s... %s"
,
commit_oidstr
,
commit_summary
))
<
0
||
(
error
=
cherry
_
pick_normalize_opts
(
repo
,
&
opts
,
given_opts
,
git_buf_cstr
(
&
their_label
)))
<
0
||
(
error
=
cherrypick_normalize_opts
(
repo
,
&
opts
,
given_opts
,
git_buf_cstr
(
&
their_label
)))
<
0
||
(
error
=
write_cherry
_
pick_head
(
repo
,
commit_oidstr
))
<
0
||
(
error
=
write_cherrypick_head
(
repo
,
commit_oidstr
))
<
0
||
(
error
=
git_repository_head
(
&
our_ref
,
repo
))
<
0
||
(
error
=
git_repository_head
(
&
our_ref
,
repo
))
<
0
||
(
error
=
git_reference_peel
((
git_object
**
)
&
our_commit
,
our_ref
,
GIT_OBJ_COMMIT
))
<
0
||
(
error
=
git_reference_peel
((
git_object
**
)
&
our_commit
,
our_ref
,
GIT_OBJ_COMMIT
))
<
0
||
(
error
=
git_cherry
_
pick_commit
(
&
index_new
,
repo
,
commit
,
our_commit
,
opts
.
mainline
,
&
opts
.
merge_opts
))
<
0
||
(
error
=
git_cherrypick_commit
(
&
index_new
,
repo
,
commit
,
our_commit
,
opts
.
mainline
,
&
opts
.
merge_opts
))
<
0
||
(
error
=
git_merge__check_result
(
repo
,
index_new
))
<
0
||
(
error
=
git_merge__check_result
(
repo
,
index_new
))
<
0
||
(
error
=
git_merge__append_conflicts_to_merge_msg
(
repo
,
index_new
))
<
0
||
(
error
=
git_merge__append_conflicts_to_merge_msg
(
repo
,
index_new
))
<
0
||
(
error
=
git_checkout_index
(
repo
,
index_new
,
&
opts
.
checkout_opts
))
<
0
)
(
error
=
git_checkout_index
(
repo
,
index_new
,
&
opts
.
checkout_opts
))
<
0
)
...
@@ -203,7 +203,7 @@ int git_cherry_pick(
...
@@ -203,7 +203,7 @@ int git_cherry_pick(
goto
done
;
goto
done
;
on_error:
on_error:
cherry
_
pick_state_cleanup
(
repo
);
cherrypick_state_cleanup
(
repo
);
done:
done:
git_index_free
(
index_new
);
git_index_free
(
index_new
);
...
@@ -214,10 +214,10 @@ done:
...
@@ -214,10 +214,10 @@ done:
return
error
;
return
error
;
}
}
int
git_cherry
_
pick_init_options
(
int
git_cherrypick_init_options
(
git_cherry
_
pick_options
*
opts
,
unsigned
int
version
)
git_cherrypick_options
*
opts
,
unsigned
int
version
)
{
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE
(
GIT_INIT_STRUCTURE_FROM_TEMPLATE
(
opts
,
version
,
git_cherry
_pick_options
,
GIT_CHERRY_
PICK_OPTIONS_INIT
);
opts
,
version
,
git_cherry
pick_options
,
GIT_CHERRY
PICK_OPTIONS_INIT
);
return
0
;
return
0
;
}
}
src/refs.h
View file @
0ba4dca5
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#define GIT_FETCH_HEAD_FILE "FETCH_HEAD"
#define GIT_FETCH_HEAD_FILE "FETCH_HEAD"
#define GIT_MERGE_HEAD_FILE "MERGE_HEAD"
#define GIT_MERGE_HEAD_FILE "MERGE_HEAD"
#define GIT_REVERT_HEAD_FILE "REVERT_HEAD"
#define GIT_REVERT_HEAD_FILE "REVERT_HEAD"
#define GIT_CHERRY
_
PICK_HEAD_FILE "CHERRY_PICK_HEAD"
#define GIT_CHERRYPICK_HEAD_FILE "CHERRY_PICK_HEAD"
#define GIT_BISECT_LOG_FILE "BISECT_LOG"
#define GIT_BISECT_LOG_FILE "BISECT_LOG"
#define GIT_REBASE_MERGE_DIR "rebase-merge/"
#define GIT_REBASE_MERGE_DIR "rebase-merge/"
#define GIT_REBASE_MERGE_INTERACTIVE_FILE GIT_REBASE_MERGE_DIR "interactive"
#define GIT_REBASE_MERGE_INTERACTIVE_FILE GIT_REBASE_MERGE_DIR "interactive"
...
...
src/repository.c
View file @
0ba4dca5
...
@@ -1915,8 +1915,8 @@ int git_repository_state(git_repository *repo)
...
@@ -1915,8 +1915,8 @@ int git_repository_state(git_repository *repo)
state
=
GIT_REPOSITORY_STATE_MERGE
;
state
=
GIT_REPOSITORY_STATE_MERGE
;
else
if
(
git_path_contains_file
(
&
repo_path
,
GIT_REVERT_HEAD_FILE
))
else
if
(
git_path_contains_file
(
&
repo_path
,
GIT_REVERT_HEAD_FILE
))
state
=
GIT_REPOSITORY_STATE_REVERT
;
state
=
GIT_REPOSITORY_STATE_REVERT
;
else
if
(
git_path_contains_file
(
&
repo_path
,
GIT_CHERRY
_
PICK_HEAD_FILE
))
else
if
(
git_path_contains_file
(
&
repo_path
,
GIT_CHERRYPICK_HEAD_FILE
))
state
=
GIT_REPOSITORY_STATE_CHERRY
_
PICK
;
state
=
GIT_REPOSITORY_STATE_CHERRYPICK
;
else
if
(
git_path_contains_file
(
&
repo_path
,
GIT_BISECT_LOG_FILE
))
else
if
(
git_path_contains_file
(
&
repo_path
,
GIT_BISECT_LOG_FILE
))
state
=
GIT_REPOSITORY_STATE_BISECT
;
state
=
GIT_REPOSITORY_STATE_BISECT
;
...
@@ -1958,7 +1958,7 @@ static const char *state_files[] = {
...
@@ -1958,7 +1958,7 @@ static const char *state_files[] = {
GIT_MERGE_MODE_FILE
,
GIT_MERGE_MODE_FILE
,
GIT_MERGE_MSG_FILE
,
GIT_MERGE_MSG_FILE
,
GIT_REVERT_HEAD_FILE
,
GIT_REVERT_HEAD_FILE
,
GIT_CHERRY
_
PICK_HEAD_FILE
,
GIT_CHERRYPICK_HEAD_FILE
,
GIT_BISECT_LOG_FILE
,
GIT_BISECT_LOG_FILE
,
GIT_REBASE_MERGE_DIR
,
GIT_REBASE_MERGE_DIR
,
GIT_REBASE_APPLY_DIR
,
GIT_REBASE_APPLY_DIR
,
...
...
tests/cherrypick/bare.c
View file @
0ba4dca5
...
@@ -39,7 +39,7 @@ void test_cherrypick_bare__automerge(void)
...
@@ -39,7 +39,7 @@ void test_cherrypick_bare__automerge(void)
git_oid_fromstr
(
&
cherry_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
git_oid_fromstr
(
&
cherry_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick_commit
(
&
index
,
repo
,
commit
,
head
,
0
,
NULL
));
cl_git_pass
(
git_cherrypick_commit
(
&
index
,
repo
,
commit
,
head
,
0
,
NULL
));
cl_assert
(
merge_test_index
(
index
,
merge_index_entries
,
3
));
cl_assert
(
merge_test_index
(
index
,
merge_index_entries
,
3
));
git_index_free
(
index
);
git_index_free
(
index
);
...
@@ -69,7 +69,7 @@ void test_cherrypick_bare__conflicts(void)
...
@@ -69,7 +69,7 @@ void test_cherrypick_bare__conflicts(void)
git_oid_fromstr
(
&
cherry_oid
,
"e9b63f3655b2ad80c0ff587389b5a9589a3a7110"
);
git_oid_fromstr
(
&
cherry_oid
,
"e9b63f3655b2ad80c0ff587389b5a9589a3a7110"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick_commit
(
&
index
,
repo
,
commit
,
head
,
0
,
NULL
));
cl_git_pass
(
git_cherrypick_commit
(
&
index
,
repo
,
commit
,
head
,
0
,
NULL
));
cl_assert
(
merge_test_index
(
index
,
merge_index_entries
,
7
));
cl_assert
(
merge_test_index
(
index
,
merge_index_entries
,
7
));
git_index_free
(
index
);
git_index_free
(
index
);
...
@@ -96,7 +96,7 @@ void test_cherrypick_bare__orphan(void)
...
@@ -96,7 +96,7 @@ void test_cherrypick_bare__orphan(void)
git_oid_fromstr
(
&
cherry_oid
,
"74f06b5bfec6d33d7264f73606b57a7c0b963819"
);
git_oid_fromstr
(
&
cherry_oid
,
"74f06b5bfec6d33d7264f73606b57a7c0b963819"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick_commit
(
&
index
,
repo
,
commit
,
head
,
0
,
NULL
));
cl_git_pass
(
git_cherrypick_commit
(
&
index
,
repo
,
commit
,
head
,
0
,
NULL
));
cl_assert
(
merge_test_index
(
index
,
merge_index_entries
,
4
));
cl_assert
(
merge_test_index
(
index
,
merge_index_entries
,
4
));
git_index_free
(
index
);
git_index_free
(
index
);
...
...
tests/cherrypick/workdir.c
View file @
0ba4dca5
...
@@ -36,7 +36,7 @@ void test_cherrypick_workdir__automerge(void)
...
@@ -36,7 +36,7 @@ void test_cherrypick_workdir__automerge(void)
git_signature
*
signature
=
NULL
;
git_signature
*
signature
=
NULL
;
size_t
i
;
size_t
i
;
const
char
*
cherry
_
pick_oids
[]
=
{
const
char
*
cherrypick_oids
[]
=
{
"cfc4f0999a8367568e049af4f72e452d40828a15"
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
,
"964ea3da044d9083181a88ba6701de9e35778bf4"
,
"964ea3da044d9083181a88ba6701de9e35778bf4"
,
"a43a050c588d4e92f11a6b139680923e9728477d"
,
"a43a050c588d4e92f11a6b139680923e9728477d"
,
...
@@ -62,29 +62,29 @@ void test_cherrypick_workdir__automerge(void)
...
@@ -62,29 +62,29 @@ void test_cherrypick_workdir__automerge(void)
for
(
i
=
0
;
i
<
3
;
++
i
)
{
for
(
i
=
0
;
i
<
3
;
++
i
)
{
git_commit
*
head
=
NULL
,
*
commit
=
NULL
;
git_commit
*
head
=
NULL
,
*
commit
=
NULL
;
git_oid
cherry_oid
,
cherry
_picked_oid
,
cherry_
picked_tree_oid
;
git_oid
cherry_oid
,
cherry
picked_oid
,
cherry
picked_tree_oid
;
git_tree
*
cherry
_
picked_tree
=
NULL
;
git_tree
*
cherrypicked_tree
=
NULL
;
cl_git_pass
(
git_commit_lookup
(
&
head
,
repo
,
&
head_oid
));
cl_git_pass
(
git_commit_lookup
(
&
head
,
repo
,
&
head_oid
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head
,
GIT_RESET_HARD
,
NULL
,
NULL
));
git_oid_fromstr
(
&
cherry_oid
,
cherry
_
pick_oids
[
i
]);
git_oid_fromstr
(
&
cherry_oid
,
cherrypick_oids
[
i
]);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick
(
repo
,
commit
,
NULL
));
cl_git_pass
(
git_cherrypick
(
repo
,
commit
,
NULL
));
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/CHERRY_PICK_HEAD"
));
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/CHERRY_PICK_HEAD"
));
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_git_pass
(
git_index_write_tree
(
&
cherry
_
picked_tree_oid
,
repo_index
));
cl_git_pass
(
git_index_write_tree
(
&
cherrypicked_tree_oid
,
repo_index
));
cl_git_pass
(
git_tree_lookup
(
&
cherry
_picked_tree
,
repo
,
&
cherry_
picked_tree_oid
));
cl_git_pass
(
git_tree_lookup
(
&
cherry
picked_tree
,
repo
,
&
cherry
picked_tree_oid
));
cl_git_pass
(
git_commit_create
(
&
cherry
_
picked_oid
,
repo
,
"HEAD"
,
signature
,
signature
,
NULL
,
cl_git_pass
(
git_commit_create
(
&
cherrypicked_oid
,
repo
,
"HEAD"
,
signature
,
signature
,
NULL
,
"Cherry picked!"
,
cherry
_
picked_tree
,
1
,
(
const
git_commit
**
)
&
head
));
"Cherry picked!"
,
cherrypicked_tree
,
1
,
(
const
git_commit
**
)
&
head
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
+
i
*
3
,
3
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
+
i
*
3
,
3
));
git_oid_cpy
(
&
head_oid
,
&
cherry
_
picked_oid
);
git_oid_cpy
(
&
head_oid
,
&
cherrypicked_oid
);
git_tree_free
(
cherry
_
picked_tree
);
git_tree_free
(
cherrypicked_tree
);
git_commit_free
(
head
);
git_commit_free
(
head
);
git_commit_free
(
commit
);
git_commit_free
(
commit
);
}
}
...
@@ -118,7 +118,7 @@ void test_cherrypick_workdir__conflicts(void)
...
@@ -118,7 +118,7 @@ void test_cherrypick_workdir__conflicts(void)
git_oid_fromstr
(
&
cherry_oid
,
"e9b63f3655b2ad80c0ff587389b5a9589a3a7110"
);
git_oid_fromstr
(
&
cherry_oid
,
"e9b63f3655b2ad80c0ff587389b5a9589a3a7110"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick
(
repo
,
commit
,
NULL
));
cl_git_pass
(
git_cherrypick
(
repo
,
commit
,
NULL
));
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/CHERRY_PICK_HEAD"
));
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/CHERRY_PICK_HEAD"
));
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_assert
(
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
...
@@ -198,7 +198,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
...
@@ -198,7 +198,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
{
{
git_commit
*
head
=
NULL
,
*
commit
=
NULL
;
git_commit
*
head
=
NULL
,
*
commit
=
NULL
;
git_oid
head_oid
,
cherry_oid
;
git_oid
head_oid
,
cherry_oid
;
git_cherry
_pick_options
opts
=
GIT_CHERRY_
PICK_OPTIONS_INIT
;
git_cherry
pick_options
opts
=
GIT_CHERRY
PICK_OPTIONS_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"242e7977ba73637822ffb265b46004b9b0e5153b"
,
0
,
"file1.txt"
},
{
0100644
,
"242e7977ba73637822ffb265b46004b9b0e5153b"
,
0
,
"file1.txt"
},
...
@@ -226,7 +226,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
...
@@ -226,7 +226,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
git_oid_fromstr
(
&
cherry_oid
,
"e9b63f3655b2ad80c0ff587389b5a9589a3a7110"
);
git_oid_fromstr
(
&
cherry_oid
,
"e9b63f3655b2ad80c0ff587389b5a9589a3a7110"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick
(
repo
,
commit
,
&
opts
));
cl_git_pass
(
git_cherrypick
(
repo
,
commit
,
&
opts
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
7
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
7
));
cl_assert
(
merge_test_workdir
(
repo
,
merge_filesystem_entries
,
3
));
cl_assert
(
merge_test_workdir
(
repo
,
merge_filesystem_entries
,
3
));
...
@@ -235,7 +235,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
...
@@ -235,7 +235,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
opts
.
merge_opts
.
file_favor
=
GIT_MERGE_FILE_FAVOR_OURS
;
opts
.
merge_opts
.
file_favor
=
GIT_MERGE_FILE_FAVOR_OURS
;
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_cherry
_
pick
(
repo
,
commit
,
&
opts
));
cl_git_pass
(
git_cherrypick
(
repo
,
commit
,
&
opts
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_filesystem_entries
,
3
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_filesystem_entries
,
3
));
cl_assert
(
merge_test_workdir
(
repo
,
merge_filesystem_entries
,
3
));
cl_assert
(
merge_test_workdir
(
repo
,
merge_filesystem_entries
,
3
));
...
@@ -251,7 +251,7 @@ void test_cherrypick_workdir__rename(void)
...
@@ -251,7 +251,7 @@ void test_cherrypick_workdir__rename(void)
{
{
git_commit
*
head
,
*
commit
;
git_commit
*
head
,
*
commit
;
git_oid
head_oid
,
cherry_oid
;
git_oid
head_oid
,
cherry_oid
;
git_cherry
_pick_options
opts
=
GIT_CHERRY_
PICK_OPTIONS_INIT
;
git_cherry
pick_options
opts
=
GIT_CHERRY
PICK_OPTIONS_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"19c5c7207054604b69c84d08a7571ef9672bb5c2"
,
0
,
"file1.txt"
},
{
0100644
,
"19c5c7207054604b69c84d08a7571ef9672bb5c2"
,
0
,
"file1.txt"
},
...
@@ -268,7 +268,7 @@ void test_cherrypick_workdir__rename(void)
...
@@ -268,7 +268,7 @@ void test_cherrypick_workdir__rename(void)
git_oid_fromstr
(
&
cherry_oid
,
"2a26c7e88b285613b302ba76712bc998863f3cbc"
);
git_oid_fromstr
(
&
cherry_oid
,
"2a26c7e88b285613b302ba76712bc998863f3cbc"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick
(
repo
,
commit
,
&
opts
));
cl_git_pass
(
git_cherrypick
(
repo
,
commit
,
&
opts
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
3
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
3
));
...
@@ -284,7 +284,7 @@ void test_cherrypick_workdir__both_renamed(void)
...
@@ -284,7 +284,7 @@ void test_cherrypick_workdir__both_renamed(void)
git_commit
*
head
,
*
commit
;
git_commit
*
head
,
*
commit
;
git_oid
head_oid
,
cherry_oid
;
git_oid
head_oid
,
cherry_oid
;
git_buf
mergemsg_buf
=
GIT_BUF_INIT
;
git_buf
mergemsg_buf
=
GIT_BUF_INIT
;
git_cherry
_pick_options
opts
=
GIT_CHERRY_
PICK_OPTIONS_INIT
;
git_cherry
pick_options
opts
=
GIT_CHERRY
PICK_OPTIONS_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"19c5c7207054604b69c84d08a7571ef9672bb5c2"
,
0
,
"file1.txt"
},
{
0100644
,
"19c5c7207054604b69c84d08a7571ef9672bb5c2"
,
0
,
"file1.txt"
},
...
@@ -303,7 +303,7 @@ void test_cherrypick_workdir__both_renamed(void)
...
@@ -303,7 +303,7 @@ void test_cherrypick_workdir__both_renamed(void)
git_oid_fromstr
(
&
cherry_oid
,
"2a26c7e88b285613b302ba76712bc998863f3cbc"
);
git_oid_fromstr
(
&
cherry_oid
,
"2a26c7e88b285613b302ba76712bc998863f3cbc"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick
(
repo
,
commit
,
&
opts
));
cl_git_pass
(
git_cherrypick
(
repo
,
commit
,
&
opts
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
5
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
5
));
...
@@ -326,13 +326,13 @@ void test_cherrypick_workdir__nonmerge_fails_mainline_specified(void)
...
@@ -326,13 +326,13 @@ void test_cherrypick_workdir__nonmerge_fails_mainline_specified(void)
{
{
git_reference
*
head
;
git_reference
*
head
;
git_commit
*
commit
;
git_commit
*
commit
;
git_cherry
_pick_options
opts
=
GIT_CHERRY_
PICK_OPTIONS_INIT
;
git_cherry
pick_options
opts
=
GIT_CHERRY
PICK_OPTIONS_INIT
;
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
commit
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
commit
,
head
,
GIT_OBJ_COMMIT
));
opts
.
mainline
=
1
;
opts
.
mainline
=
1
;
cl_must_fail
(
git_cherry
_
pick
(
repo
,
commit
,
&
opts
));
cl_must_fail
(
git_cherrypick
(
repo
,
commit
,
&
opts
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/CHERRY_PICK_HEAD"
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/CHERRY_PICK_HEAD"
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
...
@@ -355,7 +355,7 @@ void test_cherrypick_workdir__merge_fails_without_mainline_specified(void)
...
@@ -355,7 +355,7 @@ void test_cherrypick_workdir__merge_fails_without_mainline_specified(void)
git_oid_fromstr
(
&
cherry_oid
,
"abe4603bc7cd5b8167a267e0e2418fd2348f8cff"
);
git_oid_fromstr
(
&
cherry_oid
,
"abe4603bc7cd5b8167a267e0e2418fd2348f8cff"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_must_fail
(
git_cherry
_
pick
(
repo
,
commit
,
NULL
));
cl_must_fail
(
git_cherrypick
(
repo
,
commit
,
NULL
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/CHERRY_PICK_HEAD"
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/CHERRY_PICK_HEAD"
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
...
@@ -370,7 +370,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
...
@@ -370,7 +370,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
{
{
git_commit
*
head
,
*
commit
;
git_commit
*
head
,
*
commit
;
git_oid
head_oid
,
cherry_oid
;
git_oid
head_oid
,
cherry_oid
;
git_cherry
_pick_options
opts
=
GIT_CHERRY_
PICK_OPTIONS_INIT
;
git_cherry
pick_options
opts
=
GIT_CHERRY
PICK_OPTIONS_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"f90f9dcbdac2cce5cc166346160e19cb693ef4e8"
,
0
,
"file1.txt"
},
{
0100644
,
"f90f9dcbdac2cce5cc166346160e19cb693ef4e8"
,
0
,
"file1.txt"
},
...
@@ -387,7 +387,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
...
@@ -387,7 +387,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
git_oid_fromstr
(
&
cherry_oid
,
"abe4603bc7cd5b8167a267e0e2418fd2348f8cff"
);
git_oid_fromstr
(
&
cherry_oid
,
"abe4603bc7cd5b8167a267e0e2418fd2348f8cff"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick
(
repo
,
commit
,
&
opts
));
cl_git_pass
(
git_cherrypick
(
repo
,
commit
,
&
opts
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
3
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
3
));
...
@@ -402,7 +402,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
...
@@ -402,7 +402,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
{
{
git_commit
*
head
,
*
commit
;
git_commit
*
head
,
*
commit
;
git_oid
head_oid
,
cherry_oid
;
git_oid
head_oid
,
cherry_oid
;
git_cherry
_pick_options
opts
=
GIT_CHERRY_
PICK_OPTIONS_INIT
;
git_cherry
pick_options
opts
=
GIT_CHERRY
PICK_OPTIONS_INIT
;
struct
merge_index_entry
merge_index_entries
[]
=
{
struct
merge_index_entry
merge_index_entries
[]
=
{
{
0100644
,
"487434cace79238a7091e2220611d4f20a765690"
,
0
,
"file1.txt"
},
{
0100644
,
"487434cace79238a7091e2220611d4f20a765690"
,
0
,
"file1.txt"
},
...
@@ -419,7 +419,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
...
@@ -419,7 +419,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
git_oid_fromstr
(
&
cherry_oid
,
"abe4603bc7cd5b8167a267e0e2418fd2348f8cff"
);
git_oid_fromstr
(
&
cherry_oid
,
"abe4603bc7cd5b8167a267e0e2418fd2348f8cff"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
cherry_oid
));
cl_git_pass
(
git_cherry
_
pick
(
repo
,
commit
,
&
opts
));
cl_git_pass
(
git_cherrypick
(
repo
,
commit
,
&
opts
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
3
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
3
));
...
...
tests/repo/state.c
View file @
0ba4dca5
...
@@ -59,8 +59,8 @@ void test_repo_state__revert(void)
...
@@ -59,8 +59,8 @@ void test_repo_state__revert(void)
void
test_repo_state__cherry_pick
(
void
)
void
test_repo_state__cherry_pick
(
void
)
{
{
setup_simple_state
(
GIT_CHERRY
_
PICK_HEAD_FILE
);
setup_simple_state
(
GIT_CHERRYPICK_HEAD_FILE
);
assert_repo_state
(
GIT_REPOSITORY_STATE_CHERRY
_
PICK
);
assert_repo_state
(
GIT_REPOSITORY_STATE_CHERRYPICK
);
cl_git_pass
(
git_repository_state_cleanup
(
_repo
));
cl_git_pass
(
git_repository_state_cleanup
(
_repo
));
assert_repo_state
(
GIT_REPOSITORY_STATE_NONE
);
assert_repo_state
(
GIT_REPOSITORY_STATE_NONE
);
}
}
...
...
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