submodule.c: stricter checking for submodules in is_submodule_modified
By having a stricter check in the superproject we catch errors earlier, instead of spawning a child process to tell us. Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 24, 2017 at 17:36 UTC
5c896f7c3ec69f017d1e1be4164d558918f3ae4c
1 file changed
+3
-2
submodule.c
+3
-2
@@ -1052,11 +1052,12 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
1052
git_dir = read_gitfile(buf.buf);
1053
if (!git_dir)
1054
git_dir = buf.buf;
1055
- if (!is_directory(git_dir)) {
1055
+ if (!is_git_directory(git_dir)) {
1056
+ if (is_directory(git_dir))
1057
+ die(_("'%s' not recognized as a git repository"), git_dir);
1058
strbuf_release(&buf);
1059
/* The submodule is not checked out, so it is not modified */
1060
return 0;
1059
-
1061
}
1062
strbuf_reset(&buf);
1063