has anyone made a read-only FUSE filesystem for a git repository where every commit is a folder and the folder contains all the files in that commit?

the idea is that you could just run `cd COMMIT_ID` and poke around instead of checking out the commit

and maybe the branches could be symbolic links to the commit folders?

guys this is such a fun idea I cannot believe people are in the replies trying to explain to me why they think it is impractical

the whole point of computers is to do impractical things and see what happens

seems like the answer is yes!

- https://github.com/fanzeyi/giblefs (fuse implementation in rust where every commit is a folder)
- https://orib.dev/git9.html (for plan 9)

would love to hear about any others

GitHub - fanzeyi/giblefs: Mapping a Git repository as a virtual filesystem

Mapping a Git repository as a virtual filesystem. Contribute to fanzeyi/giblefs development by creating an account on GitHub.

GitHub

ok I got extremely nerd sniped and made my own version of this “filesystem where every git commit is a folder" thing https://github.com/jvns/git-commit-folders

I wrote a FUSE version and an NFS version that I think will be easier for mac users to use. it definitely does not work on windows.

it probably has about 5 million bugs but it seems to kind of work

GitHub - jvns/git-commit-folders

Contribute to jvns/git-commit-folders development by creating an account on GitHub.

GitHub

the main reason I've found this "all your git commits are folders" feature to be useful is for searching past code: I can run `grep someFunction branch_histories/main/*/commit.go` to find the old version of someFunction I deleted. There are other ways to do that in git but this is easier.

or if I want to just quickly look at a file on another branch to copy a line from it, I can run `vim branches/other-branch/go.mod`

curious about other use cases

(from https://github.com/jvns/git-commit-folders)

GitHub - jvns/git-commit-folders

Contribute to jvns/git-commit-folders development by creating an account on GitHub.

GitHub
ok i made my git commit folders nonsense work with the linux kernel repo (there are some issues but it seems like it can handle 1 million commits without too many problems)
@b0rk Speaking of the kernel, have you ever used or heard about the version(s) of ClearCase that included a kernel driver to implement something a lot like this experiment of yours? I believe it would patch the system calls made by commands like ls and cd to enable file-system traversal to traverse the version control system. Talk about a heavyweight approach!
@siracusa yea people keep mentioning it, i'd never heard about it before

@b0rk I used it many years ago, but I’m pretty sure this is the feature: https://www.ibm.com/docs/en/rational-clearcase/9.0.2?topic=views-multiversion-file-system

At the time, I thought it was neat, and I was curious enough to try to figure out how it worked. But it always seemed like a strange choice as the main/default way to interact with an RCS.

The multiversion file system

@siracusa @b0rk it also enabled a lot of clever intermediate build object sharing (they called them called derived objects). using DOs could _dramatically_ speed up build times on larger projects. i was never clear whether limiting that functionality to mvfs was a technical limitation or a billing one, though.
@dave @siracusa @b0rk The multi-version file system was indeed stupidly slow, but the ability to browse an up-to-date dependency map for every file in your project was So Good.
@siracusa @b0rk we used it at Cisco. Within a month people had written wrapper scripts to make it work like CVS did because the clear case model didn’t map at all to how development had been done historically there.

@siracusa @b0rk I used this starting in 2008 and it was as performant as it sounds 😂

At the time I was overjoyed to eventually switch to the ClearCase “Remote Client" plugin for Eclipse that presumably used some kind of HTTP APIs exposed by ClearCase instead of the ridiculous better-mousetrap kernel driver.

@siracusa @b0rk even heavier when you run find on a Clearcase file system that is hosted on an Oracle database somewhere in a remote data center 🫠👴🏼

@b0rk I wasn't going to mess with this until I had time this weekend, but now I wanna try it.

You've killed my productivity for at least this morning, I hope you're happy!

@b4ux1t3 really curious to know if it works for you!

@b0rk I gotta say, I love the code here.

You're using FUSE the same way I would use, say, meters if I were making a unit conversion app. "I'll just convert everything to meters, and then to the destination unit!" only it's "everything is fuse".

At least, that was my impression from a quick glance through the code. This is a beautiful, horrible hack.

@b4ux1t3 yeah exactly!
@b0rk No luck so far, but the only machine I had Go installed on was a Kali VM. It seems to get stuck for quite a while on git-commit-fold, according to the title of the Konsole window I'm running it in.
@b4ux1t3 what happens if you ls /tmp/tmpmnt in another terminal tab? it's actually supposed to hang like that

@b0rk . . .ohhhhhhh. 😁

It's aliiiiiiive!

@b4ux1t3 amazing!!! i updated the readme to be more clear