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
4c534892
Commit
4c534892
authored
Sep 29, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2581 from jacquesg/stash-ignored-directories
Stash ignored directories
parents
89602a1a
7b7aa75f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
src/stash.c
+5
-3
tests/stash/save.c
+17
-0
No files found.
src/stash.c
View file @
4c534892
...
...
@@ -232,7 +232,8 @@ static int build_untracked_tree(
}
if
(
flags
&
GIT_STASH_INCLUDE_IGNORED
)
{
opts
.
flags
|=
GIT_DIFF_INCLUDE_IGNORED
;
opts
.
flags
|=
GIT_DIFF_INCLUDE_IGNORED
|
GIT_DIFF_RECURSE_IGNORED_DIRS
;
data
.
include_ignored
=
true
;
}
...
...
@@ -447,10 +448,11 @@ static int ensure_there_are_changes_to_stash(
if
(
include_untracked_files
)
opts
.
flags
|=
GIT_STATUS_OPT_INCLUDE_UNTRACKED
|
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS
;
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS
;
if
(
include_ignored_files
)
opts
.
flags
|=
GIT_STATUS_OPT_INCLUDE_IGNORED
;
opts
.
flags
|=
GIT_STATUS_OPT_INCLUDE_IGNORED
|
GIT_STATUS_OPT_RECURSE_IGNORED_DIRS
;
error
=
git_status_foreach_ext
(
repo
,
&
opts
,
is_dirty_cb
,
NULL
);
...
...
tests/stash/save.c
View file @
4c534892
...
...
@@ -368,6 +368,23 @@ void test_stash_save__including_untracked_without_any_untracked_file_creates_an_
assert_object_oid
(
"stash^3^{tree}"
,
EMPTY_TREE
,
GIT_OBJ_TREE
);
}
void
test_stash_save__ignored_directory
(
void
)
{
cl_git_pass
(
mkdir
(
"stash/ignored_directory"
,
0777
));
cl_git_pass
(
mkdir
(
"stash/ignored_directory/sub"
,
0777
));
cl_git_mkfile
(
"stash/ignored_directory/sub/some_file"
,
"stuff"
);
assert_status
(
repo
,
"ignored_directory/sub/some_file"
,
GIT_STATUS_WT_NEW
);
cl_git_pass
(
git_ignore_add_rule
(
repo
,
"ignored_directory/"
));
assert_status
(
repo
,
"ignored_directory/sub/some_file"
,
GIT_STATUS_IGNORED
);
cl_git_pass
(
git_stash_save
(
&
stash_tip_oid
,
repo
,
signature
,
NULL
,
GIT_STASH_INCLUDE_UNTRACKED
|
GIT_STASH_INCLUDE_IGNORED
));
cl_assert
(
!
git_path_exists
(
"stash/ignored_directory/sub/some_file"
));
cl_assert
(
!
git_path_exists
(
"stash/ignored_directory/sub"
));
cl_assert
(
!
git_path_exists
(
"stash/ignored_directory"
));
}
void
test_stash_save__skip_submodules
(
void
)
{
git_repository
*
untracked_repo
;
...
...
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