b0rk, (edited )
@b0rk@jvns.ca avatar

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?

b0rk,
@b0rk@jvns.ca avatar

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

est,
@est@emily.news avatar

@b0rk people are so joyless on this internet

thomasfuchs,
@thomasfuchs@hachyderm.io avatar

@est @b0rk you should see them IRL

cmdrmoto,
@cmdrmoto@hachyderm.io avatar

@b0rk Why not write a shell function which overrides cd() and does a quick ‘git stash -m “cdtemp” && git checkout’ when the destination appears to be a commit hash? You could even autocomplete commit hashes into your cd commands …

Sure, you could wrap all that up into a read-only FUSE module, but the shell script is how this old sysadmin thinks about things.

edyoung,
@edyoung@mastodon.online avatar

@b0rk Be nice if we could treat social media more like improv, where "Yes, and..." is the golden rule.

I have never used it but I think ClearCase works a bit like your description, so it's a sufficiently cromulent idea to have a $$$$ product based on it...

wordshaper,
@wordshaper@weatherishappening.network avatar

@b0rk seems neat, tbh, and I’d love to see it. (And if someone’s going to do that, a fuse file system where the root directory is the commit id and the entire repository existed underneath it to allow easy shell tool twiddling between different commit states would be neat too)

loke,
@loke@functional.cafe avatar

@b0rk Why would anyone say that? I need this feature right now.

In fact, isn't this kind of how Clearcase worked?

rogersm,
@rogersm@mastodon.social avatar

@loke @b0rk probably they say that because they don’t want to change.

But having a file system with version control is the best solution: not only ensures full integration with the operating system and the applications, but the interface is already known by the users.

loke,
@loke@functional.cafe avatar

@rogersm @b0rk everything old is new again. Versioned filesystems was a thing back in the good old days, but then Unix needed to fit in 40k RAM and everyone decided that that was what everything should emulate.

rogersm,
@rogersm@mastodon.social avatar

@loke @b0rk he he… you’re right, but I was thinking in something more powerful than VMS versioning.

But didn’t MS release a VFS for git?

loke,
@loke@functional.cafe avatar

@rogersm @b0rk Clearcase tried to do it. Their implementation was broken but it was based on decent ideas, I believe?

b0rk,
@b0rk@jvns.ca avatar

seems like the answer is yes!

would love to hear about any others

b0rk,
@b0rk@jvns.ca avatar

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

icanzilb,
@icanzilb@mastodon.social avatar

@b0rk best & most honest readme ever 💯

raineer,

@b0rk didn’t you nerd-snipe yourself here? Those are rare!

whitequark,
@whitequark@mastodon.social avatar

@b0rk this seems entirely practical to me!

recursive,
@recursive@hachyderm.io avatar

@b0rk and yet we relied on a homegrown (not open sourced) version of this written in python at my old job as part of the build process

c0dec0dec0de,
@c0dec0dec0de@hachyderm.io avatar

@recursive @b0rk it sounds like the kind of thing my employer would do — if they were compelled to care.

inthehands,
@inthehands@hachyderm.io avatar

@b0rk
A FUSE filesystem where every folder is a playful idea and its contents are all of the joyless rebuttal replies

jes5199,

@b0rk it reminds me of back when the vision for GNU HURD was: no really everything is a file, unix philosophy to its most extreme

oblomov,
@oblomov@sociale.network avatar

@jes5199 @b0rk wasn't that Plan 9?

RandomDamage,

@b0rk People said PSDoom was impractical and madness as well, but it was so fun

dolmen,
@dolmen@mamot.fr avatar

@b0rk I'm now thinking about writing in Go a FUSE fs that exposes any io/fs.FS.
I recently wrote an io/fs.FS that exposes an SQLite Archive.
https://github.com/dolmen-go/sqlar

b0rk,
@b0rk@jvns.ca avatar

@dolmen do itttt i’d love to see how it turns out

andrew,
@andrew@ottawa.place avatar

@b0rk I want to take the last sentence there and get it printed out and framed 😂 💯

pdebruin,
@pdebruin@hachyderm.io avatar

@andrew @b0rk 🙂

PuercoPop,

@b0rk Not exactly the same but there is Git9 which is an interface to a Git repository as a file system. It only works on 9front afaict https://orib.dev/git9.html

b0rk,
@b0rk@jvns.ca avatar

@PuercoPop oooooh thanks this is great and I know kinda the person who made it it turns out!

RichiH,
@RichiH@chaos.social avatar

@b0rk FWIW, I have had gcd (Git cd) as an alias for git checkout for ages, and I teach new people to think about branches and commits as directories which just happen to be in the same place. It works quite well.

joeyh,
@joeyh@hachyderm.io avatar

@b0rk contrary to replies this can be implemented performantly. No checkout, just git cat-file --batch objects on demand.

That runs at near filesystem speed.

diazona,
@diazona@techhub.social avatar

