Skip to content

Commit a3105e7

Browse files
committed
first working submodule ignore=all skipped in adding
1 parent c44beea commit a3105e7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

read-cache.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
#include "csum-file.h"
4949
#include "promisor-remote.h"
5050
#include "hook.h"
51+
#include "submodule.h"
52+
#include "submodule-config.h"
5153

5254
/* Mask for the name length in ce_flags in the on-disk index */
5355

@@ -3879,6 +3881,7 @@ void overlay_tree_on_index(struct index_state *istate,
38793881
}
38803882

38813883
struct update_callback_data {
3884+
struct repository *repo;
38823885
struct index_state *index;
38833886
int include_sparse;
38843887
int flags;
@@ -3924,7 +3927,16 @@ static void update_callback(struct diff_queue_struct *q,
39243927
default:
39253928
die(_("unexpected diff status %c"), p->status);
39263929
case DIFF_STATUS_MODIFIED:
3927-
case DIFF_STATUS_TYPE_CHANGED:
3930+
const struct submodule *sub = submodule_from_path(data->repo, NULL, path);
3931+
if (sub) {
3932+
if ( sub->ignore ) {
3933+
fprintf(stderr, "GIT_TRACE: Skipping submodule with ignore NOT NULL: %s\n", path);
3934+
if (strcmp(sub->ignore, "all") == 0) {
3935+
trace_printf("Skipping submodule with ignore=all: %s\n", path);
3936+
continue;
3937+
}
3938+
}
3939+
}
39283940
if (add_file_to_index(data->index, path, data->flags)) {
39293941
if (!(data->flags & ADD_CACHE_IGNORE_ERRORS))
39303942
die(_("updating files failed"));
@@ -3949,8 +3961,8 @@ int add_files_to_cache(struct repository *repo, const char *prefix,
39493961
{
39503962
struct update_callback_data data;
39513963
struct rev_info rev;
3952-
39533964
memset(&data, 0, sizeof(data));
3965+
data.repo = repo;
39543966
data.index = repo->index;
39553967
data.include_sparse = include_sparse;
39563968
data.flags = flags;

0 commit comments

Comments
 (0)