On Thu, 18 May 2006, Linus Torvalds wrote: > > But if people are ok with changing it from a "print a warning and ignore" > into an _error_, we could just move it into "add_cache_entry()". This is the incremental patch to do that instead, if you prefer it. Putting it into add_cache_entry() definitely has advantages, in that it should make it much harder for this bug to happen again - all users will now be verified. With this one, it's now a fatal error to try to add a pathname that cannot be added, ie [torvalds@g5 git]$ git add .git/config fatal: unable to add .git/config to index and [torvalds@g5 git]$ git add foo/../bar fatal: unable to add foo/../bar to index instead of the old "Ignoring path xyz" warning that would end up silently succeeding on any other paths. Linus --- diff --git a/builtin-add.c b/builtin-add.c index 0346bb5..ac9ed2d 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -172,11 +172,6 @@ static int add_file_to_index(const char if (lstat(path, &st)) die("%s: unable to stat (%s)", path, strerror(errno)); - if (!verify_path(path)) { - fprintf(stderr, "Ignoring path %s\n", path); - return -1; - } - if (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) die("%s: can only add regular files or symbolic links", path); diff --git a/read-cache.c b/read-cache.c index 6b323dd..9a272f8 100644 --- a/read-cache.c +++ b/read-cache.c @@ -551,6 +551,8 @@ int add_cache_entry(struct cache_entry * if (!ok_to_add) return -1; + if (!verify_path(ce->name)) + return -1; if (!skip_df_check && check_file_directory_conflict(ce, pos, ok_to_replace)) { - : 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