Re: [PATCH v2] subtree: validate --prefix against commit in split
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 15, 2026, 16:30 UTC
- Message-ID
- <xmqqh5smdejc.fsf@gitster.g>
- In-Reply-To
- <20260115122652.18673-2-pushkarkumarsingh1970@gmail.com>
Pushkar Singh <pushkarkumarsingh1970@gmail.com> writes:
Show 17 quoted lines
> 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?
Show 11 quoted lines
> 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?