Post #1854997
2026-04-30 07:53 UTC
Doing a small prerelease of my tarball validation tool:
https://psi5.com/~geier/tmp/git-treeof-0.0.20260411.tar.gz
The basic idea is that you can feed it a tar file, and it tells you What Would Git Do™, i.e. it is equivalent to
git init
tar -x
git add -A
git commit -m 'irrelevant'
git rev-parse HEAD^{tree}"
but it does not require a local filesystem, git installation or anything -- it's an isolated program that allocates 64 MB of RAM (that should be enough for everyone) and then activates strict SECCOMP mode before looking at any input data.
The main thing I'm unhappy with is the name, in principle it would be easy to extend this to a tar diff tool, and I also want to add some features like "if you supply the commit object via a separate channel, that can be verified too", so it's not strictly "give me the tree ID for this tarball" anymore.
Also, if you have use cases where it doesn't work, I'd like to collect these as well. I already know about submodules, and I also want to have a mode where I also parse gitignore files.
Replies (1)
-
@manx@mastodon.online 2026-04-30 08:08
@GyrosGeier@hachyderm.io Beware of .gitattributes. It can change what git would commit. If you do not honor that, git can get confused. Usually this never happens (as the source comes from git anyway), but if you want to handle potentially malicious sources, this can maybe get important. In particular text and eol attributes can cause git to normalize line endings.