diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-04-23 22:07:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-23 22:07:57 -0700 |
commit | 2d646e3e1fd0ae7f525034abee73d06ac8946729 (patch) | |
tree | f3be44131af79184a4c5647c9b41ddd915d86a8f /builtin | |
parent | Merge branch 'rs/misc-cppcheck-fixes' (diff) | |
parent | ls-files: fix path used when recursing into submodules (diff) | |
download | tgif-2d646e3e1fd0ae7f525034abee73d06ac8946729.tar.xz |
Merge branch 'jk/ls-files-recurse-submodules-fix'
"ls-files --recurse-submodules" did not quite work well in a
project with nested submodules.
* jk/ls-files-recurse-submodules-fix:
ls-files: fix path used when recursing into submodules
ls-files: fix recurse-submodules with nested submodules
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/ls-files.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c index d449e46db5..a6c70dbe9e 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; @@ -202,6 +203,10 @@ static void show_gitlink(const struct cache_entry *ce) { struct child_process cp = CHILD_PROCESS_INIT; int status; + char *dir; + + 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", @@ -217,8 +222,10 @@ static void show_gitlink(const struct cache_entry *ce) argv_array_pushv(&cp.args, submodule_options.argv); cp.git_cmd = 1; - cp.dir = ce->name; + dir = mkpathdup("%s/%s", get_git_work_tree(), ce->name); + cp.dir = dir; status = run_command(&cp); + free(dir); if (status) exit(status); } |