$ echo "hello world" > HELLO.txt
$ git add HELLO.txt
$ cat .git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad | \
> zpipe -d | \
> hexdump -e '"|"24/1 "%_p" "|\n"'
|blob 12.hello world.|
$
The header and the content get concatenated together, and the whole thing gets Zlib compressed. The SHA1 is calculated from the header-plus-content before it gets Zlib compressed. $ cat .git/objects/3b/18e512dba79e4c8300dd08aeb37f8e728b8dad | \
> zpipe -d | \
> shasum
3b18e512dba79e4c8300dd08aeb37f8e728b8dad -
$
What I would like to do is record an audio file (e.g. LPCM BWF), take its SHA1 and store it in the CAS as raw content, then reference it somehow from a Git commit. That way it will be part of the history and will travel with `push` and `clone`, won't get gc'd, etc.> That said, even if it is compressed, a command like git cat-file could be used to pipe the contents of the file to stdout or any other program that could use them as input without having to create a file on disk.
That's a neat suggestion! However, I don't see how it would be compatible with random access, which is important for my application.
Maybe to achieve what I've laid out, I really would need to write a Git extension a la Git-LFS. But then vanilla Git wouldn't be able to make full use of it, which undermines the purpose of using Git in the first place.
As an alternative, maybe I just commit the darn audio files to the repo.
• In relative terms, audio files grow smaller ever year.
• Large repository size isn't as critical for a music composition tool as it is for perpetually maintained software source code.
• I'm imagining a tool to prune edit history which would consolidate commits and potentially garbage collect audio files that become unreferenced.
I wish there was a way in vanilla Git to just associate a CAS object containing arbitrary bytes with a commit object, though.
It's the same magic you want to do; Really and truly, there's magic there, but it's a pretty thin and well defined layer of magic.
https://github.com/git/git/blob/master/builtin/cat-file.c
you can absolutely make tools to expand out & load git repos into content stores. it's going to depend on the content store how you do that.
That said, even if it is compressed, a command like git cat-file could be used to pipe the contents of the file to stdout or any other program that could use them as input without having to create a file on disk.