Skip to content

Commit 9ec79b9

Browse files
committed
read-cache: add/read-cache respect submodule ignore=all
Submodules configured with ignore=all are now skipped during add operations unless overridden by --include-ignored-submodules and the submodule path is explicitly specified. A message is printed (like ignored files) guiding the user to use the --include-ignored-submodules flag if the user has explicitely want to update the submodule reference. The reason for the change is support submodule branch tracking or similar and git status state nothing and git add should not add either. The workflow is more logic and similar to regular ignored files even the submodule is already tracked. The change opens up a lot of possibilities for submodules to be used more freely and simular to the repo tool. A submodule can be added for many more reason and loosely coupled dependencies to the super repo which often gives the friction of handle the explicit commits and updates without the need for tracking the submodule sha1 by sha1. Signed-off-by: Claus Schneider(Eficode) <claus.schneider@eficode.com>
1 parent 5796009 commit 9ec79b9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

read-cache.c

Lines changed: 5 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

@@ -3956,15 +3958,15 @@ static void update_callback(struct diff_queue_struct *q,
39563958
}
39573959
if (pathspec_matches) {
39583960
if (data->include_ignored_submodules && data->include_ignored_submodules > 0) {
3959-
trace_printf("Add ignored=all submodule due to --include_ignored_submodules: %s\n", path);
3961+
trace_printf("Add submodule due to --include_ignored_submodules: %s\n", path);
39603962
} else {
39613963
printf(_("Skipping submodule due to ignore=all: %s"), path);
39623964
printf(_("Use --include_ignored_submodules, if you really want to add them.") );
39633965
continue;
39643966
}
39653967
} else {
39663968
/* No explicit pathspec match -> skip silently (or with trace). */
3967-
trace_printf("pathspec does not match %s\n", path);
3969+
trace_printf("Pathspec to submodule does not match explicitly: %s\n", path);
39683970
continue;
39693971
}
39703972
}
@@ -3975,6 +3977,7 @@ static void update_callback(struct diff_queue_struct *q,
39753977
data->add_errors++;
39763978
}
39773979
break;
3980+
}
39783981
case DIFF_STATUS_DELETED:
39793982
if (data->flags & ADD_CACHE_IGNORE_REMOVAL)
39803983
break;

0 commit comments

Comments
 (0)