9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9fans@9fans.net
Subject: [9fans] Git/fs: Possibly Usable
Date: Mon,  1 Apr 2019 21:41:09 -0700	[thread overview]
Message-ID: <46E7EE42925499BF1B9558D2423340AA@eigenstate.org> (raw)

It was mentioned on this list a short while ago. Now, it's
more or less at the point where it works for me. Expect
many bugs and problems, and many more missing tools, but
"the rest is just scripting".

One caveat I have: Git's index file format is a bit
boneheaded, so I'm ignoring it. 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. If you do, expect them to get out of
sync on uncommitted but added files.

In fact, the entire concept of the staging area has been
removed, as it's both confusing and clunky. There are now
only three states that files can be in: 'untracked',
'dirty', and 'committed'. Tracking is done with empty
files under .git/index9/{removed,tracked}/path/to/file.

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.

The code is here: https://bitbucket.org/oridb/git9

Install with `mk install`. There's no recursive binding
of directories, so you need to union /rc/bin/git and
$objtype/bin/git` by hand.

Documentation has not yet been written. You'll need to
read the source.

Some usage examples:

	git/clone git://git.eigenstate.org/git/ori/mc.git
	git/log
	cd subdir/name
	git/add foo.c
	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. You'll get `/n/git` mounted,
with the following contents:

	/n/git/object:	The objects in the repo.
	/n/git/branch:	The branches in the repo.
	/n/git/ctl:		A file showing the status of the repo.
					Currently, it only shows the current branch.

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.
	msg:	A file containing the log message for that commit
	tree:	A directory containing a view of the repository.

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.
	% 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.
	ape/diff -ur /n/git/branch/heads/master/tree .
	Only in .: .git
	Only in .: debug
	diff -ur /n/git/branch/heads/master/tree/fold.myr ./fold.myr
	--- /n/git/branch/heads/master/tree/fold.myr	Wed Dec 31 16:00:00 1969
	+++ ./fold.myr	Mon Apr  1 21:39:06 2019
	@@ -6,6 +6,8 @@
	 	const foldexpr : (e : expr# -> std.option(constval))
	 ;;

	+/* Look, diffing files just works, and I don't need any fancy glue! */
	+
	 const foldexpr = {e
	 	match e
	 	| &(`Eident &[.sc=`Sclassenum, .name=name, .ty=`Tyenum &(`Body enum)]):
	Only in .: refs


The following utilities and binaries are provided:

	fs:	The git filesystem.
	fetch:	The protocol bits for getting data from a git server.
	send:	The protocol bits for sending data to a git server.
	save:	The gnarly bits for storing the files for a commit.
	conf:	A program to extract information from a config file.
	clone:	Clones a repository.
	commit:	Commits a snapshot of the working directory.
	log:	Prints the contents of a commmit log.
	add:	Tells the repository to add a file to the next commit.
	walk:	`du`, but for git status.


Supported protocols: git:// and git+ssh://. If someone
implements others, I'll gladly accept patches.

TODOs:
	git/mkpatch:	Generate a 'git am' compatible patch.
	git/apply:	Apply a diff.
	git/diff:	Wrapper wrapper around git/walk that
			diffs the changed files.
	git/merge:	Yup, what it says on the label. Should
			also be a script around git/fs.
	git/log:	Need to figure out how to make it filter
			by files.
	/n/git/HEAD:	add /n/git/head subtree which points
			to the current commit.

...And a whole bunch more.




             reply	other threads:[~2019-04-02  4:41 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-02  4:41 ori [this message]
2019-04-02  6:10 ` Skip Tavakkolian
2019-04-02 13:32 ` Dave MacFarlane
2019-04-02 14:37 ` Kyohei Kadota
2019-04-03 10:38 ` Giacomo
2019-04-03 18:29 ` Skip Tavakkolian
2019-04-03 20:14   ` David du Colombier
2019-04-03 20:23   ` Ori Bernstein
2019-04-04  0:00     ` Skip Tavakkolian
2019-04-04  0:34       ` Kurt H Maier
2019-04-04  1:22     ` Ori Bernstein
2019-04-14  9:58       ` [9fans] UI design | enhancements Darren Wise
2019-04-14 11:30         ` Ethan Gardener
2019-04-14 14:19         ` hiro
2019-04-15  5:07         ` Lucio De Re
2019-04-15  6:12           ` Bakul Shah
2019-04-15  6:25             ` Devine Lu Linvega
2019-04-15  6:41               ` Michael Misch
2019-04-15  7:24                 ` Bakul Shah
2019-04-15 11:20                   ` hiro
2019-04-15 14:27                   ` Kurt H Maier
2019-04-15 19:59                 ` Ethan Gardener
2019-04-15 20:04                   ` Michael Misch
2019-04-15 15:10         ` Chris McGee
2019-04-15 15:44           ` Darren Wise
2019-04-15 18:11         ` ab
2019-07-08 19:54 ` [9fans] Git/fs: Possibly Usable Ori Bernstein
2019-07-12 18:27   ` Patrick Marchand
2019-07-12 20:21     ` Steve Simon
2019-07-21 21:06       ` clueelf
2019-07-25 21:59         ` Ori Bernstein
2019-08-05 18:43           ` Skip Tavakkolian
2019-08-05 21:17             ` erik quanstrom
2019-08-05 21:22               ` erik quanstrom
2019-08-09  5:56             ` Ori Bernstein
2019-04-02  5:36 cinap_lenrek
2019-04-02 15:35 ori
2019-04-03 16:02 ori
2019-04-03 16:59 ` Giacomo
2019-04-03 18:41   ` Cull
2019-04-03 18:44   ` Ori Bernstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46E7EE42925499BF1B9558D2423340AA@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).