[cairo] Some notes on using git to query history (was: Re: [cairo
patch] XCB updated)
Carl Worth
cworth at cworth.org
Thu May 4 21:03:23 PDT 2006
On Thu, 4 May 2006 17:16:22 -0700, Ian Osgood wrote:
> On May 4, 2006, at 2:40 PM, Carl Worth wrote:
> >
> > Of course, this backend will have to pass the entire test suite as
> > well. That should be quite easy to ensure by borrowing liberally from
> > the xlib surface, (historically, cairo-xcb-surface.c has just been a
> > slightly-modified copy of cairo-xlib-surface.c).
>
> I can't find the git command for showing the history or revision
> diffs for a single file. This would help me figure out what has
> changed in the xlib implementation in the last year.
[Replying to the list again for the benefit of others that may be
listening.]
"git log" is the thing you want here. Unfortunately, the git-log
documentation is a bit on the terse side, so I'll mention a couple of
things here.
Most git command are built on top of a small collection of fundamental
building blocks. Two of these blocks that end up being quite important
are git-rev-parse and git-rev-list. Now, you might never need to
invoke these directly, but it's still very useful to get familiar with
their documentation, since most other commands, (such as git-log),
will pass command-line options down to these fundamental things.
To finally answer the question, here are a couple of example commands
that you might find useful:
Display the commit messages for all commits affecting either
cairo-xlib.h or cairo-xlib-surface.c:
git log -- src/cairo-xlib*
Display the commit messages and patches for all commits affecting
cairo-xlib.h:
git log -p -- src/cairo-xlib.h
When I said most git commands use these same options, I really did
mean most of them. For example, gitk does, so you could get a
graphical view of all the xlib related commits with:
gitk -- src/cairo-xlib*
And there are other handy ways to limit things, for example, instead
of restricting commits by the path names affected, we can ask for
select based on date ranges. What changes have been happened in the
last two weeks:
gitk --since='2 weeks ago'
Or by revision ranges. What changes do we have in the 1.1.4 snapshot
that don't appear in 1.0.4:
gitk 1.0.4..1.1.4
(That .. syntax is quite powerful. It's easy to imagine what it does
given two linear revisions, but notice that here I gave it two
different heads. This is a well-defined operation and is quite
powerful).
And you can use .. without a final revision to just mean HEAD. So, what
has happened between the 1.1.4 snapshot and now:
git log 1.1.4..
And of course, the commit selection stuff can be combined with the
path-limiting stuff. So you can ask for all patches that have affected
xlib files since 1.1.4 with:
git log -p 1.1.4.. -- src/cairo-xlib*
Anyway, I hope that's helpful at demonstrating how easy it is to ask
some very precise questions with git. This stuff is infinitely better
than anything that is available with cvs for example, (and I haven't
even started showing what you can do with "git grep" yet).
> (I'm also having difficulty building the tests, because my system
> Xlib has an older fontconfig than that used with libpng. I'm just now
> building Xlib/XCB anyway, so I'm trying to use that, but I haven't
> figured out how to tell the library location to autoconf.)
Have you tried setting PKG_CONFIG_PATH to a list of ':'-separated
directories containing .pc files? For example, something like:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/xcb/lib/pkgconfig
or whatever... use $prefix/lib/pkgconfig according to the prefix you
used when compiling and installing the packages of interest.
-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.freedesktop.org/archives/cairo/attachments/20060504/ff7faa5b/attachment.pgp
More information about the cairo
mailing list