@@ -35,6 +35,7 @@ static int show_fsmonitor_bit;
static int line_terminator = '\n';
static int debug_mode;
static int show_eol;
+static int exclude_submodules;
static int recurse_submodules;
static int skipping_duplicates;
@@ -230,6 +231,9 @@ static void show_ce(struct repository *repo, struct dir_struct *dir,
if (max_prefix_len > strlen(fullname))
die("git ls-files: internal error - cache entry not superset of prefix");
+ if (exclude_submodules && S_ISGITLINK(ce->ce_mode))
+ return;
+
if (recurse_submodules && S_ISGITLINK(ce->ce_mode) &&
is_submodule_active(repo, ce->name)) {
show_submodule(repo, dir, ce->name);@@ -662,6 +666,8 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
OPT_SET_INT_F(0, "full-name", &prefix_len,
N_("make the output relative to the project top directory"),
0, PARSE_OPT_NONEG),
+ OPT_BOOL(0, "exclude-submodules", &exclude_submodules,
+ N_("avoid showing submodules altogether")),
OPT_BOOL(0, "recurse-submodules", &recurse_submodules,
N_("recurse through submodules")),
OPT_BOOL(0, "error-unmatch", &error_unmatch,
--- 8< ---