"Raymond E. Pasco" <ray@xxxxxxxxxxxx> writes: > It makes no sense to register an intent to add outside a repository. We > should error out here. I am not so sure, especially if you still keep the original "if we are using 'git apply' as a better GNU patch, ignore -N" logic. Not that I am suggesting to also error out when -N is given without --index or --cached, that is. I think the most problematic is the claim "it makes no sense" is not linked to the conclusion "we should error out". The behaviour of the original code, and the behaviour of the code with this patch in "a better GNU patch" mode is based on "it makes no sense in such a context, hence we just ignore (instead of erroring out)", which makes perfect sense as well. > Based-on-patch-by: Johannes Altmanninger <aclopte@xxxxxxxxx> > Signed-off-by: Raymond E. Pasco <ray@xxxxxxxxxxxx> > --- > apply.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/apply.c b/apply.c > index 8bbe6ed224..e7856ae6b3 100644 > --- a/apply.c > +++ b/apply.c > @@ -174,8 +174,12 @@ int check_apply_state(struct apply_state *state, int force_apply) > return error(_("'%s' outside a repository"), "--cached"); > state->check_index = 1; > } > - if (state->ita_only && (state->check_index || is_not_gitdir)) > - state->ita_only = 0; > + if (state->ita_only) { > + if (is_not_gitdir) > + return error(_("'%s' outside a repository"), "--intent-to-add"); > + if (state->check_index) > + state->ita_only = 0; > + } > if (state->check_index) > state->unsafe_paths = 0;