Nguyen Thai Ngoc Duy wrote: > On Mon, Nov 15, 2010 at 7:14 PM, Jonathan Nieder <jrnieder@xxxxxxxxx> wrote: >> Â Â Â ÂSurely what was really wanted is to check paths against the >> Â Â Â Âindex and work tree, defaulting to "regular file". >> >> Wait --- that's not true. ÂIn the "git submodule add" case, we really >> want to default to (or even better, force) "directory". > > Hmm.. get_index_dtype() would return DT_DIR if the submodule exists in > index. If it does not it must be a directory in worktree, right? > Call flow: excluded_from_list() -> get_dtype() -> get_index_dtype() based on git ls-files --error-unmatch "$path" >/dev/null 2>&1 && die "'$path' already exists in the index" if test -z "$force" && ! git add --dry-run --ignore-missing "$path" > /dev/null 2>&1 then echo >&2 "The following path is ignored by one of your .gitignore files:" && echo >&2 $path && echo >&2 "Use -f if you really want to add it." exit 1 fi # perhaps the path exists and is already a git repo, else clone it if test -e "$path" I'd say no, the usual case is that the potential submodule does not exist in the index or worktree, which is why that call site uses --ignore-missing. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html