git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] git-subtree: Bail out if we find output from Rust rewrite

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 6, 2026, 14:44 UTC
Message-ID
<xmqqy0fob2kl.fsf@gitster.g>
In-Reply-To
<20260706115816.20267-2-ijackson@chiark.greenend.org.uk>
Ian Jackson <ijackson@chiark.greenend.org.uk> writes:
Show 13 quoted lines
> +# 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.

Show 6 quoted lines
> @@ -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.

Show 5 quoted lines
> @@ -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.

Show 9 quoted lines
>  	# 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"
Previous: Ian JacksonNext: Ian Jackson
Message 3 of 20 in “git-subtree: Bail out if we find output from Rust rewrite”
  1. 0/2 git-subtree: Bail out if we find output from Rust rewriteIan Jackson, Jul 6, 2026
  2. 1/2 git-subtree: Bail out if we find output from Rust rewriteIan Jackson, Jul 6, 2026
  3. Junio C HamanoJul 6, 2026
  4. Ian JacksonJul 6, 2026
  5. Junio C HamanoJul 6, 2026
  6. Colin StagnerJul 9, 2026
  7. Ian JacksonJul 9, 2026
  8. Phillip WoodJul 9, 2026
  9. Colin StagnerJul 9, 2026
  10. Ian JacksonJul 10, 2026
  11. Colin StagnerJul 15, 2026
  12. D. Ben KnobleJul 11, 2026
  13. Ian JacksonJul 11, 2026
  14. Junio C HamanoJul 11, 2026
  15. Colin StagnerJul 11, 2026
  16. Ian JacksonJul 12, 2026
  17. Junio C HamanoJul 12, 2026
  18. Junio C HamanoAug 26, 2026
  19. 2/2 git-subtree: Bail out if we find output from Rust rewrite (test)Ian Jackson, Jul 6, 2026
  20. Colin StagnerJul 9, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.