diff options
| -rw-r--r-- | src/index.c | 3 | ||||
| -rw-r--r-- | tests/index/addall.c | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/index.c b/src/index.c index 3d0f4d14d..8f0976d13 100644 --- a/src/index.c +++ b/src/index.c @@ -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) return error; + opts.flags = GIT_DIFF_INCLUDE_TYPECHANGE; 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) opts.flags |= GIT_DIFF_INCLUDE_IGNORED; } diff --git a/tests/index/addall.c b/tests/index/addall.c index a7e2583b2..f13b768ce 100644 --- a/tests/index/addall.c +++ b/tests/index/addall.c @@ -193,6 +193,19 @@ void test_index_addall__repo_lifecycle(void) cl_repo_commit_from_index(NULL, g_repo, NULL, 0, "first commit"); 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 */ strs[0] = "file.foo"; cl_git_pass(git_index_add_all(index, &paths, 0, NULL, NULL)); |
