From 129cadf9bf9ef1b43dd844d54f2b57a52b69ed2a Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 2 Mar 2023 23:20:45 +0000 Subject: 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. --- src/libgit2/index.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1