From: Junio C Hamano <gitster@pobox.com>
To: "Raymond E. Pasco" <ray@ameretat.dev>
Cc: git@vger.kernel.org, Johannes Altmanninger <aclopte@gmail.com>
Subject: Re: [PATCH 1/5] apply: error on --intent-to-add outside gitdir
Date: Mon, 30 Jun 2025 11:34:34 -0700 [thread overview]
Message-ID: <xmqqfrfh13k5.fsf@gitster.g> (raw)
In-Reply-To: <20250628225819.1294068-3-ray@ameretat.dev> (Raymond E. Pasco's message of "Sat, 28 Jun 2025 18:52:03 -0400")
"Raymond E. Pasco" <ray@ameretat.dev> 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@gmail.com>
> Signed-off-by: Raymond E. Pasco <ray@ameretat.dev>
> ---
> 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;
next prev parent reply other threads:[~2025-06-30 18:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-28 22:52 [PATCH 0/5] fix apply --intent-to-add Raymond E. Pasco
2025-06-28 22:52 ` [PATCH 1/5] apply: error on --intent-to-add outside gitdir Raymond E. Pasco
2025-06-30 18:34 ` Junio C Hamano [this message]
2025-07-01 5:26 ` Raymond E. Pasco
2025-06-28 22:52 ` [PATCH 2/5] apply: read in the index in --intent-to-add mode Raymond E. Pasco
2025-06-30 18:47 ` Junio C Hamano
2025-07-01 5:32 ` Raymond E. Pasco
2025-06-28 22:52 ` [PATCH 3/5] apply: only write intents to add for new files Raymond E. Pasco
2025-06-30 18:53 ` Junio C Hamano
2025-07-01 5:44 ` Raymond E. Pasco
2025-06-28 22:52 ` [PATCH 4/5] t4140: test apply --intent-to-add interactions Raymond E. Pasco
2025-06-28 22:52 ` [PATCH 5/5] apply docs: clarify wording for --intent-to-add Raymond E. Pasco
2025-06-29 3:10 ` [PATCH 0/5] fix apply --intent-to-add Lidong Yan
2025-06-30 0:56 ` Raymond E. Pasco
2025-07-02 21:26 ` [PATCH v2 0/4] " Raymond E. Pasco
2025-07-02 21:26 ` [PATCH v2 1/4] apply: read in the index in --intent-to-add mode Raymond E. Pasco
2025-07-02 21:26 ` [PATCH v2 2/4] apply: only write intents to add for new files Raymond E. Pasco
2025-07-02 21:26 ` [PATCH v2 3/4] t4140: test apply --intent-to-add interactions Raymond E. Pasco
2025-07-02 21:26 ` [PATCH v2 4/4] apply docs: clarify wording for --intent-to-add Raymond E. Pasco
2025-07-07 12:12 ` [PATCH v3 0/4] fix apply --intent-to-add Raymond E. Pasco
2025-07-07 12:12 ` [PATCH v3 1/4] apply: read in the index in --intent-to-add mode Raymond E. Pasco
2025-07-07 12:12 ` [PATCH v3 2/4] apply: only write intents to add for new files Raymond E. Pasco
2025-07-07 12:12 ` [PATCH v3 3/4] t4140: test apply --intent-to-add interactions Raymond E. Pasco
2025-07-07 12:12 ` [PATCH v3 4/4] apply docs: clarify wording for --intent-to-add Raymond E. Pasco
2025-07-07 17:51 ` [PATCH v3 0/4] fix apply --intent-to-add Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2025-05-03 3:51 [PATCH v3] apply: --intent-to-add should imply --index Raymond E. Pasco
2025-05-11 0:36 ` [PATCH 0/5] apply: fix apply --intent-to-add Raymond E. Pasco
2025-05-11 0:36 ` [PATCH 1/5] apply: error on --intent-to-add outside gitdir Raymond E. Pasco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfrfh13k5.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=aclopte@gmail.com \
--cc=git@vger.kernel.org \
--cc=ray@ameretat.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).