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
0625638f
Commit
0625638f
authored
Oct 10, 2014
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2499 from csware/hard-reset-checkout-callbacks
Allow to propagate checkout callbacks to git HARD reset
parents
f54d8d52
b8add6c4
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
70 additions
and
61 deletions
+70
-61
include/git2/reset.h
+5
-0
src/reset.c
+4
-0
tests/checkout/tree.c
+1
-1
tests/cherrypick/workdir.c
+9
-9
tests/index/names.c
+2
-2
tests/index/reuc.c
+4
-4
tests/merge/workdir/dirty.c
+4
-4
tests/merge/workdir/simple.c
+2
-2
tests/merge/workdir/submodules.c
+2
-2
tests/reset/hard.c
+7
-7
tests/reset/mixed.c
+5
-5
tests/reset/soft.c
+11
-11
tests/revert/workdir.c
+14
-14
No files found.
include/git2/reset.h
View file @
0625638f
...
@@ -52,6 +52,10 @@ typedef enum {
...
@@ -52,6 +52,10 @@ typedef enum {
*
*
* @param reset_type Kind of reset operation to perform.
* @param reset_type Kind of reset operation to perform.
*
*
* @param checkout_opts Checkout options to be used for a HARD reset.
* The checkout_strategy field will be overridden (based on reset_type).
* This parameter can be used to propagate notify and progress callbacks.
*
* @param signature The identity that will used to populate the reflog entry
* @param signature The identity that will used to populate the reflog entry
*
*
* @param log_message The one line long message to be appended to the reflog.
* @param log_message The one line long message to be appended to the reflog.
...
@@ -65,6 +69,7 @@ GIT_EXTERN(int) git_reset(
...
@@ -65,6 +69,7 @@ GIT_EXTERN(int) git_reset(
git_repository
*
repo
,
git_repository
*
repo
,
git_object
*
target
,
git_object
*
target
,
git_reset_t
reset_type
,
git_reset_t
reset_type
,
git_checkout_options
*
checkout_opts
,
git_signature
*
signature
,
git_signature
*
signature
,
const
char
*
log_message
);
const
char
*
log_message
);
...
...
src/reset.c
View file @
0625638f
...
@@ -100,6 +100,7 @@ int git_reset(
...
@@ -100,6 +100,7 @@ int git_reset(
git_repository
*
repo
,
git_repository
*
repo
,
git_object
*
target
,
git_object
*
target
,
git_reset_t
reset_type
,
git_reset_t
reset_type
,
git_checkout_options
*
checkout_opts
,
git_signature
*
signature
,
git_signature
*
signature
,
const
char
*
log_message
)
const
char
*
log_message
)
{
{
...
@@ -112,6 +113,9 @@ int git_reset(
...
@@ -112,6 +113,9 @@ int git_reset(
assert
(
repo
&&
target
);
assert
(
repo
&&
target
);
if
(
checkout_opts
)
opts
=
*
checkout_opts
;
if
(
git_object_owner
(
target
)
!=
repo
)
{
if
(
git_object_owner
(
target
)
!=
repo
)
{
giterr_set
(
GITERR_OBJECT
,
giterr_set
(
GITERR_OBJECT
,
"%s - The given target does not belong to this repository."
,
ERROR_MSG
);
"%s - The given target does not belong to this repository."
,
ERROR_MSG
);
...
...
tests/checkout/tree.c
View file @
0625638f
...
@@ -571,7 +571,7 @@ void test_checkout_tree__donot_update_deleted_file_by_default(void)
...
@@ -571,7 +571,7 @@ void test_checkout_tree__donot_update_deleted_file_by_default(void)
cl_git_pass
(
git_oid_fromstr
(
&
old_id
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
));
cl_git_pass
(
git_oid_fromstr
(
&
old_id
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
));
cl_git_pass
(
git_commit_lookup
(
&
old_commit
,
g_repo
,
&
old_id
));
cl_git_pass
(
git_commit_lookup
(
&
old_commit
,
g_repo
,
&
old_id
));
cl_git_pass
(
git_reset
(
g_repo
,
(
git_object
*
)
old_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
g_repo
,
(
git_object
*
)
old_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
p_unlink
(
"testrepo/branch_file.txt"
));
cl_git_pass
(
p_unlink
(
"testrepo/branch_file.txt"
));
cl_git_pass
(
git_index_remove_bypath
(
index
,
"branch_file.txt"
));
cl_git_pass
(
git_index_remove_bypath
(
index
,
"branch_file.txt"
));
...
...
tests/cherrypick/workdir.c
View file @
0625638f
...
@@ -66,7 +66,7 @@ void test_cherrypick_workdir__automerge(void)
...
@@ -66,7 +66,7 @@ void test_cherrypick_workdir__automerge(void)
git_tree
*
cherrypicked_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
,
NULL
));
git_oid_fromstr
(
&
cherry_oid
,
cherrypick_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
));
...
@@ -155,7 +155,7 @@ void test_cherrypick_workdir__conflicts(void)
...
@@ -155,7 +155,7 @@ void test_cherrypick_workdir__conflicts(void)
git_oid_fromstr
(
&
head_oid
,
"bafbf6912c09505ac60575cd43d3f2aba3bd84d8"
);
git_oid_fromstr
(
&
head_oid
,
"bafbf6912c09505ac60575cd43d3f2aba3bd84d8"
);
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
,
NULL
));
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
));
...
@@ -263,7 +263,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
...
@@ -263,7 +263,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
git_oid_fromstr
(
&
head_oid
,
"bafbf6912c09505ac60575cd43d3f2aba3bd84d8"
);
git_oid_fromstr
(
&
head_oid
,
"bafbf6912c09505ac60575cd43d3f2aba3bd84d8"
);
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
,
NULL
));
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
));
...
@@ -275,7 +275,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
...
@@ -275,7 +275,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
/* resolve conflicts in the index by taking "ours" */
/* resolve conflicts in the index by taking "ours" */
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
,
NULL
));
cl_git_pass
(
git_cherrypick
(
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
));
...
@@ -305,7 +305,7 @@ void test_cherrypick_workdir__rename(void)
...
@@ -305,7 +305,7 @@ void test_cherrypick_workdir__rename(void)
git_oid_fromstr
(
&
head_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
git_oid_fromstr
(
&
head_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
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
,
NULL
));
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
));
...
@@ -340,7 +340,7 @@ void test_cherrypick_workdir__both_renamed(void)
...
@@ -340,7 +340,7 @@ void test_cherrypick_workdir__both_renamed(void)
git_oid_fromstr
(
&
head_oid
,
"44cd2ed2052c9c68f9a439d208e9614dc2a55c70"
);
git_oid_fromstr
(
&
head_oid
,
"44cd2ed2052c9c68f9a439d208e9614dc2a55c70"
);
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
,
NULL
));
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
));
...
@@ -391,7 +391,7 @@ void test_cherrypick_workdir__merge_fails_without_mainline_specified(void)
...
@@ -391,7 +391,7 @@ void test_cherrypick_workdir__merge_fails_without_mainline_specified(void)
git_oid_fromstr
(
&
head_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
git_oid_fromstr
(
&
head_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
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
,
NULL
));
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
));
...
@@ -423,7 +423,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
...
@@ -423,7 +423,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
git_oid_fromstr
(
&
head_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
git_oid_fromstr
(
&
head_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
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
,
NULL
));
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
));
...
@@ -455,7 +455,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
...
@@ -455,7 +455,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
git_oid_fromstr
(
&
head_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
git_oid_fromstr
(
&
head_oid
,
"cfc4f0999a8367568e049af4f72e452d40828a15"
);
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
,
NULL
));
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
));
...
...
tests/index/names.c
View file @
0625638f
...
@@ -89,7 +89,7 @@ void test_index_names__cleaned_on_reset_hard(void)
...
@@ -89,7 +89,7 @@ void test_index_names__cleaned_on_reset_hard(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
test_index_names__add
();
test_index_names__add
();
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_assert
(
git_index_name_entrycount
(
repo_index
)
==
0
);
cl_assert
(
git_index_name_entrycount
(
repo_index
)
==
0
);
git_object_free
(
target
);
git_object_free
(
target
);
...
@@ -102,7 +102,7 @@ void test_index_names__cleaned_on_reset_mixed(void)
...
@@ -102,7 +102,7 @@ void test_index_names__cleaned_on_reset_mixed(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
test_index_names__add
();
test_index_names__add
();
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
,
NULL
));
cl_assert
(
git_index_name_entrycount
(
repo_index
)
==
0
);
cl_assert
(
git_index_name_entrycount
(
repo_index
)
==
0
);
git_object_free
(
target
);
git_object_free
(
target
);
...
...
tests/index/reuc.c
View file @
0625638f
...
@@ -298,7 +298,7 @@ void test_index_reuc__cleaned_on_reset_hard(void)
...
@@ -298,7 +298,7 @@ void test_index_reuc__cleaned_on_reset_hard(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
test_index_reuc__add
();
test_index_reuc__add
();
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_assert
(
reuc_entry_exists
()
==
false
);
cl_assert
(
reuc_entry_exists
()
==
false
);
git_object_free
(
target
);
git_object_free
(
target
);
...
@@ -311,7 +311,7 @@ void test_index_reuc__cleaned_on_reset_mixed(void)
...
@@ -311,7 +311,7 @@ void test_index_reuc__cleaned_on_reset_mixed(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
test_index_reuc__add
();
test_index_reuc__add
();
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
,
NULL
));
cl_assert
(
reuc_entry_exists
()
==
false
);
cl_assert
(
reuc_entry_exists
()
==
false
);
git_object_free
(
target
);
git_object_free
(
target
);
...
@@ -323,10 +323,10 @@ void test_index_reuc__retained_on_reset_soft(void)
...
@@ -323,10 +323,10 @@ void test_index_reuc__retained_on_reset_soft(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"3a34580"
));
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
);
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
);
test_index_reuc__add
();
test_index_reuc__add
();
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
cl_assert
(
reuc_entry_exists
()
==
true
);
cl_assert
(
reuc_entry_exists
()
==
true
);
git_object_free
(
target
);
git_object_free
(
target
);
...
...
tests/merge/workdir/dirty.c
View file @
0625638f
...
@@ -182,7 +182,7 @@ static void stage_content(char *content[])
...
@@ -182,7 +182,7 @@ static void stage_content(char *content[])
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
for
(
i
=
0
,
filename
=
content
[
i
],
text
=
content
[
++
i
];
for
(
i
=
0
,
filename
=
content
[
i
],
text
=
content
[
++
i
];
filename
&&
text
;
filename
&&
text
;
...
@@ -209,7 +209,7 @@ static int merge_dirty_files(char *dirty_files[])
...
@@ -209,7 +209,7 @@ static int merge_dirty_files(char *dirty_files[])
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
write_files
(
dirty_files
);
write_files
(
dirty_files
);
...
@@ -229,7 +229,7 @@ static int merge_differently_filtered_files(char *files[])
...
@@ -229,7 +229,7 @@ static int merge_differently_filtered_files(char *files[])
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
write_files
(
files
);
write_files
(
files
);
hack_index
(
files
);
hack_index
(
files
);
...
@@ -266,7 +266,7 @@ void test_merge_workdir_dirty__unstaged_deletes_maintained(void)
...
@@ -266,7 +266,7 @@ void test_merge_workdir_dirty__unstaged_deletes_maintained(void)
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_repository_head
(
&
head
,
repo
));
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reference_peel
(
&
head_object
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
head_object
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
p_unlink
(
"merge-resolve/unchanged.txt"
));
cl_git_pass
(
p_unlink
(
"merge-resolve/unchanged.txt"
));
...
...
tests/merge/workdir/simple.c
View file @
0625638f
...
@@ -516,7 +516,7 @@ void test_merge_workdir_simple__directory_file(void)
...
@@ -516,7 +516,7 @@ void test_merge_workdir_simple__directory_file(void)
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
GIT_REFS_HEADS_DIR
OURS_DIRECTORY_FILE
,
1
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
GIT_REFS_HEADS_DIR
OURS_DIRECTORY_FILE
,
1
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_name_to_id
(
&
head_commit_id
,
repo
,
GIT_HEAD_FILE
));
cl_git_pass
(
git_reference_name_to_id
(
&
head_commit_id
,
repo
,
GIT_HEAD_FILE
));
cl_git_pass
(
git_commit_lookup
(
&
head_commit
,
repo
,
&
head_commit_id
));
cl_git_pass
(
git_commit_lookup
(
&
head_commit
,
repo
,
&
head_commit_id
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_oid_fromstr
(
&
their_oids
[
0
],
THEIRS_DIRECTORY_FILE
));
cl_git_pass
(
git_oid_fromstr
(
&
their_oids
[
0
],
THEIRS_DIRECTORY_FILE
));
cl_git_pass
(
git_merge_head_from_id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
cl_git_pass
(
git_merge_head_from_id
(
&
their_heads
[
0
],
repo
,
&
their_oids
[
0
]));
...
@@ -608,7 +608,7 @@ void test_merge_workdir_simple__binary(void)
...
@@ -608,7 +608,7 @@ void test_merge_workdir_simple__binary(void)
cl_git_pass
(
git_oid_fromstr
(
&
their_oid
,
"ad01aebfdf2ac13145efafe3f9fcf798882f1730"
));
cl_git_pass
(
git_oid_fromstr
(
&
their_oid
,
"ad01aebfdf2ac13145efafe3f9fcf798882f1730"
));
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
&
our_oid
));
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
&
our_oid
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
our_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
our_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_merge_head_from_id
(
&
their_head
,
repo
,
&
their_oid
));
cl_git_pass
(
git_merge_head_from_id
(
&
their_head
,
repo
,
&
their_oid
));
...
...
tests/merge/workdir/submodules.c
View file @
0625638f
...
@@ -44,7 +44,7 @@ void test_merge_workdir_submodules__automerge(void)
...
@@ -44,7 +44,7 @@ void test_merge_workdir_submodules__automerge(void)
cl_git_pass
(
git_reference_lookup
(
&
our_ref
,
repo
,
"refs/heads/"
SUBMODULE_MAIN_BRANCH
));
cl_git_pass
(
git_reference_lookup
(
&
our_ref
,
repo
,
"refs/heads/"
SUBMODULE_MAIN_BRANCH
));
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
git_reference_target
(
our_ref
)));
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
git_reference_target
(
our_ref
)));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
our_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
our_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_lookup
(
&
their_ref
,
repo
,
"refs/heads/"
SUBMODULE_OTHER_BRANCH
));
cl_git_pass
(
git_reference_lookup
(
&
their_ref
,
repo
,
"refs/heads/"
SUBMODULE_OTHER_BRANCH
));
cl_git_pass
(
git_merge_head_from_ref
(
&
their_head
,
repo
,
their_ref
));
cl_git_pass
(
git_merge_head_from_ref
(
&
their_head
,
repo
,
their_ref
));
...
@@ -77,7 +77,7 @@ void test_merge_workdir_submodules__take_changed(void)
...
@@ -77,7 +77,7 @@ void test_merge_workdir_submodules__take_changed(void)
cl_git_pass
(
git_reference_lookup
(
&
our_ref
,
repo
,
"refs/heads/"
SUBMODULE_MAIN_BRANCH
));
cl_git_pass
(
git_reference_lookup
(
&
our_ref
,
repo
,
"refs/heads/"
SUBMODULE_MAIN_BRANCH
));
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
git_reference_target
(
our_ref
)));
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
git_reference_target
(
our_ref
)));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
our_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
our_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_lookup
(
&
their_ref
,
repo
,
"refs/heads/"
SUBMODULE_OTHER2_BRANCH
));
cl_git_pass
(
git_reference_lookup
(
&
their_ref
,
repo
,
"refs/heads/"
SUBMODULE_OTHER2_BRANCH
));
cl_git_pass
(
git_merge_head_from_ref
(
&
their_head
,
repo
,
their_ref
));
cl_git_pass
(
git_merge_head_from_ref
(
&
their_head
,
repo
,
their_ref
));
...
...
tests/reset/hard.c
View file @
0625638f
...
@@ -71,7 +71,7 @@ void test_reset_hard__resetting_reverts_modified_files(void)
...
@@ -71,7 +71,7 @@ void test_reset_hard__resetting_reverts_modified_files(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"26a125e"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"26a125e"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
for
(
i
=
0
;
i
<
4
;
++
i
)
{
for
(
i
=
0
;
i
<
4
;
++
i
)
{
cl_git_pass
(
git_buf_joinpath
(
&
path
,
wd
,
files
[
i
]));
cl_git_pass
(
git_buf_joinpath
(
&
path
,
wd
,
files
[
i
]));
...
@@ -96,7 +96,7 @@ void test_reset_hard__cannot_reset_in_a_bare_repository(void)
...
@@ -96,7 +96,7 @@ void test_reset_hard__cannot_reset_in_a_bare_repository(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
bare
,
KNOWN_COMMIT_IN_BARE_REPO
));
cl_git_pass
(
git_revparse_single
(
&
target
,
bare
,
KNOWN_COMMIT_IN_BARE_REPO
));
cl_assert_equal_i
(
GIT_EBAREREPO
,
git_reset
(
bare
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_assert_equal_i
(
GIT_EBAREREPO
,
git_reset
(
bare
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
git_repository_free
(
bare
);
git_repository_free
(
bare
);
}
}
...
@@ -152,7 +152,7 @@ void test_reset_hard__resetting_reverts_unmerged(void)
...
@@ -152,7 +152,7 @@ void test_reset_hard__resetting_reverts_unmerged(void)
cl_git_pass
(
git_index_write
(
index
));
cl_git_pass
(
git_index_write
(
index
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"26a125e"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"26a125e"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_assert
(
git_path_exists
(
"status/conflicting_file"
)
==
0
);
cl_assert
(
git_path_exists
(
"status/conflicting_file"
)
==
0
);
...
@@ -183,7 +183,7 @@ void test_reset_hard__cleans_up_merge(void)
...
@@ -183,7 +183,7 @@ void test_reset_hard__cleans_up_merge(void)
cl_git_mkfile
(
git_buf_cstr
(
&
orig_head_path
),
"0017bd4ab1ec30440b17bae1680cff124ab5f1f6"
);
cl_git_mkfile
(
git_buf_cstr
(
&
orig_head_path
),
"0017bd4ab1ec30440b17bae1680cff124ab5f1f6"
);
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"0017bd4"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"0017bd4"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_assert
(
!
git_path_exists
(
git_buf_cstr
(
&
merge_head_path
)));
cl_assert
(
!
git_path_exists
(
git_buf_cstr
(
&
merge_head_path
)));
cl_assert
(
!
git_path_exists
(
git_buf_cstr
(
&
merge_msg_path
)));
cl_assert
(
!
git_path_exists
(
git_buf_cstr
(
&
merge_msg_path
)));
...
@@ -208,7 +208,7 @@ void test_reset_hard__reflog_is_correct(void)
...
@@ -208,7 +208,7 @@ void test_reset_hard__reflog_is_correct(void)
/* Branch not moving, no reflog entry */
/* Branch not moving, no reflog entry */
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
reflog_check
(
repo
,
"HEAD"
,
3
,
"emeric.fermas@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
3
,
"emeric.fermas@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
3
,
"emeric.fermas@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
3
,
"emeric.fermas@gmail.com"
,
exp_msg
);
...
@@ -217,7 +217,7 @@ void test_reset_hard__reflog_is_correct(void)
...
@@ -217,7 +217,7 @@ void test_reset_hard__reflog_is_correct(void)
/* Moved branch, expect default message */
/* Moved branch, expect default message */
exp_msg
=
"reset: moving"
;
exp_msg
=
"reset: moving"
;
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
reflog_check
(
repo
,
"HEAD"
,
4
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
4
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
4
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
4
,
NULL
,
exp_msg
);
...
@@ -226,7 +226,7 @@ void test_reset_hard__reflog_is_correct(void)
...
@@ -226,7 +226,7 @@ void test_reset_hard__reflog_is_correct(void)
/* Moved branch, expect custom message */
/* Moved branch, expect custom message */
exp_msg
=
"message1"
;
exp_msg
=
"message1"
;
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
"message1"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_HARD
,
NULL
,
NULL
,
"message1"
));
reflog_check
(
repo
,
"HEAD"
,
5
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
5
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
5
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
5
,
NULL
,
exp_msg
);
}
}
tests/reset/mixed.c
View file @
0625638f
...
@@ -29,7 +29,7 @@ void test_reset_mixed__cannot_reset_in_a_bare_repository(void)
...
@@ -29,7 +29,7 @@ void test_reset_mixed__cannot_reset_in_a_bare_repository(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
bare
,
KNOWN_COMMIT_IN_BARE_REPO
));
cl_git_pass
(
git_revparse_single
(
&
target
,
bare
,
KNOWN_COMMIT_IN_BARE_REPO
));
cl_assert_equal_i
(
GIT_EBAREREPO
,
git_reset
(
bare
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
));
cl_assert_equal_i
(
GIT_EBAREREPO
,
git_reset
(
bare
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
,
NULL
));
git_repository_free
(
bare
);
git_repository_free
(
bare
);
}
}
...
@@ -42,7 +42,7 @@ void test_reset_mixed__resetting_refreshes_the_index_to_the_commit_tree(void)
...
@@ -42,7 +42,7 @@ void test_reset_mixed__resetting_refreshes_the_index_to_the_commit_tree(void)
cl_assert
(
status
==
GIT_STATUS_CURRENT
);
cl_assert
(
status
==
GIT_STATUS_CURRENT
);
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"605812a"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"605812a"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_status_file
(
&
status
,
repo
,
"macro_bad"
));
cl_git_pass
(
git_status_file
(
&
status
,
repo
,
"macro_bad"
));
cl_assert
(
status
==
GIT_STATUS_WT_NEW
);
cl_assert
(
status
==
GIT_STATUS_WT_NEW
);
...
@@ -57,7 +57,7 @@ void test_reset_mixed__reflog_is_correct(void)
...
@@ -57,7 +57,7 @@ void test_reset_mixed__reflog_is_correct(void)
/* Branch not moving, no reflog entry */
/* Branch not moving, no reflog entry */
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
,
NULL
));
reflog_check
(
repo
,
"HEAD"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
...
@@ -67,7 +67,7 @@ void test_reset_mixed__reflog_is_correct(void)
...
@@ -67,7 +67,7 @@ void test_reset_mixed__reflog_is_correct(void)
/* Moved branch, expect default message */
/* Moved branch, expect default message */
exp_msg
=
"reset: moving"
;
exp_msg
=
"reset: moving"
;
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
,
NULL
));
reflog_check
(
repo
,
"HEAD"
,
10
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
10
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
10
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
10
,
NULL
,
exp_msg
);
...
@@ -77,7 +77,7 @@ void test_reset_mixed__reflog_is_correct(void)
...
@@ -77,7 +77,7 @@ void test_reset_mixed__reflog_is_correct(void)
/* Moved branch, expect custom message */
/* Moved branch, expect custom message */
exp_msg
=
"message1"
;
exp_msg
=
"message1"
;
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
"message1"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_MIXED
,
NULL
,
NULL
,
"message1"
));
reflog_check
(
repo
,
"HEAD"
,
11
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
11
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
11
,
NULL
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
11
,
NULL
,
exp_msg
);
}
}
tests/reset/soft.c
View file @
0625638f
...
@@ -30,7 +30,7 @@ static void assert_reset_soft(bool should_be_detached)
...
@@ -30,7 +30,7 @@ static void assert_reset_soft(bool should_be_detached)
cl_assert
(
git_repository_head_detached
(
repo
)
==
should_be_detached
);
cl_assert
(
git_repository_head_detached
(
repo
)
==
should_be_detached
);
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
cl_assert
(
git_repository_head_detached
(
repo
)
==
should_be_detached
);
cl_assert
(
git_repository_head_detached
(
repo
)
==
should_be_detached
);
...
@@ -61,7 +61,7 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch
...
@@ -61,7 +61,7 @@ void test_reset_soft__resetting_to_the_commit_pointed_at_by_the_Head_does_not_ch
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
raw_head_oid
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
raw_head_oid
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_name_to_id
(
&
oid
,
repo
,
"HEAD"
));
cl_git_pass
(
git_reference_name_to_id
(
&
oid
,
repo
,
"HEAD"
));
cl_git_pass
(
git_oid_streq
(
&
oid
,
raw_head_oid
));
cl_git_pass
(
git_oid_streq
(
&
oid
,
raw_head_oid
));
...
@@ -74,7 +74,7 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void
...
@@ -74,7 +74,7 @@ void test_reset_soft__resetting_to_a_tag_sets_the_Head_to_the_peeled_commit(void
/* b25fa35 is a tag, pointing to another tag which points to commit e90810b */
/* b25fa35 is a tag, pointing to another tag which points to commit e90810b */
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"b25fa35"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"b25fa35"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
cl_assert
(
git_repository_head_detached
(
repo
)
==
false
);
cl_assert
(
git_repository_head_detached
(
repo
)
==
false
);
cl_git_pass
(
git_reference_name_to_id
(
&
oid
,
repo
,
"HEAD"
));
cl_git_pass
(
git_reference_name_to_id
(
&
oid
,
repo
,
"HEAD"
));
...
@@ -86,12 +86,12 @@ void test_reset_soft__cannot_reset_to_a_tag_not_pointing_at_a_commit(void)
...
@@ -86,12 +86,12 @@ void test_reset_soft__cannot_reset_to_a_tag_not_pointing_at_a_commit(void)
/* 53fc32d is the tree of commit e90810b */
/* 53fc32d is the tree of commit e90810b */
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"53fc32d"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"53fc32d"
));
cl_git_fail
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_fail
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
git_object_free
(
target
);
git_object_free
(
target
);
/* 521d87c is an annotated tag pointing to a blob */
/* 521d87c is an annotated tag pointing to a blob */
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"521d87c"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"521d87c"
));
cl_git_fail
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_fail
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
}
}
void
test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_longer_unborn
(
void
)
void
test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_longer_unborn
(
void
)
...
@@ -104,7 +104,7 @@ void test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_lo
...
@@ -104,7 +104,7 @@ void test_reset_soft__resetting_against_an_unborn_head_repo_makes_the_head_no_lo
cl_assert_equal_i
(
true
,
git_repository_head_unborn
(
repo
));
cl_assert_equal_i
(
true
,
git_repository_head_unborn
(
repo
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
cl_assert_equal_i
(
false
,
git_repository_head_unborn
(
repo
));
cl_assert_equal_i
(
false
,
git_repository_head_unborn
(
repo
));
...
@@ -124,7 +124,7 @@ void test_reset_soft__fails_when_merging(void)
...
@@ -124,7 +124,7 @@ void test_reset_soft__fails_when_merging(void)
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
KNOWN_COMMIT_IN_BARE_REPO
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
KNOWN_COMMIT_IN_BARE_REPO
));
cl_assert_equal_i
(
GIT_EUNMERGED
,
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_assert_equal_i
(
GIT_EUNMERGED
,
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
p_unlink
(
git_buf_cstr
(
&
merge_head_path
)));
cl_git_pass
(
p_unlink
(
git_buf_cstr
(
&
merge_head_path
)));
git_buf_free
(
&
merge_head_path
);
git_buf_free
(
&
merge_head_path
);
...
@@ -152,7 +152,7 @@ void test_reset_soft__fails_when_index_contains_conflicts_independently_of_MERGE
...
@@ -152,7 +152,7 @@ void test_reset_soft__fails_when_index_contains_conflicts_independently_of_MERGE
cl_git_pass
(
git_reference_peel
(
&
target
,
head
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reference_peel
(
&
target
,
head
,
GIT_OBJ_COMMIT
));
git_reference_free
(
head
);
git_reference_free
(
head
);
cl_assert_equal_i
(
GIT_EUNMERGED
,
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_assert_equal_i
(
GIT_EUNMERGED
,
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
}
}
void
test_reset_soft_reflog_is_correct
(
void
)
void
test_reset_soft_reflog_is_correct
(
void
)
...
@@ -164,19 +164,19 @@ void test_reset_soft_reflog_is_correct(void)
...
@@ -164,19 +164,19 @@ void test_reset_soft_reflog_is_correct(void)
/* Branch not moving, no reflog entry */
/* Branch not moving, no reflog entry */
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
reflog_check
(
repo
,
"HEAD"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
/* Moved branch, expect default message */
/* Moved branch, expect default message */
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
NULL
));
reflog_check
(
repo
,
"HEAD"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
10
,
NULL
,
"reset: moving"
);
reflog_check
(
repo
,
"refs/heads/master"
,
10
,
NULL
,
"reset: moving"
);
/* Moved branch, expect custom message */
/* Moved branch, expect custom message */
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"HEAD~^{commit}"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
"message1"
));
cl_git_pass
(
git_reset
(
repo
,
target
,
GIT_RESET_SOFT
,
NULL
,
NULL
,
"message1"
));
reflog_check
(
repo
,
"HEAD"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"HEAD"
,
9
,
"yoram.harmelin@gmail.com"
,
exp_msg
);
reflog_check
(
repo
,
"refs/heads/master"
,
11
,
NULL
,
"message1"
);
reflog_check
(
repo
,
"refs/heads/master"
,
11
,
NULL
,
"message1"
);
}
}
tests/revert/workdir.c
View file @
0625638f
...
@@ -48,7 +48,7 @@ void test_revert_workdir__automerge(void)
...
@@ -48,7 +48,7 @@ void test_revert_workdir__automerge(void)
git_oid_fromstr
(
&
head_oid
,
"72333f47d4e83616630ff3b0ffe4c0faebcc3c45"
);
git_oid_fromstr
(
&
head_oid
,
"72333f47d4e83616630ff3b0ffe4c0faebcc3c45"
);
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
,
NULL
));
git_oid_fromstr
(
&
revert_oid
,
"d1d403d22cbe24592d725f442835cf46fe60c8ac"
);
git_oid_fromstr
(
&
revert_oid
,
"d1d403d22cbe24592d725f442835cf46fe60c8ac"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
...
@@ -81,7 +81,7 @@ void test_revert_workdir__conflicts(void)
...
@@ -81,7 +81,7 @@ void test_revert_workdir__conflicts(void)
cl_git_pass
(
git_repository_head
(
&
head_ref
,
repo
));
cl_git_pass
(
git_repository_head
(
&
head_ref
,
repo
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
head
,
head_ref
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
head
,
head_ref
,
GIT_OBJ_COMMIT
));
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
,
NULL
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_revert
(
repo
,
commit
,
NULL
));
cl_git_pass
(
git_revert
(
repo
,
commit
,
NULL
));
...
@@ -144,7 +144,7 @@ void test_revert_workdir__orphan(void)
...
@@ -144,7 +144,7 @@ void test_revert_workdir__orphan(void)
git_oid_fromstr
(
&
head_oid
,
"39467716290f6df775a91cdb9a4eb39295018145"
);
git_oid_fromstr
(
&
head_oid
,
"39467716290f6df775a91cdb9a4eb39295018145"
);
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
,
NULL
));
git_oid_fromstr
(
&
revert_oid
,
"ebb03002cee5d66c7732dd06241119fe72ab96a5"
);
git_oid_fromstr
(
&
revert_oid
,
"ebb03002cee5d66c7732dd06241119fe72ab96a5"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
...
@@ -179,7 +179,7 @@ void test_revert_workdir__again(void)
...
@@ -179,7 +179,7 @@ void test_revert_workdir__again(void)
cl_git_pass
(
git_repository_head
(
&
head_ref
,
repo
));
cl_git_pass
(
git_repository_head
(
&
head_ref
,
repo
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
orig_head
,
head_ref
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
orig_head
,
head_ref
,
GIT_OBJ_COMMIT
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
orig_head
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
orig_head
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_revert
(
repo
,
orig_head
,
NULL
));
cl_git_pass
(
git_revert
(
repo
,
orig_head
,
NULL
));
...
@@ -227,7 +227,7 @@ void test_revert_workdir__again_after_automerge(void)
...
@@ -227,7 +227,7 @@ void test_revert_workdir__again_after_automerge(void)
git_oid_fromstr
(
&
head_oid
,
"72333f47d4e83616630ff3b0ffe4c0faebcc3c45"
);
git_oid_fromstr
(
&
head_oid
,
"72333f47d4e83616630ff3b0ffe4c0faebcc3c45"
);
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
,
NULL
));
git_oid_fromstr
(
&
revert_oid
,
"d1d403d22cbe24592d725f442835cf46fe60c8ac"
);
git_oid_fromstr
(
&
revert_oid
,
"d1d403d22cbe24592d725f442835cf46fe60c8ac"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
...
@@ -275,7 +275,7 @@ void test_revert_workdir__again_after_edit(void)
...
@@ -275,7 +275,7 @@ void test_revert_workdir__again_after_edit(void)
cl_git_pass
(
git_oid_fromstr
(
&
orig_head_oid
,
"399fb3aba3d9d13f7d40a9254ce4402067ef3149"
));
cl_git_pass
(
git_oid_fromstr
(
&
orig_head_oid
,
"399fb3aba3d9d13f7d40a9254ce4402067ef3149"
));
cl_git_pass
(
git_commit_lookup
(
&
orig_head
,
repo
,
&
orig_head_oid
));
cl_git_pass
(
git_commit_lookup
(
&
orig_head
,
repo
,
&
orig_head_oid
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
orig_head
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
orig_head
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_oid_fromstr
(
&
revert_oid
,
"2d440f2b3147d3dc7ad1085813478d6d869d5a4d"
));
cl_git_pass
(
git_oid_fromstr
(
&
revert_oid
,
"2d440f2b3147d3dc7ad1085813478d6d869d5a4d"
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
...
@@ -326,7 +326,7 @@ void test_revert_workdir__again_after_edit_two(void)
...
@@ -326,7 +326,7 @@ void test_revert_workdir__again_after_edit_two(void)
cl_git_pass
(
git_oid_fromstr
(
&
head_commit_oid
,
"e34ef1afe54eb526fd92eec66084125f340f1d65"
));
cl_git_pass
(
git_oid_fromstr
(
&
head_commit_oid
,
"e34ef1afe54eb526fd92eec66084125f340f1d65"
));
cl_git_pass
(
git_commit_lookup
(
&
head_commit
,
repo
,
&
head_commit_oid
));
cl_git_pass
(
git_commit_lookup
(
&
head_commit
,
repo
,
&
head_commit_oid
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head_commit
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_oid_fromstr
(
&
revert_commit_oid
,
"71eb9c2b53dbbf3c45fb28b27c850db4b7fb8011"
));
cl_git_pass
(
git_oid_fromstr
(
&
revert_commit_oid
,
"71eb9c2b53dbbf3c45fb28b27c850db4b7fb8011"
));
cl_git_pass
(
git_commit_lookup
(
&
revert_commit
,
repo
,
&
revert_commit_oid
));
cl_git_pass
(
git_commit_lookup
(
&
revert_commit
,
repo
,
&
revert_commit_oid
));
...
@@ -379,7 +379,7 @@ void test_revert_workdir__conflict_use_ours(void)
...
@@ -379,7 +379,7 @@ void test_revert_workdir__conflict_use_ours(void)
git_oid_fromstr
(
&
head_oid
,
"72333f47d4e83616630ff3b0ffe4c0faebcc3c45"
);
git_oid_fromstr
(
&
head_oid
,
"72333f47d4e83616630ff3b0ffe4c0faebcc3c45"
);
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
,
NULL
));
git_oid_fromstr
(
&
revert_oid
,
"d1d403d22cbe24592d725f442835cf46fe60c8ac"
);
git_oid_fromstr
(
&
revert_oid
,
"d1d403d22cbe24592d725f442835cf46fe60c8ac"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
...
@@ -415,7 +415,7 @@ void test_revert_workdir__rename_1_of_2(void)
...
@@ -415,7 +415,7 @@ void test_revert_workdir__rename_1_of_2(void)
git_oid_fromstr
(
&
head_oid
,
"cef56612d71a6af8d8015691e4865f7fece905b5"
);
git_oid_fromstr
(
&
head_oid
,
"cef56612d71a6af8d8015691e4865f7fece905b5"
);
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
,
NULL
));
git_oid_fromstr
(
&
revert_oid
,
"55568c8de5322ff9a95d72747a239cdb64a19965"
);
git_oid_fromstr
(
&
revert_oid
,
"55568c8de5322ff9a95d72747a239cdb64a19965"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
...
@@ -449,7 +449,7 @@ void test_revert_workdir__rename(void)
...
@@ -449,7 +449,7 @@ void test_revert_workdir__rename(void)
git_oid_fromstr
(
&
head_oid
,
"55568c8de5322ff9a95d72747a239cdb64a19965"
);
git_oid_fromstr
(
&
head_oid
,
"55568c8de5322ff9a95d72747a239cdb64a19965"
);
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
,
NULL
));
git_oid_fromstr
(
&
revert_oid
,
"0aa8c7e40d342fff78d60b29a4ba8e993ed79c51"
);
git_oid_fromstr
(
&
revert_oid
,
"0aa8c7e40d342fff78d60b29a4ba8e993ed79c51"
);
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
cl_git_pass
(
git_commit_lookup
(
&
commit
,
repo
,
&
revert_oid
));
...
@@ -478,7 +478,7 @@ void test_revert_workdir__head(void)
...
@@ -478,7 +478,7 @@ void test_revert_workdir__head(void)
/* HEAD is 2d440f2b3147d3dc7ad1085813478d6d869d5a4d */
/* HEAD is 2d440f2b3147d3dc7ad1085813478d6d869d5a4d */
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
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
commit
,
GIT_RESET_HARD
,
NULL
,
NULL
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
commit
,
GIT_RESET_HARD
,
NULL
,
NULL
,
NULL
));
cl_git_pass
(
git_revert
(
repo
,
commit
,
NULL
));
cl_git_pass
(
git_revert
(
repo
,
commit
,
NULL
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
4
));
cl_assert
(
merge_test_index
(
repo_index
,
merge_index_entries
,
4
));
...
@@ -515,7 +515,7 @@ void test_revert_workdir__merge_fails_without_mainline_specified(void)
...
@@ -515,7 +515,7 @@ void test_revert_workdir__merge_fails_without_mainline_specified(void)
git_oid_fromstr
(
&
head_oid
,
"5acdc74af27172ec491d213ee36cea7eb9ef2579"
);
git_oid_fromstr
(
&
head_oid
,
"5acdc74af27172ec491d213ee36cea7eb9ef2579"
);
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
,
NULL
));
cl_must_fail
(
git_revert
(
repo
,
head
,
NULL
));
cl_must_fail
(
git_revert
(
repo
,
head
,
NULL
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
cl_assert
(
!
git_path_exists
(
TEST_REPO_PATH
"/.git/MERGE_MSG"
));
...
@@ -542,7 +542,7 @@ void test_revert_workdir__merge_first_parent(void)
...
@@ -542,7 +542,7 @@ void test_revert_workdir__merge_first_parent(void)
git_oid_fromstr
(
&
head_oid
,
"5acdc74af27172ec491d213ee36cea7eb9ef2579"
);
git_oid_fromstr
(
&
head_oid
,
"5acdc74af27172ec491d213ee36cea7eb9ef2579"
);
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
,
NULL
));
cl_git_pass
(
git_revert
(
repo
,
head
,
&
opts
));
cl_git_pass
(
git_revert
(
repo
,
head
,
&
opts
));
...
@@ -567,7 +567,7 @@ void test_revert_workdir__merge_second_parent(void)
...
@@ -567,7 +567,7 @@ void test_revert_workdir__merge_second_parent(void)
git_oid_fromstr
(
&
head_oid
,
"5acdc74af27172ec491d213ee36cea7eb9ef2579"
);
git_oid_fromstr
(
&
head_oid
,
"5acdc74af27172ec491d213ee36cea7eb9ef2579"
);
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
,
NULL
));
cl_git_pass
(
git_revert
(
repo
,
head
,
&
opts
));
cl_git_pass
(
git_revert
(
repo
,
head
,
&
opts
));
...
...
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