Re: Fast access git-rev-list output: some OS knowledge required

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Marco Costalba <mcostalba@...>
Cc: Git Mailing List <git@...>
Date: Wednesday, December 6, 2006 - 3:42 pm

Marco Costalba <mcostalba@gmail.com> wrote:

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);

-- 
Shawn.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Fast access git-rev-list output: some OS knowledge requi..., Johannes Schindelin, (Wed Dec 6, 7:27 pm)
Re: Fast access git-rev-list output: some OS knowledge requi..., Shawn Pearce, (Wed Dec 6, 3:42 pm)
Re: Fast access git-rev-list output: some OS knowledge requi..., Michael K. Edwards, (Fri Dec 8, 4:10 pm)
Re: Fast access git-rev-list output: some OS knowledge requi..., Johannes Schindelin, (Thu Dec 7, 10:53 am)
Re: Fast access git-rev-list output: some OS knowledge requi..., Johannes Schindelin, (Thu Dec 7, 12:01 pm)