summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/ls-files.c4
-rwxr-xr-xt/t3007-ls-files-recurse-submodules.sh1
2 files changed, 5 insertions, 0 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index d449e46db5..e9b3546ca0 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -15,6 +15,7 @@
#include "string-list.h"
#include "pathspec.h"
#include "run-command.h"
+#include "submodule.h"
static int abbrev;
static int show_deleted;
@@ -203,6 +204,9 @@ static void show_gitlink(const struct cache_entry *ce)
struct child_process cp = CHILD_PROCESS_INIT;
int status;
+ prepare_submodule_repo_env(&cp.env_array);
+ argv_array_push(&cp.env_array, GIT_DIR_ENVIRONMENT);
+
if (prefix_len)
argv_array_pushf(&cp.env_array, "%s=%s",
GIT_TOPLEVEL_PREFIX_ENVIRONMENT,
diff --git a/t/t3007-ls-files-recurse-submodules.sh b/t/t3007-ls-files-recurse-submodules.sh
index 4cf6ccf5a8..c8030dd329 100755
--- a/t/t3007-ls-files-recurse-submodules.sh
+++ b/t/t3007-ls-files-recurse-submodules.sh
@@ -77,6 +77,7 @@ test_expect_success 'ls-files recurses more than 1 level' '
git -C submodule/subsub commit -m "add d" &&
git -C submodule submodule add ./subsub &&
git -C submodule commit -m "added subsub" &&
+ git submodule absorbgitdirs &&
git ls-files --recurse-submodules >actual &&
test_cmp expect actual
'