Yarl <[email protected]> writes:
> Hello,
>
> I wonder what is the workflow of people contributing on guix as I would
> like to improve mine. What is yours?
I have a master checkout at ~/src/guix and multiple git work trees under
~/src/guix-wt. Currently three, patch-1 up to patch-3. The important
thing in my workflow is that those (patch-X) work trees do not
correspond to any specific "feature" or patch I am working on. The
patch-{1..3} branch do not have any extra commits compared to
upstream/master. They are just there to provide stable tree I can work
on with minimal changes.
Typically patch-1 is all I use (make a new branch from patch-1,
write&test&send patch, checkout the patch-1 again), the -2 and -3 are
for branches that take a long time.
Every week or two I rebase my tree on the upstream Guix, hard reset the
patch-1, patch-2 and patch-3 branches to upstream/master, `git clean
-xffd' and rebuild all the work trees. This does take a while, but I
just run it over a lunch or something, so ¯\_(ツ)_/¯.
To be specific, examples of my local branches are below. Each
corresponds to a single patch sent.
--8<---------------cut here---------------start------------->8---
bug/79482/add-rxvt-unicode-terminfo gnu: Add rxvt-unicode-terminfo.
bug/79566/channel-is-scheme .guix-channel: Set major mode.
bug/80260/apcupsd-gexp services: apcupsd-event-handlers: Fix
G-expressions.
bug/80299/perl-finance-quote gnu: perl-finance-quote: Update to 1.68.
bug/80300/guile-irregex gnu: guile-irregex: Update to 0.9.12.
bug/80301/conmon gnu: conmon: Update to 2.2.1.
bug/80302/buildah gnu: buildah: Update to 1.43.0.
bug/80304/cni-plugins gnu: cni-plugins: Update to 1.9.0.
bug/80305/crun gnu: crun: Update to 1.26.
--8<---------------cut here---------------end--------------->8---
These all are just one extra commit on top of the patch-1 (which
remember, is just an alias for upstream/master, the Guix proper):
--8<---------------cut here---------------start------------->8---
bug/79482/add-rxvt-unicode-terminfo gnu: Add rxvt-unicode-terminfo.
+ a67c373a7b gnu: Add rxvt-unicode-terminfo.
bug/79566/channel-is-scheme .guix-channel: Set major mode.
+ 29e4b3d06f .guix-channel: Set major mode.
--8<---------------cut here---------------end--------------->8---
I can switch between them freely, because the checkout usually
invalidates just a single file, so the `make' is quick (and often I just
do not even bother).
One important thing is that when you want to rebase some older branch on
top of current patch-1, you cannot checkout it. That would mess up the
timestamps. So I have the following Emacs command to do the rebase for
me in a temporary directory. You should checkout it only after the
rebase.
--8<---------------cut here---------------start------------->8---
(defun my/magit-rebase-branch-at-point-onto-upstream-master ()
"Rebase branch at point using a separate worktree in /tmp/."
(interactive)
(let ((branch (magit-branch-at-point))
(wt-dir "/tmp/magit-rebase-wt"))
(magit-run-git "worktree" "add" wt-dir branch)
(let ((default-directory wt-dir))
(unless (= 0 (call-process "git" nil nil nil "rebase" "upstream/master"))
(error "Failed to rebase."))
(shell-command "git worktree remove ."))
(message "Branch rebased onto upstream/master.")))
--8<---------------cut here---------------end--------------->8---
So, this is what works for me. I can quickly work on multiple patches,
without having to recompile Guix for each one or doing some weird
tricks. The key is to think about the git work trees as a permanent
work place, not an ephemeral one.
Tomas
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.