[cairo] Use of git

Carl Worth cworth at cworth.org
Thu Jan 10 08:53:44 PST 2008


On Thu, 10 Jan 2008 03:22:15 -0500, Antoine Azar wrote:
> Slightly off-topic, but I was just curious as to why we use git for
> Cairo's source control?

Here's the original message I sent out proposing the switch from cvs
to git nearly two years ago:

	[cairo] Plans (and motivation) for moving cairo from CVS to git
	http://lists.cairographics.org/archives/cairo/2006-February/006255.html

I think the concepts and motivation I introduced there are still
current. And my hopes for git have all played out very well. I've been
very pleased with the increased productivity that it affords.

The things that have changed since I wrote that are that the user
interfaces and tutorials for git have improved dramatically. For
example, here's something I put together showing how easy git can be
to learn:

	A tour of git: the basics
	http://cworth.org/hgbook-git/tour/

My rationale for working on that is here:

	Git is easy to learn
	http://cworth.org/hgbook-git/

> I'm admitedly a total beginner with git, but
> it seems to me the only advantage it has over something like Perforce
> is the ability to generate and email patches. Other than that, I find
> it much less intuitive than other solutions such as Perforce or SVN,
> which can be just as easily "distributed" by creating branches off
> repositories.

Uhm, no.

The word "branch" doesn't make something distributed. And particularly
the incredibly broken concept of "branch" that svn provides, (simply
parallel directories).

What makes git distributed is the following characteristics:

  * Disconnected operation, (make commits on an airplane, for
    example).

  * Not just creating branches, but *merging* them, (at the level of
    multiple merges per day with zero pain).

  * Everywhere the code lives is a full-fledged repository, just as
    functional as any other, (unlike the very distinct notions of
    "repository" and "working copies" like svn has). There's *no*
    notion of a "central" repository in any technical sense.

I'm quite certain that svn has none of those characteristics, (I have
no knowledge of perforce, so I can't comment on it).

The modes of development made possible by a distributed system just
don't exist with a centralized setup like svn. And if you haven't
experienced it yet maybe it's just hard to appreciate it. Here's a
random screenshot I googled, ("gitk screenshot"), that might give some
of a feel for the kind of regular branching/merging that happens
everyday when you're using git and that would be unthinkably hard with
any of the centralized systems:

http://www.flickr.com/photos/malcolmtredinnick/1516857444/

I will confess that the "write a single-feature and mail a patch" mode
that you've found yourself in so far doesn't really showcase much of
the great features of git. But then again, this mode can be really
simple to:

	git clone git://anongit.freedesktop.org/git/cairo
	cd cairo
	# hack, hack, hack
	git diff > feature.patch
	# send email

Clearly, that's no harder than any centralized system, right?

And I'd be fine if an initial contributor to cairo did no more than
that. Now, afterwards, if this contributor wanted to submit more
later, I would encourage and teach more. For example, it's much better
to replace the "git diff" step with:

	git commit -a
	git format-patch origin
	# send email with the commit-message.patch

Since this gives the author a chance to write the commit message
describing the patch, and that's really important. I will admit that
the format-patch command-line is fairly ugly.

Ironically, at the next stage the commands get a bit simpler. When the
contributor reaches this point I'll encourage the contributor to start
pushing commits directly to cairo's central repository. The emailing
of patches will still often happen for sake of review, but the actual
git commands necessary for pushing the changes out become simply:

	git commit -a
	git push

So I'm curious what you see as not being intuitive here. Is there
something that's not intuitive about the above command set? Or was it
more that it was hard to find a description providing something like
this list of commands?

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080110/1c66aaca/attachment.pgp 


More information about the cairo mailing list