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
dacce80b
Commit
dacce80b
authored
Jun 20, 2013
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test asserting checkout should not recreate deleted files
parent
f2d110f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
tests-clar/checkout/tree.c
+30
-0
No files found.
tests-clar/checkout/tree.c
View file @
dacce80b
...
...
@@ -442,6 +442,36 @@ void test_checkout_tree__checking_out_a_conflicting_content_change_returns_EMERG
assert_conflict
(
"branch_file.txt"
,
"hello
\n
"
,
"5b5b025"
,
"c47800c"
);
}
void
test_checkout_tree__donot_update_deleted_file_by_default
(
void
)
{
git_checkout_opts
opts
=
GIT_CHECKOUT_OPTS_INIT
;
git_oid
old_id
,
new_id
;
git_commit
*
old_commit
=
NULL
,
*
new_commit
=
NULL
;
git_index
*
index
=
NULL
;
opts
.
checkout_strategy
=
GIT_CHECKOUT_SAFE
;
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
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_reset
(
g_repo
,
(
git_object
*
)
old_commit
,
GIT_RESET_HARD
));
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_write
(
index
));
cl_assert
(
!
git_path_exists
(
"testrepo/branch_file.txt"
));
cl_git_pass
(
git_oid_fromstr
(
&
new_id
,
"099fabac3a9ea935598528c27f866e34089c2eff"
));
cl_git_pass
(
git_commit_lookup
(
&
new_commit
,
g_repo
,
&
new_id
));
cl_git_fail
(
git_checkout_tree
(
g_repo
,
(
git_object
*
)
new_commit
,
&
opts
));
git_commit_free
(
old_commit
);
git_commit_free
(
new_commit
);
git_index_free
(
index
);
}
void
test_checkout_tree__can_checkout_with_last_workdir_item_missing
(
void
)
{
git_index
*
index
=
NULL
;
...
...
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