From: Shawn Pearce <spearce@spearce.org>
To: Marco Costalba <mcostalba@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Fast access git-rev-list output: some OS knowledge required
Date: Wed, 6 Dec 2006 14:42:58 -0500 [thread overview]
Message-ID: <20061206194258.GD20320@spearce.org> (raw)
In-Reply-To: <e5bfff550612061134r3725dcbu2ff2dd6284fcd651@mail.gmail.com>
Marco Costalba <mcostalba@gmail.com> wrote:
> On 12/6/06, Shawn Pearce <spearce@spearce.org> wrote:
> >Marco Costalba <mcostalba@gmail.com> wrote:
> >> The time it takes to read, without processing, the whole Linux tree
> >> with this approach it's almost _double_ of the time it takes 'git
> >> rev-list' to write to a file:
> >>
> >> 3) Other suggestions? ;-)
> >
> >The revision listing machinery is fairly well isolated behind some
> >pretty clean APIs in Git. Why not link qgit against libgit.a and
> >just do the revision listing in process?
> >
>
> Where can I found some documentation (yes I know RTFS, but...) or,
> better, an example of using the API to read git-rev-list output?
builtin-rev-list.c. :-)
I think all you may need is:
#include "revision.h"
...
struct rev_info revs;
init_revisions(&revs, prefix);
revs.abbrev = 0;
revs.commit_format = CMIT_FMT_UNSPECIFIED;
argc = setup_revisions(argc, argv, &revs, NULL);
where argv just a char** of the arguments you were going to hand
to rev-list on the command line.
then get the data back:
static void show_commit(struct commit *commit)
{
const char * hex = sha1_to_hex(commit->object.sha1);
... copy from hex to your own structures ...
}
static void show_object(struct object_array_entry *p)
{
/* do nothing */
}
prepare_revision_walk(&revs);
traverse_commit_list(&revs, show_commit, show_object);
--
next prev parent reply other threads:[~2006-12-06 19:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 19:24 Fast access git-rev-list output: some OS knowledge required Marco Costalba
2006-12-06 19:28 ` Shawn Pearce
2006-12-06 19:34 ` Marco Costalba
2006-12-06 19:42 ` Shawn Pearce [this message]
2006-12-06 19:51 ` Shawn Pearce
2006-12-06 20:08 ` Marco Costalba
2006-12-06 20:18 ` Shawn Pearce
2006-12-07 13:25 ` Andreas Ericsson
2006-12-07 14:53 ` Johannes Schindelin
2006-12-07 15:28 ` Andreas Ericsson
2006-12-07 16:01 ` Johannes Schindelin
2006-12-08 18:34 ` Marco Costalba
2006-12-08 20:10 ` Michael K. Edwards
2006-12-09 12:15 ` Marco Costalba
2006-12-06 23:27 ` Johannes Schindelin
2006-12-07 0:47 ` Linus Torvalds
2006-12-07 6:46 ` Marco Costalba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061206194258.GD20320@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=mcostalba@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).