Creating and Applying 9front Patches (Git Edition)



To create a patch we first pull 9front’s git repo and bind our files into place:

; sysupdate

; bind -a /dist/plan9front /

We should create our own work branch:

; git/branch -n mywork

We can now make our changes to the system.

If we lose our way, we can see which files have changed:

; git/diff -s
M sys/src/cmd/seq.c

We will commit our changes whilst inside our branch:

# We make changes to seq(1)
; git/commit -m 'seq: some kind of change' /sys/src/cmd/seq.c
heads/mywork: 40d27871e341512ad69a50645e289f6b3856c528

If we need to, we can get a commit hash manually:

; git/log -s | sed 1q | awk '{print $1}'

We export our changes to a diff:

; git/export 40d27871e341512ad69a50645e289f6b3856c528 > $home/mypatch.diff

You can export your changes to the 9front pastebin for ease of linking:

; git/export 40d27871e341512ad69a50645e289f6b3856c528 | webpaste

We can return to the default 9front branch:

; git/branch front


In the same way we pull and bind our files into place:

; sysupdate

; bind -a /dist/plan9front /

For individual files you could use ape/patch if desired, but for most 9front patches you should use git/import:

; git/import < $home/mypatch.diff
applying seq: some kind of change
M sys/src/cmd/seq.c

The patch is now applied!

If you wish to trash the changes from the patch, use:

; git/revert /sys/src/cmd/seq.c

You can delete obsolete branches via:

; git/branch front
; git/branch -d mywork


If a patch is formatted properly and inline from an e-mail, you should be able to import from upasfs as per:

; git/import < /mail/fs/mbox/4321