From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 3 Apr 2019 10:38:57 +0000 In-Reply-To: <46E7EE42925499BF1B9558D2423340AA@eigenstate.org> References: <46E7EE42925499BF1B9558D2423340AA@eigenstate.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>,ori@eigenstate.org From: Giacomo Message-ID: <8443A864-35C9-4EAF-8DB4-84CAD47E5FC4@tesio.it> Subject: Re: [9fans] Git/fs: Possibly Usable Topicbox-Message-UUID: f8b2e50a-ead9-11e9-9d60-3106f5b1d025 On April 2, 2019 4:41:09 AM UTC, ori@eigenstate=2Eorg wrote: >It was mentioned on this list a short while ago=2E Now, it's >more or less at the point where it works for me=2E Expect >many bugs and problems, and many more missing tools, but >"the rest is just scripting"=2E > >One caveat I have: Git's index file format is a bit >boneheaded, so I'm ignoring it=2E The index doesn't affect >the wire protocol, so this isn't an interoperability issue, >unless you share the same physical repository on both >Plan 9 and Unix=2E If you do, expect them to get out of >sync on uncommitted but added files=2E > >In fact, the entire concept of the staging area has been >removed, as it's both confusing and clunky=2E There are now >only three states that files can be in: 'untracked', >'dirty', and 'committed'=2E Tracking is done with empty >files under =2Egit/index9/{removed,tracked}/path/to/file=2E > >It's implemented in Plan 9 flavor C, and provides tools >for writing repository contents, and a file system for >read-only access, which will mirror the current state of >the repository=2E > >The code is here: https://bitbucket=2Eorg/oridb/git9 > >Install with `mk install`=2E There's no recursive binding >of directories, so you need to union /rc/bin/git and >$objtype/bin/git` by hand=2E > >Documentation has not yet been written=2E You'll need to >read the source=2E > >Some usage examples: > > git/clone git://git=2Eeigenstate=2Eorg/git/ori/mc=2Egit > git/log > cd subdir/name > git/add foo=2Ec > git/commit > git/push > >Scripts will generally mount git/fs as needed to do >their work, but if you want to browse the repository >manually, run it yourself=2E You'll get `/n/git` mounted, >with the following contents: > > /n/git/object: The objects in the repo=2E > /n/git/branch: The branches in the repo=2E > /n/git/ctl: A file showing the status of the repo=2E > Currently, it only shows the current branch=2E > >Commits are presented as directories with the following >contents: > > author: A file containing the author name > hash: A file containing the commit hash > parent: A file containing the commit parents, one per line=2E > msg: A file containing the log message for that commit > tree: A directory containing a view of the repository=2E > >So, for example: > > % ls /n/git/branch/heads/master > /n/git/branch/heads/master/author > /n/git/branch/heads/master/hash > /n/git/branch/heads/master/msg > /n/git/branch/heads/master/parent > /n/git/branch/heads/master/tree > % cat /n/git/branch/heads/master/hash > 7d539a7c08aba3f31b3913e0efef11c43ea9 > > # This is the same commit, with the same contents=2E > % ls /n/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef > /n/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/author > /n/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/hash > /n/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/msg > /n/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/parent > /n/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/tree > > # what git/diff will hopefully do more concisely soon, filtering > # out the non-git files=2E > ape/diff -ur /n/git/branch/heads/master/tree =2E > Only in =2E: =2Egit > Only in =2E: debug > diff -ur /n/git/branch/heads/master/tree/fold=2Emyr =2E/fold=2Emyr > --- /n/git/branch/heads/master/tree/fold=2Emyr Wed Dec 31 16:00:00 1969 > +++ =2E/fold=2Emyr Mon Apr 1 21:39:06 2019 > @@ -6,6 +6,8 @@ > const foldexpr : (e : expr# -> std=2Eoption(constval)) > ;; > =20 > +/* Look, diffing files just works, and I don't need any fancy glue! >*/ > + > const foldexpr =3D {e > match e > | &(`Eident &[=2Esc=3D`Sclassenum, =2Ename=3Dname, =2Ety=3D`Tyenum &(`= Body >enum)]): > Only in =2E: refs > >=09 >The following utilities and binaries are provided: > > fs: The git filesystem=2E > fetch: The protocol bits for getting data from a git server=2E > send: The protocol bits for sending data to a git server=2E > save: The gnarly bits for storing the files for a commit=2E > conf: A program to extract information from a config file=2E > clone: Clones a repository=2E > commit: Commits a snapshot of the working directory=2E > log: Prints the contents of a commmit log=2E > add: Tells the repository to add a file to the next commit=2E > walk: `du`, but for git status=2E > > >Supported protocols: git:// and git+ssh://=2E If someone >implements others, I'll gladly accept patches=2E > >TODOs: > git/mkpatch: Generate a 'git am' compatible patch=2E > git/apply: Apply a diff=2E > git/diff: Wrapper wrapper around git/walk that > diffs the changed files=2E > git/merge: Yup, what it says on the label=2E Should > also be a script around git/fs=2E > git/log: Need to figure out how to make it filter > by files=2E > /n/git/HEAD: add /n/git/head subtree which points > to the current commit=2E >=09 >=2E=2E=2EAnd a whole bunch more=2E Impressive! I didn't imagine one could implement git in so few lines of C! Thanks for = challenging my assumptions! I'd like to port it to Jehanne but I cannot find a license in the reposito= ry, so in theory it's "all rights reserved" under most jurisdictions=2E What's your take on this? Did you intend to put it under public domain instead? Maybe MIT? Or LPL? Giacomo