From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Joaquim Rocha via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org, Joaquim Rocha <me@joaquimrocha.com>,
Joaquim Rocha <joaquim@amutable.com>
Subject: Re: [PATCH] apply: strip ./ prefix from --directory argument
Date: Tue, 17 Feb 2026 12:27:39 -0800 [thread overview]
Message-ID: <xmqqzf579kuc.fsf@gitster.g> (raw)
In-Reply-To: <aZQhnIcPa9sCPpBb@pks.im> (Patrick Steinhardt's message of "Tue, 17 Feb 2026 09:06:52 +0100")
Patrick Steinhardt <ps@pks.im> writes:
> While this change here fixes your observed issues, the next person might
> run into a totally different one. So more generally, I think what we'd
> rather want to do is to fully normalize the path. How about this
> instead:
Sorry, but I am confused. Why isn't "don't do it then" a good
answer for a case like this?
>
> diff --git a/apply.c b/apply.c
> index 9de2eb953e..8946b133a3 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -5002,6 +5002,7 @@ static int apply_option_parse_directory(const struct option *opt,
>
> strbuf_reset(&state->root);
> strbuf_addstr(&state->root, arg);
> + strbuf_normalize_path(&state->root);
> strbuf_complete(&state->root, '/');
> return 0;
> }
>
> `strbuf_normalize_path()` drops "." components, removes ".." and it
> squashes multiple directory separators. So it handles your specific use
> case, but also others.
>
> Thanks!
>
> Patrick
next prev parent reply other threads:[~2026-02-17 20:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 17:08 [PATCH] apply: strip ./ prefix from --directory argument Joaquim Rocha via GitGitGadget
2026-02-17 8:06 ` Patrick Steinhardt
2026-02-17 20:27 ` Junio C Hamano [this message]
2026-02-18 14:14 ` Patrick Steinhardt
2026-02-18 14:40 ` Joaquim Rocha
2026-02-18 0:15 ` [PATCH v2] apply: normalize path in " Joaquim Rocha via GitGitGadget
2026-02-20 20:26 ` Junio C Hamano
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=xmqqzf579kuc.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=joaquim@amutable.com \
--cc=me@joaquimrocha.com \
--cc=ps@pks.im \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.