| 1960 | } |
| 1961 | |
| 1962 | int submodule_uses_gitfile(const char *path) |
| 1963 | { |
| 1964 | struct child_process cp = CHILD_PROCESS_INIT; |
| 1965 | struct strbuf buf = STRBUF_INIT; |
| 1966 | const char *git_dir; |
| 1967 | |
| 1968 | if (validate_submodule_path(path) < 0) |
| 1969 | exit(128); |
| 1970 | |
| 1971 | strbuf_addf(&buf, "%s/.git", path); |
| 1972 | git_dir = read_gitfile(buf.buf); |
| 1973 | if (!git_dir) { |
| 1974 | strbuf_release(&buf); |
| 1975 | return 0; |
| 1976 | } |
| 1977 | strbuf_release(&buf); |
| 1978 | |
| 1979 | /* Now test that all nested submodules use a gitfile too */ |
| 1980 | strvec_pushl(&cp.args, |
| 1981 | "submodule", "foreach", "--quiet", "--recursive", |
| 1982 | "test -f .git", NULL); |
| 1983 | |
| 1984 | prepare_submodule_repo_env(&cp.env); |
| 1985 | cp.git_cmd = 1; |
| 1986 | cp.no_stdin = 1; |
| 1987 | cp.no_stderr = 1; |
| 1988 | cp.no_stdout = 1; |
| 1989 | cp.dir = path; |
| 1990 | if (run_command(&cp)) |
| 1991 | return 0; |
| 1992 | |
| 1993 | return 1; |
| 1994 | } |
| 1995 | |
| 1996 | /* |
| 1997 | * Check if it is a bad idea to remove a submodule, i.e. if we'd lose data |
no test coverage detected