summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@vercel.com>2023-03-02 23:20:45 +0000
committerEdward Thomson <ethomson@vercel.com>2023-03-02 23:22:01 +0000
commit129cadf9bf9ef1b43dd844d54f2b57a52b69ed2a (patch)
tree2394626b8348371bca263ea1e5808c140577eefc
parent309befe413d7ab68e8e410d8121af98467620792 (diff)
downloadlibgit2-129cadf9bf9ef1b43dd844d54f2b57a52b69ed2a.tar.gz
index: support `git_index_add_all` directories with force
When the contents of an entire new directory is ignored, and `FORCE` is specified to `git_index_add_all`, ensure that we expand the entire file list. By default, diff will coalesce a fully ignored folder into a single diff entry; expand it.
-rw-r--r--src/libgit2/index.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libgit2/index.c b/src/libgit2/index.c
index 195ec1d5a..d4532c005 100644
--- a/src/libgit2/index.c
+++ b/src/libgit2/index.c
@@ -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)