submodule: implement a config API for lookup of .gitmodules values
[gitweb.git] / submodule.c
index d491e6a7717ef0e1b9f7efd91becb024b98e0161..7822dc57a548de60c6bec7ed1d233cdc335874d8 100644 (file)
@@ -355,6 +355,7 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg)
        default:
                if (!strcmp(arg, "on-demand"))
                        return RECURSE_SUBMODULES_ON_DEMAND;
+               /* TODO: remove the die for history parsing here */
                die("bad %s argument: %s", opt, arg);
        }
 }
@@ -891,7 +892,6 @@ int submodule_uses_gitfile(const char *path)
 
 int ok_to_remove_submodule(const char *path)
 {
-       struct stat st;
        ssize_t len;
        struct child_process cp = CHILD_PROCESS_INIT;
        const char *argv[] = {
@@ -904,7 +904,7 @@ int ok_to_remove_submodule(const char *path)
        struct strbuf buf = STRBUF_INIT;
        int ok_to_remove = 1;
 
-       if ((lstat(path, &st) < 0) || is_empty_dir(path))
+       if (!file_exists(path) || is_empty_dir(path))
                return 1;
 
        if (!submodule_uses_gitfile(path))