From: Junio C Hamano <gitster@pobox.com>
To: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cc: git@vger.kernel.org, Colin Stagner <ask+git@howdoi.land>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 1/2] git-subtree: Bail out if we find output from Rust rewrite
Date: Mon, 06 Jul 2026 07:44:10 -0700 [thread overview]
Message-ID: <xmqqy0fob2kl.fsf@gitster.g> (raw)
In-Reply-To: <20260706115816.20267-2-ijackson@chiark.greenend.org.uk> (Ian Jackson's message of "Mon, 6 Jul 2026 12:58:15 +0100")
Ian Jackson <ijackson@chiark.greenend.org.uk> writes:
> +# Usage: reject_if_v2_config REV
> +#
> +# Bails if we find .git-subtree/config. This file is used by the RIIR
> +# git-subtree, which can read data from this script, but which generates
> +# data that this script cannot cope with. So if we find that the user's
> +# project has already been processed with the new tool, we stop, to
> +# avoid generating broken output.
> +reject_if_v2_config () {
> + local config=.git-subtree/config
> + if git rev-parse --verify -q "$rev:$config"; then
> + die "fatal: tree contains $config: has been processed with new standalone (Rust) git-subtree; use that tool instead of this one. See https://codeberg.org/diziet/git-subtree https://crates.io/crates/git-subtree"
> + fi
> +}
[warning: I have no idea what is going on in the code we see here,
as I do not use subtree script at all]
The above helper may work for one caller that passes "$rev" but not
for the other caller that passes "HEAD", no?
if git rev-parse --verify -q "$1:$config"
then
die "fatal: tree contains $config: has been processed with new standalone (Rust) git-subtree; use that tool instead of this one. See https://codeberg.org/diziet/git-subtree https://crates.io/crates/git-subtree"
fi
Overly long output does not look very easy to read, but I kept it
the same as the original.
> @@ -846,6 +860,7 @@ process_split_commit () {
> # Or: cmd_add REPOSITORY REF
> cmd_add () {
>
> + reject_if_v2_config HEAD
> ensure_clean
If (global) $rev is not set here, we'd check :.git-subtree/config in
the index in order to detect the v2's configuration. It seems to me
that this code however wants to inspect HEAD's tree.
> @@ -934,6 +949,8 @@ cmd_split () {
> die "fatal: you must provide exactly one revision, and optionally a repository. Got: '$*'"
> fi
>
> + reject_if_v2_config "$rev"
This would happen to work, as the global "$rev" visible here is the
same one as what the new helper function sees and uses.
> # Now validate prefix against the commit, not the working tree
> if ! git cat-file -e "$rev:$dir" 2>/dev/null
> then
> @@ -1034,6 +1051,7 @@ cmd_merge () {
> then
> repository="$2"
> fi
> + reject_if_v2_config HEAD
> ensure_clean
The same comment as the one for cmd_add's usage.
> if test -n "$arg_addmerge_squash"
next prev parent reply other threads:[~2026-07-06 14:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 11:58 [PATCH 0/2] git-subtree: Bail out if we find output from Rust rewrite Ian Jackson
2026-07-06 11:58 ` [PATCH 1/2] " Ian Jackson
2026-07-06 14:44 ` Junio C Hamano [this message]
2026-07-06 15:03 ` Ian Jackson
2026-07-06 20:16 ` Junio C Hamano
2026-07-06 11:58 ` [PATCH 2/2] git-subtree: Bail out if we find output from Rust rewrite (test) Ian Jackson
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=xmqqy0fob2kl.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=ask+git@howdoi.land \
--cc=git@vger.kernel.org \
--cc=ijackson@chiark.greenend.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox