Ori BernsteinUpdate README9cffb377 years agoHistory
149 lines · 4.9 KB · Text
RawDownload
Git for Plan 9: git/fs====================== All commits in this repository were made with git9 running on 9front. About----- Plan 9 is a non-posix system. Upstream git has been ported, but feelsdistinctly un-plan9ish, and even in its native environment, has beenjustifiably tarred and feathered for its user experience. Git/fs implements a git client for plan 9.  The intent is to supportworking with git repositories, without cloning the git interfacedirectly. Git/fs is usable, but not battle tested. It works for me, and coversthe features I need on a daily basis. Structure--------- The git/fs program provides a file system mounted on /mnt/git.  Itprovides a read-only view into the repository contents to allowscripts to inspect the data.  Surrounding scripts and binaries willmanipulate the repository contents directly.  These changes will beimmediately mirrored in the file system. Scripts will generally mount git/fs as needed to dotheir work, but if you want to browse the repositorymanually, run it yourself. You'll get `/mnt/git` mounted,with the following contents: 	/mnt/git/object:	The objects in the repo.	/mnt/git/branch:	The branches in the repo.	/mnt/git/ctl:		A file showing the status of the repo.				Currently, it only shows the current branch.	/mnt/git/HEAD		An alias for the currently checked out				commit directory. Visible Differences------------------- The most obvious difference is that Git's index is a bit boneheaded, so I'mignoring it.  The index doesn't affect the wire protocol, so thisisn't an interoperability issue, unless you share the same physicalrepository on both Plan 9 and Unix.  If you do, expect them to disagreeabout the files that have been modified in the working copy. In fact, the entire concept of the staging area has been dropped, asit's both confusing and clunky.  There are now only three states thatfiles can be in: 'untracked', 'dirty', and 'committed'.  Tracking isdone with empty files under .git/index9/{removed,tracked}/path/to/file. It's implemented in Plan 9 flavor C, and provides tools for writingrepository contents, and a file system for read-only access, whichwill mirror the current state of the repository. Installation------------ Install with `mk install`. Examples-------- Some usage examples: 	git/clone git://git.eigenstate.org/ori/mc.git	git/log	cd subdir/name	git/add foo.c	diff bar.c /mnt/git/HEAD/	git/commit	git/push Commits are presented as directories with the followingcontents: 	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 /mnt/git/branch/heads/master	/mnt/git/branch/heads/master/author	/mnt/git/branch/heads/master/hash	/mnt/git/branch/heads/master/msg	/mnt/git/branch/heads/master/parent	/mnt/git/branch/heads/master/tree	% cat /mnt/git/branch/heads/master/hash	7d539a7c08aba3f31b3913e0efef11c43ea9 	# This is the same commit, with the same contents.	% ls /mnt/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef	/mnt/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/author	/mnt/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/hash	/mnt/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/msg	/mnt/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/parent	/mnt/git/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/tree 	# what git/diff will hopefully do more concisely soon, filtering	# out the non-git files.	ape/diff -ur /mnt/git/branch/heads/master/tree .	Only in .: .git	Only in .: debug	diff -ur /mnt/git/branch/heads/master/tree/fold.myr ./fold.myr	--- /mnt/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 someoneimplements others, I'll gladly accept patches. TODOs----- Documentation has not yet been written.  You'll need to read thesource. Notably missing functionality includes: 	git/patch -c:	Generate a 'git am' compatible patch.	git/patch -a:	Apply a diff.