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
2b2dfe80
Commit
2b2dfe80
authored
May 12, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index: include TYPECHANGE in the diff
Without this option, we would not be able to catch exec bit changes.
parent
0a78a52e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
src/index.c
+2
-1
tests/index/addall.c
+13
-0
No files found.
src/index.c
View file @
2b2dfe80
...
@@ -2681,8 +2681,9 @@ static int index_apply_to_wd_diff(git_index *index, int action, const git_strarr
...
@@ -2681,8 +2681,9 @@ static int index_apply_to_wd_diff(git_index *index, int action, const git_strarr
if
((
error
=
git_pathspec__init
(
&
ps
,
paths
))
<
0
)
if
((
error
=
git_pathspec__init
(
&
ps
,
paths
))
<
0
)
return
error
;
return
error
;
opts
.
flags
=
GIT_DIFF_INCLUDE_TYPECHANGE
;
if
(
action
==
INDEX_ACTION_ADDALL
)
{
if
(
action
==
INDEX_ACTION_ADDALL
)
{
opts
.
flags
=
GIT_DIFF_INCLUDE_UNTRACKED
|
GIT_DIFF_RECURSE_IGNORED_DIRS
;
opts
.
flags
|
=
GIT_DIFF_INCLUDE_UNTRACKED
|
GIT_DIFF_RECURSE_IGNORED_DIRS
;
if
(
flags
==
GIT_INDEX_ADD_FORCE
)
if
(
flags
==
GIT_INDEX_ADD_FORCE
)
opts
.
flags
|=
GIT_DIFF_INCLUDE_IGNORED
;
opts
.
flags
|=
GIT_DIFF_INCLUDE_IGNORED
;
}
}
...
...
tests/index/addall.c
View file @
2b2dfe80
...
@@ -193,6 +193,19 @@ void test_index_addall__repo_lifecycle(void)
...
@@ -193,6 +193,19 @@ void test_index_addall__repo_lifecycle(void)
cl_repo_commit_from_index
(
NULL
,
g_repo
,
NULL
,
0
,
"first commit"
);
cl_repo_commit_from_index
(
NULL
,
g_repo
,
NULL
,
0
,
"first commit"
);
check_status
(
g_repo
,
0
,
0
,
0
,
3
,
0
,
0
,
1
);
check_status
(
g_repo
,
0
,
0
,
0
,
3
,
0
,
0
,
1
);
if
(
cl_repo_get_bool
(
g_repo
,
"core.filemode"
))
{
cl_git_pass
(
git_index_update_all
(
index
,
NULL
,
NULL
,
NULL
));
cl_must_pass
(
p_chmod
(
TEST_DIR
"/file.zzz"
,
0777
));
cl_git_pass
(
git_index_update_all
(
index
,
NULL
,
NULL
,
NULL
));
check_status
(
g_repo
,
0
,
0
,
1
,
3
,
0
,
0
,
1
);
/* go back to what we had before */
cl_must_pass
(
p_chmod
(
TEST_DIR
"/file.zzz"
,
0666
));
cl_git_pass
(
git_index_update_all
(
index
,
NULL
,
NULL
,
NULL
));
check_status
(
g_repo
,
0
,
0
,
0
,
3
,
0
,
0
,
1
);
}
/* attempt to add an ignored file - does nothing */
/* attempt to add an ignored file - does nothing */
strs
[
0
]
=
"file.foo"
;
strs
[
0
]
=
"file.foo"
;
cl_git_pass
(
git_index_add_all
(
index
,
&
paths
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_index_add_all
(
index
,
&
paths
,
0
,
NULL
,
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