OSDN Git Service

submodule.c: stricter checking for submodules in is_submodule_modified
authorStefan Beller <sbeller@google.com>
Sat, 25 Mar 2017 00:36:08 +0000 (17:36 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Mar 2017 16:48:19 +0000 (09:48 -0700)
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>
submodule.c

index 5865795..fa21c7b 100644 (file)
@@ -1052,11 +1052,12 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
        git_dir = read_gitfile(buf.buf);
        if (!git_dir)
                git_dir = buf.buf;
-       if (!is_directory(git_dir)) {
+       if (!is_git_directory(git_dir)) {
+               if (is_directory(git_dir))
+                       die(_("'%s' not recognized as a git repository"), git_dir);
                strbuf_release(&buf);
                /* The submodule is not checked out, so it is not modified */
                return 0;
-
        }
        strbuf_reset(&buf);