All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] subtree: validate --prefix against commit in split
Date: Thu, 15 Jan 2026 08:30:31 -0800	[thread overview]
Message-ID: <xmqqh5smdejc.fsf@gitster.g> (raw)
In-Reply-To: <20260115122652.18673-2-pushkarkumarsingh1970@gmail.com> (Pushkar Singh's message of "Thu, 15 Jan 2026 12:24:35 +0000")

Pushkar Singh <pushkarkumarsingh1970@gmail.com> writes:

> git subtree split currently validates --prefix against the working tree.
> This breaks when splitting an older commit or when the working tree does
> not contain the subtree, even though the commit does.
>
> For example:
>
>   git subtree split --prefix=pkg <commit>
>
> fails if pkg was removed later, even though it exists in <commit>.
>
> Fix this by validating the prefix against the specified commit using
> git ls-tree instead of the working tree.
>
> Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
> ---
>  contrib/subtree/git-subtree.sh | 9 +++++++++
>  1 file changed, 9 insertions(+)

Is this something you can protect from future breakage with a test,
perhaps in contrib/subtree/t/t7900-subtree.sh?

> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index 17106d1a72..a5822b66d5 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -257,6 +257,9 @@ main () {
>  		test -e "$arg_prefix" &&
>  			die "fatal: prefix '$arg_prefix' already exists."
>  		;;
> +	split)
> +        # checked later against the commit, not the working tree
> +        ;;

Funny indentation?

  reply	other threads:[~2026-01-15 16:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 12:09 [PATCH] subtree: validate --prefix against commit in split Pushkar Singh
2026-01-15 12:24 ` [PATCH v2] " Pushkar Singh
2026-01-15 16:30   ` Junio C Hamano [this message]
2026-01-15 17:52     ` [PATCH v3] " Pushkar Singh
2026-02-02 18:54       ` Josh Steadmon
2026-02-02 19:10         ` Junio C Hamano
2026-02-02 21:07         ` Junio C Hamano
2026-02-03 15:30           ` [RFH] adding test coverage for contrib/ in CI jobs Junio C Hamano
2026-02-03 17:06             ` Re* " Junio C Hamano
2026-02-03 23:09               ` Junio C Hamano
2026-02-04  4:38               ` Colin Stagner
2026-02-04 19:55                 ` Junio C Hamano
2026-02-05  6:05               ` Colin Stagner
2026-02-05 16:39                 ` Junio C Hamano
2026-02-05 20:54                   ` Junio C Hamano
2026-02-03 21:26             ` Junio C Hamano
2026-02-03 21:53               ` Jeff King
2026-02-03 16:48       ` [PATCH v4] subtree: validate --prefix against commit in split Pushkar Singh
2026-02-03 17:37         ` 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=xmqqh5smdejc.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pushkarkumarsingh1970@gmail.com \
    /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.