Re: [PATCH 1/2] git-subtree: Bail out if we find output from Rust rewrite [and 1 more messages]
- From
- Colin Stagner <ask+git@howdoi.land>
- Date
- Jul 9, 2026, 22:43 UTC
- Message-ID
- <c8b81987-ab56-4d6b-a650-879b84597a17@howdoi.land>
- In-Reply-To
- <27215.27575.968985.583226@chiark.greenend.org.uk>
On 7/9/26 04:36, Ian Jackson wrote:
Show 8 quoted lines
> Colin Stagner writes ("Re: [PATCH 1/2] git-subtree: Bail out if we find output from Rust rewrite"):
>
>> I think that subtree merge should only test the top-level project, as
>> this patch does now.
>
> By "top-level" I think you mean what I've taken to calling the
> "downstream": the project where the subtree is in a subdir, and whose
> top-level has other stuff. In which case I agree.Yes, I think we're talking about the same thing.
In retrospect, "top-level" is ambiguous. "Upstream" and "downstream" may be as well. Within git-branch(1), the phrase "upstream" refers to the remote tracking branch set by
git branch --set-upstream-to=<upstream>
git-merge(1) is consistent with this.
"If no commit is given from the command line, merge the
remote-tracking branches that the current branch is
configured to use as its upstream."git-subtree.sh doesn't really deal in "upstreams" in the git-branch or git-merge sense.
Less ambiguous language is available:
For merge commits, there is the "first parent" and "second parent" (or 3rd or higher parents).
For trees, there is the "root tree" and "sub-trees," like `git ls-tree -r`
-r Recurse into sub-trees.
Both of these deliberately ignore the dependency relationship between the various projects and branches in question, which can potentially get messy.
Show 9 quoted lines
>>> + if git rev-parse --verify -q "$rev:$config"; then >> >> For subtree split, should we also test for this file in tree you are >> splitting: i.e., "$dir/$config"? The answer might be no. > > You're right that we should consider this question. The answer is: > no, we should not. Briefly, whether to use the new or old algorithms > depends on whether the downstream has adopted the new git-subtree, not > on whether the upstream has added some optional config.
Very well-reasoned; I like it.
Let me ask this question in a slightly different way: does RIIR subtree honor config files in locations other than the one you test for above? That's
${rev}:.git-subtree/configwhich is `.git-subtree/config` within the root tree of the rev that is being manipulated?
If this is the only config file RIIR subtree honors, the patch is probably correct. If RIIR subtree honors config from other places, such as
* the working tree * HEAD:.git-subtree/config * HEAD:./.git-subtree/config
then consider testing for those if appropriate.
Show 7 quoted lines
>> Subtree merges can be performed without git-subtree, via the `-X >> subtree` merge strategy option. > > This is what I'm calling an "unmarked subtree merge". My rewrite is > not going to support this user behaviour. The problem is that it is > not possible to reliably determine whetheer something is an unmarked > subtree merge.
Thanks for looking at this.
> Combining manual -X subtree merges with git-subtree --squash merges > could easily produce quite weird and wrong results in the tree
I haven't tried it, but I think if --squash is in use, then attempting an unmarked subtree merge will probably die with "unrelated history" warnings.
Looking forward to v2,
Colin