git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] Extended tree format for mixed submodules and conflicts
@ 2025-10-01  0:58 brian m. carlson
  2025-10-01  0:58 ` [RFC PATCH 1/1] Define an extended tree format brian m. carlson
  0 siblings, 1 reply; 10+ messages in thread
From: brian m. carlson @ 2025-10-01  0:58 UTC (permalink / raw)
  To: git; +Cc: Jeff King

Today at the Contributor Summit we discussed two different proposals
that might benefit from some extensions to trees: submodules of a
different hash algorithm and first-class conflicts.

Peff suggested that we could do something hideous to the tree format to
allow for extensions to submodules of different algorithms.  In the
interests of prototyping things to see how much people like or hate the
idea, I've written up an example spec and included a script below so we
can see how current Git implementations handle this.  (This was part of
my lunchtime activity.)

Git itself handles this data as a submodule, which seems to be the least
bad option for a new mode type.  `git fsck` complains about the mode, as
expected.

I don't intend to actually implement this proposal or do anything
serious with it, but I offer it as a discussion piece about what we
could do if we wanted in a minimally incompatible way.  If you really
hate it, that's okay; I agree it's a little gross.

----
#!/bin/sh -e

# This script requires a printf that supports hex escapes because I'm too lazy
# to convert things into octal.

rm -fr test-repo
git init --object-format=sha1 -b dev test-repo
cd test-repo
tree_oid=$(/usr/bin/printf '130000 \x91\x82\x80s256\x01\xdf\xac\xbf\xee\xdf\xac\xbf\xee\xdf\xac\xbf\xeesubmodule\x00\xde\xad\xbe\xef\xde\xad\xbe\xef\xde\xad\xbe\xef\xde\xad\xbe\xef\xde\xad\xbe\xef' | git hash-object -t tree -w --literally --stdin)
commit_oid=$(git commit-tree -m + "$tree_oid")
git reset --hard "$commit_oid"
git show HEAD
----

brian m. carlson (1):
  Define an extended tree format

 Documentation/Makefile                     |  1 +
 Documentation/gitformat-extended-tree.adoc | 77 ++++++++++++++++++++++
 Documentation/meson.build                  |  1 +
 3 files changed, 79 insertions(+)
 create mode 100644 Documentation/gitformat-extended-tree.adoc


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-10-01 23:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-01  0:58 [RFC PATCH 0/1] Extended tree format for mixed submodules and conflicts brian m. carlson
2025-10-01  0:58 ` [RFC PATCH 1/1] Define an extended tree format brian m. carlson
2025-10-01 16:37   ` Junio C Hamano
2025-10-01 17:41   ` Jeff King
2025-10-01 21:11     ` Jeff King
2025-10-01 21:19       ` Junio C Hamano
2025-10-01 21:45       ` brian m. carlson
2025-10-01 23:00         ` Jeff King
2025-10-01 22:59       ` Jeff King
2025-10-01 21:21   ` Elijah Newren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).