On Fri, Dec 06, 2013 at 03:10:31PM -0800, Junio C Hamano wrote:
> Heiko Voigt <hvo...@hvoigt.net> writes:
> > diff --git a/builtin/add.c b/builtin/add.c
> > index 2d0d2ef..d6cab7f 100644
> > --- a/builtin/add.c
> > +++ b/builtin/add.c
> > @@ -550,6 +569,7 @@ int cmd_add(int argc, const char **argv, const char 
> > *prefix)
> >  
> >             for (i = 0; i < pathspec.nr; i++) {
> >                     const char *path = pathspec.items[i].match;
> > +                   char path_copy[PATH_MAX];
> >                     if (!seen[i] &&
> >                         ((pathspec.items[i].magic &
> >                           (PATHSPEC_GLOB | PATHSPEC_ICASE)) ||
> > @@ -562,6 +582,9 @@ int cmd_add(int argc, const char **argv, const char 
> > *prefix)
> >                                     die(_("pathspec '%s' did not match any 
> > files"),
> >                                         pathspec.items[i].original);
> >                     }
> > +                   normalize_path_copy(path_copy, path);
> > +                   if (is_ignored_submodule(path_copy))
> > +                           string_list_insert(&ignored_submodules, path);
> >             }
> >             free(seen);
> >     }
> > @@ -583,6 +606,8 @@ int cmd_add(int argc, const char **argv, const char 
> > *prefix)
> >     update_files_in_cache(prefix, &pathspec, &update_data);
> >  
> >     exit_status |= !!update_data.add_errors;
> > +   if (!ignored_too && ignored_submodules.nr)
> > +           die_ignored_submodules(&ignored_submodules);
> 
> Why is this done so late in the process?  Shouldn't it be done
> immediately after we have finished iterating over the pathspecs,
> checking with is_ignored_submodule() and stuffing them into
> ignored_submodules string list, not waiting for plugging bulk
> checkin or updating paths already tracked in the index?

There was no specific reason. I just imitated the codepath for new
files (which will die in add_files() if they are ignored). This can be
moved further up. Will do so.

Cheers Heiko
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to