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
8164b481
Unverified
Commit
8164b481
authored
Mar 03, 2023
by
Edward Thomson
Committed by
GitHub
Mar 03, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6521 from libgit2/ethomson/weird_ignore
parents
af12fc11
129cadf9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletions
+48
-1
src/libgit2/index.c
+2
-1
tests/libgit2/index/addall.c
+46
-0
No files found.
src/libgit2/index.c
View file @
8164b481
...
...
@@ -3509,7 +3509,8 @@ static int index_apply_to_wd_diff(git_index *index, int action, const git_strarr
GIT_DIFF_RECURSE_UNTRACKED_DIRS
;
if
(
flags
==
GIT_INDEX_ADD_FORCE
)
opts
.
flags
|=
GIT_DIFF_INCLUDE_IGNORED
;
opts
.
flags
|=
GIT_DIFF_INCLUDE_IGNORED
|
GIT_DIFF_RECURSE_IGNORED_DIRS
;
}
if
((
error
=
git_diff_index_to_workdir
(
&
diff
,
repo
,
index
,
&
opts
))
<
0
)
...
...
tests/libgit2/index/addall.c
View file @
8164b481
...
...
@@ -441,6 +441,52 @@ void test_index_addall__callback_filtering(void)
git_index_free
(
index
);
}
void
test_index_addall__handles_ignored_files_in_directory
(
void
)
{
git_index
*
index
;
g_repo
=
cl_git_sandbox_init_new
(
TEST_DIR
);
cl_git_mkfile
(
TEST_DIR
"/file.foo"
,
"a file"
);
cl_git_mkfile
(
TEST_DIR
"/file.bar"
,
"another file"
);
cl_must_pass
(
p_mkdir
(
TEST_DIR
"/folder"
,
0777
));
cl_git_mkfile
(
TEST_DIR
"/folder/asdf"
,
"yet another file"
);
cl_git_mkfile
(
TEST_DIR
"/.gitignore"
,
"folder/
\n
"
);
check_status
(
g_repo
,
0
,
0
,
0
,
3
,
0
,
0
,
1
,
0
);
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
git_index_add_all
(
index
,
NULL
,
0
,
NULL
,
NULL
));
check_status
(
g_repo
,
3
,
0
,
0
,
0
,
0
,
0
,
1
,
0
);
git_index_free
(
index
);
}
void
test_index_addall__force_adds_ignored_directories
(
void
)
{
git_index
*
index
;
g_repo
=
cl_git_sandbox_init_new
(
TEST_DIR
);
cl_git_mkfile
(
TEST_DIR
"/file.foo"
,
"a file"
);
cl_git_mkfile
(
TEST_DIR
"/file.bar"
,
"another file"
);
cl_must_pass
(
p_mkdir
(
TEST_DIR
"/folder"
,
0777
));
cl_git_mkfile
(
TEST_DIR
"/folder/asdf"
,
"yet another file"
);
cl_git_mkfile
(
TEST_DIR
"/.gitignore"
,
"folder/
\n
"
);
check_status
(
g_repo
,
0
,
0
,
0
,
3
,
0
,
0
,
1
,
0
);
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
git_index_add_all
(
index
,
NULL
,
GIT_INDEX_ADD_FORCE
,
NULL
,
NULL
));
check_status
(
g_repo
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
git_index_free
(
index
);
}
void
test_index_addall__adds_conflicts
(
void
)
{
git_index
*
index
;
...
...
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