From: Junio C Hamano Date: Thu, 15 Jan 2026 16:30:31 GMT Subject: Re: [PATCH v2] subtree: validate --prefix against commit in split Message-ID: In-Reply-To: <20260115122652.18673-2-pushkarkumarsingh1970@gmail.com> Pushkar Singh 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 > > fails if pkg was removed later, even though it exists in . > > Fix this by validating the prefix against the specified commit using > git ls-tree instead of the working tree. > > Signed-off-by: Pushkar Singh > --- > 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?