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
39783719
Commit
39783719
authored
Sep 17, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkout: Mimic git_diff_options storage of paths
parent
5e4cb4f4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
17 deletions
+9
-17
include/git2/checkout.h
+1
-1
src/checkout.c
+2
-4
tests-clar/checkout/index.c
+2
-4
tests-clar/checkout/tree.c
+4
-8
No files found.
include/git2/checkout.h
View file @
39783719
...
...
@@ -39,7 +39,7 @@ typedef struct git_checkout_opts {
/* when not NULL, arrays of fnmatch pattern specifying
* which paths should be taken into account
*/
git_strarray
*
paths
;
git_strarray
paths
;
}
git_checkout_opts
;
/**
...
...
src/checkout.c
View file @
39783719
...
...
@@ -282,10 +282,8 @@ int git_checkout_index(
diff_opts
.
flags
=
GIT_DIFF_INCLUDE_UNTRACKED
;
if
(
opts
&&
opts
->
paths
)
{
diff_opts
.
pathspec
.
strings
=
opts
->
paths
->
strings
;
diff_opts
.
pathspec
.
count
=
opts
->
paths
->
count
;
}
if
(
opts
&&
opts
->
paths
.
count
>
0
)
diff_opts
.
pathspec
=
opts
->
paths
;
if
((
error
=
git_diff_workdir_to_index
(
repo
,
&
diff_opts
,
&
diff
))
<
0
)
goto
cleanup
;
...
...
tests-clar/checkout/index.c
View file @
39783719
...
...
@@ -102,12 +102,10 @@ void test_checkout_index__can_remove_untracked_files(void)
void
test_checkout_index__honor_the_specified_pathspecs
(
void
)
{
git_strarray
paths
;
char
*
entries
[]
=
{
"*.txt"
};
paths
.
strings
=
entries
;
paths
.
count
=
1
;
g_opts
.
paths
=
&
paths
;
g_opts
.
paths
.
strings
=
entries
;
g_opts
.
paths
.
count
=
1
;
cl_assert_equal_i
(
false
,
git_path_isfile
(
"./testrepo/README"
));
cl_assert_equal_i
(
false
,
git_path_isfile
(
"./testrepo/branch_file.txt"
));
...
...
tests-clar/checkout/tree.c
View file @
39783719
...
...
@@ -32,12 +32,10 @@ void test_checkout_tree__cannot_checkout_a_non_treeish(void)
void
test_checkout_tree__can_checkout_a_subdirectory_from_a_commit
(
void
)
{
git_strarray
paths
;
char
*
entries
[]
=
{
"ab/de/"
};
paths
.
strings
=
entries
;
paths
.
count
=
1
;
g_opts
.
paths
=
&
paths
;
g_opts
.
paths
.
strings
=
entries
;
g_opts
.
paths
.
count
=
1
;
cl_git_pass
(
git_revparse_single
(
&
g_object
,
g_repo
,
"subtrees"
));
...
...
@@ -51,12 +49,10 @@ void test_checkout_tree__can_checkout_a_subdirectory_from_a_commit(void)
void
test_checkout_tree__can_checkout_a_subdirectory_from_a_subtree
(
void
)
{
git_strarray
paths
;
char
*
entries
[]
=
{
"de/"
};
paths
.
strings
=
entries
;
paths
.
count
=
1
;
g_opts
.
paths
=
&
paths
;
g_opts
.
paths
.
strings
=
entries
;
g_opts
.
paths
.
count
=
1
;
cl_git_pass
(
git_revparse_single
(
&
g_object
,
g_repo
,
"subtrees:ab"
));
...
...
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