git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 07/10] rev-list: call new "filter_skip" function

From
Christian Couder <chriscool@tuxfamily.org>
Date
Apr 1, 2009, 06:09 UTC
Message-ID
<200904010809.41110.chriscool@tuxfamily.org>
In-Reply-To
<alpine.DEB.1.00.0903311117400.10279@pacific.mpi-cbg.de>
Le mardi 31 mars 2009, Johannes Schindelin a écrit :
Show 24 quoted lines
> Hi,
>
> On Tue, 31 Mar 2009, Christian Couder wrote:
> > Le lundi 30 mars 2009, Johannes Schindelin a écrit :
> > > On Mon, 30 Mar 2009, Christian Couder wrote:
> > > > Le jeudi 26 mars 2009, Junio C Hamano a écrit :
> > > > > I've learned to suspect without reading a qsort() callback that
> > > > > does not derefence its arguments.  Is this doing the right thing?
> > > >
> > > > I think so.
> > >
> > > I suspect something much worse: you are trying to build a list of
> > > sha1s of commits that need to be skipped, later to look up every
> > > commit via binary search.
> > >
> > > But it has been proven a lot of times that using a hash set is
> > > superior to that approach, and even better: we already have the
> > > framework in place in the form of struct decorate.
> >
> > I had a look, and "struct decorate" can be used to store objects, but I
> > want to store only sha1s.
>
> No, you want to _look up_ sha1s.  And struct decorate is not about
> storing objects, but to attach things to objects. 

The problem is that I don't have any object to attach things to when I read the bisect skip refs. I just need to store the sha1 from the skip refs in some sha1 container.

Here is the related code:
static int register_ref(const char *refname, const unsigned char *sha1,
			int flags, void *cb_data)
{
	if (!strcmp(refname, "bad")) {
		...
	} else if (!prefixcmp(refname, "good-")) {
		...
	} else if (!prefixcmp(refname, "skip-")) {
		ALLOC_GROW(skipped_sha1, skipped_sha1_nr + 1,
			   skipped_sha1_alloc);
		hashcpy(skipped_sha1[skipped_sha1_nr++], sha1);
	}
	return 0;
}
static int read_bisect_refs(void)
{
	return for_each_bisect_ref(register_ref, NULL);
}

Best regards, Christian.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 7 of 9 in “rev-list: call new "filter_skip" function”
  1. 07/10 rev-list: call new "filter_skip" functionChristian Couder, Mar 26, 2009
  2. Junio C HamanoMar 26, 2009
  3. Christian CouderMar 30, 2009
  4. Johannes SchindelinMar 30, 2009
  5. Christian CouderMar 31, 2009
  6. Johannes SchindelinMar 31, 2009
  7. Christian CouderApr 1, 2009
  8. Johannes SchindelinApr 1, 2009
  9. Christian CouderApr 2, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.