@b0rk bup (https://bup.github.io/) has something kind of like this. It's not Git, but it is a versioned backup system that uses Git's object storage model, where individual backups are kind of akin to commits. There is a bup fuse command that mounts a filesystem with a view of the backup directory, and all the backups are represented as folders. So I wouldn't be surprised if the implementation of bup fuse could be modified slightly to do the same thing for Git.

noamross,
@noamross@ecoevo.social avatar
ljrk,
@ljrk@todon.eu avatar

@b0rk This is not the same but you can do git show HASH:path/to/file

jernej__s,

@b0rk I remember reading that Microsoft has something like that, but only internally.

jan,
@jan@toot.io avatar

@b0rk Yes I pushed this idea further inspired by Plan9 with my webfilesystem where you can script any mapping logic in JS.

https://github.com/autovia/wfs

pixel,
@pixel@social.pixels.pizza avatar
pacanukeha,

@b0rk What benefit does making the FS read-only bring?

b0rk,
@b0rk@jvns.ca avatar

@pacanukeha basically it has to be read only because commits are read only (you can't edit a commit)

pacanukeha,

@b0rk well sure, but the FS isn't used for making commits (because it's read-only) just for displaying them. I suppose if you want to reassure yourself that you haven't accidentally made any changes .

b0rk,
@b0rk@jvns.ca avatar

@pacanukeha i just don't know where you would put the data if you made any writes, like you'd need to store it somewhere

wez,
@wez@fosstodon.org avatar

@b0rk the EdenFS portion of Sapling (https://github.com/facebook/sapling/) has the guts of this inside. Even though that project was built primarily for Sapling (an evolution of Mercurial), it can also mount Git repos. We talked about exposing literally the interface your described for some internal infrastructure in the early days. I'm no longer part of that team so I'm not sure if that ever got implemented, but it wouldn't be difficult if someone was motivated!

ramsey,
@ramsey@phpc.social avatar

@wez @b0rk Doesn’t SVN kind of work like this?

b0rk,
@b0rk@jvns.ca avatar

@wez ooh cool thank you!

fanzeyi,

@b0rk @wez

(former member on the team built EdenFS).

I actually wrote the exact thing you described as a practice to familiarize myself with FUSE API:

https://github.com/fanzeyi/giblefs

b0rk,
@b0rk@jvns.ca avatar

@fanzeyi @wez amazing

wez,
@wez@fosstodon.org avatar

@b0rk while I'm remembering stuff, there was also a precursor internal project called gvfs (git view filesystem) that also had this interface. Reading the root directory showed no entries (because there were too many commits and ls needs to stat everything by default -> too costly), but you could cd/ls into a commit hash and see the tree at that commit. That was used to serve up commits for some internal build infrastructure.

b0rk,
@b0rk@jvns.ca avatar

@wez thanks! i guess that wasn't open sourced?

abc3354,

@b0rk

Not really the same but somewhat linked

Intellij idea has a feature to display and open the project files at any commit without checkout

b0rk,
@b0rk@jvns.ca avatar

@abc3354 that's awesome

onelson,
@onelson@mastodon.social avatar

@b0rk not this exactly, but I did have ambitions to build a fuse fs that let you walk through a Titan GraphDB's nodes with the shell of your choosing.

rgm,
@rgm@cosocial.ca avatar

@b0rk damn I thought I had a link for you but it turned out to be just another bit of FUSE plus git musing

konnorrogers,
@konnorrogers@ruby.social avatar

@b0rk wait....isn't this just git worktrees?

b0rk,
@b0rk@jvns.ca avatar

@konnorrogers the difference is that git worktrees make you materialize the files on disk (they take up disk space) and this thing would use 0 disk space but would have a folder for every single git commit you've ever made

not2b,
@not2b@sfba.social avatar

@b0rk That sounds a bit like ClearCase, a proprietary revision control system that worked roughly that way. It was really sluggish and resource intensive.

c0dec0dec0de,
@c0dec0dec0de@hachyderm.io avatar

@not2b @b0rk I have only bad experience with ClearCase, but one of my coworkers insists that somewhere in its massive configuration space is a good, working system - we just live somewhere else at <EMPLOYER>.
File-based changes and the ability to specify which revision/branch you want on a per-file basis is a lot of power, but it can make things complicated.

cratermoon,
@cratermoon@zirk.us avatar

@b0rk Have you looked at the old https://github.com/presslabs/gitfs project? I'm not sure it quite does what you want, but a start maybe?

b0rk,
@b0rk@jvns.ca avatar

@cratermoon yea i also googled and found that but it seems to have pretty different goals

nyquildotorg,
@nyquildotorg@fedia.social avatar

@b0rk this is a neat idea

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • ethstaker
  • DreamBathrooms
  • cubers
  • osvaldo12
  • mdbf
  • magazineikmin
  • normalnudes
  • InstantRegret
  • rosin
  • Youngstown
  • slotface
  • khanakhh
  • kavyap
  • ngwrru68w68
  • JUstTest
  • everett
  • cisconetworking
  • tacticalgear
  • anitta
  • thenastyranch
  • Durango
  • tester
  • GTA5RPClips
  • modclub
  • megavids
  • provamag3
  • Leos
  • lostlight
  • All magazines