-
Notifications
You must be signed in to change notification settings - Fork 7
/
README
187 lines (144 loc) · 5.67 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
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 feels
distinctly un-plan9ish, and even in its native environment, has been
justifiably tarred and feathered for its user experience.
Git/fs implements a git client for plan 9. The intent is to support
working with git repositories, without cloning the git interface
directly.
Git/fs is my daily driver. It's solid, and works well for my needs.
Getting Started
---------------
Get a bootstrap copy:
% cd /tmp
% hget https://orib.dev/git/git9/HEAD/snap.tar.gz | tar xvz
% cd git9
% mk all
% mk install
Then get an updatable version from git:
% cd $home/src
% git/clone gits://orib.dev/git9
% cd git9
% mk all
% mk install
Configure your user name and email:
% mkdir -p $home/lib/git
% echo '
[user]
name=Ori Bernstein
' > $home/lib/git/config
Read the docs:
% man 1 git
% man 4 gitfs
And start committing!
Structure
---------
The git/fs program provides a file system mounted on $repo/.git/fs.
It provides a read-only view into the repository contents to allow
scripts to inspect the data. Surrounding scripts and binaries will
manipulate the repository contents directly. These changes will be
immediately mirrored in the file system.
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 `$repo/.git/fs` mounted,
with the following contents:
$repo/.git/fs/object: The objects in the repo.
$repo/.git/fs/branch: The branches in the repo.
$repo/.git/fs/ctl: A file showing the status of the repo.
Currently, it only shows the current branch.
$repo/.git/fs/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'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 disagree
about the files that have been modified in the working copy.
In fact, the entire concept of the staging area has been dropped, 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.
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 $repo/.git/fs/HEAD/
git/commit foo.c
git/push
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 $repo/.git/fs/branch/heads/master
$repo/.git/fs/branch/heads/master/author
$repo/.git/fs/branch/heads/master/hash
$repo/.git/fs/branch/heads/master/msg
$repo/.git/fs/branch/heads/master/parent
$repo/.git/fs/branch/heads/master/tree
% cat $repo/.git/fs/branch/heads/master/hash
7d539a7c08aba3f31b3913e0efef11c43ea9
# This is the same commit, with the same contents.
% ls $repo/.git/fs/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef
$repo/.git/fs/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/author
$repo/.git/fs/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/hash
$repo/.git/fs/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/msg
$repo/.git/fs/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/parent
$repo/.git/fs/object/7d539a7c08aba3f31b3913e0efef11c43ea9f9ef/tree
# what git/diff will hopefully do more concisely soon, filtering
# out the non-git files.
ape/diff -ur $repo/.git/fs/branch/heads/master/tree .
Only in .: .git
Only in .: debug
diff -ur $repo/.git/fs/branch/heads/master/tree/fold.myr ./fold.myr
--- $repo/.git/fs/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 selected files.
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.
... and more
Supported protocols: git:// and git+ssh://. If someone
implements others, I'll gladly accept patches.
9legacy Notes
-------------
To use git9 on 9legacy, these patches are necessary.
- rc-line-split: implement delim{...} syntax for rc
- walk: port walk command to 9legacy.
- aux/getflags: 9front updated it with support for named args
Additionally, git9 defaults to editing with hold(1). This command
is not present on 9legacy. Import it, or set $editor to your choice
of editor.