Re: Re: [RFC/WIP PATCH 3/4] teach add -f option for ignored submodules
- From
Heiko Voigt <hvoigt@hvoigt.net>
- Date
- Dec 9, 2013, 21:51 UTC
- Message-ID
- <20131209215102.GE9606@sandbox-ub>
- In-Reply-To
- <xmqqob4t1spk.fsf@gitster.dls.corp.google.com>
On Fri, Dec 06, 2013 at 03:10:31PM -0800, Junio C Hamano wrote:
Show 35 quoted lines
> Heiko Voigt <hvoigt@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