diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-02-14 12:54:23 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-14 12:54:23 -0800 |
commit | f2dcfcc21d233c71e47e2ddae799968a18775a1d (patch) | |
tree | c67110e5317c2b0835a861af2b9ad60ad1e09d07 /builtin/submodule--helper.c | |
parent | Merge branch 'mt/use-passed-repo-more-in-funcs' (diff) | |
parent | t7400: testcase for submodule status on unregistered inner git repos (diff) | |
download | tgif-f2dcfcc21d233c71e47e2ddae799968a18775a1d.tar.xz |
Merge branch 'pk/status-of-uncloned-submodule'
The way "git submodule status" reports an initialized but not yet
populated submodule has not been reimplemented correctly when a
part of the "git submodule" command was rewritten in C, which has
been corrected.
* pk/status-of-uncloned-submodule:
t7400: testcase for submodule status on unregistered inner git repos
submodule: fix status of initialized but not cloned submodules
t7400: add a testcase for submodule status on empty dirs
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r-- | builtin/submodule--helper.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index c72931ecd7..b6e4c79968 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -782,6 +782,8 @@ static void status_submodule(const char *path, const struct object_id *ce_oid, struct argv_array diff_files_args = ARGV_ARRAY_INIT; struct rev_info rev; int diff_files_result; + struct strbuf buf = STRBUF_INIT; + const char *git_dir; if (!submodule_from_path(the_repository, &null_oid, path)) die(_("no submodule mapping found in .gitmodules for path '%s'"), @@ -794,10 +796,18 @@ static void status_submodule(const char *path, const struct object_id *ce_oid, goto cleanup; } - if (!is_submodule_active(the_repository, path)) { + strbuf_addf(&buf, "%s/.git", path); + git_dir = read_gitfile(buf.buf); + if (!git_dir) + git_dir = buf.buf; + + if (!is_submodule_active(the_repository, path) || + !is_git_directory(git_dir)) { print_status(flags, '-', path, ce_oid, displaypath); + strbuf_release(&buf); goto cleanup; } + strbuf_release(&buf); argv_array_pushl(&diff_files_args, "diff-files", "--ignore-submodules=dirty", "--quiet", "--", |