Re: [PATCH 01/10] add: do not rely on dtype being NULL behavior
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Nov 16, 2010, 02:42 UTC
- Message-ID
- <20101116024252.GA29358@burratino>
- In-Reply-To
- <AANLkTikkArsu=NLJWQcP61uf3yrQmdxRQtB+3AmC9tHQ@mail.gmail.com>
Nguyen Thai Ngoc Duy wrote:
> On Mon, Nov 15, 2010 at 7:14 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 9 quoted lines
>> 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.