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

Re: [PATCH 3/4] push: prepare sender to receive extended ref information from the receiver

From
Jeff King <peff@peff.net>
Date
Sep 9, 2008, 13:03 UTC
Message-ID
<20080909130320.GA25935@coredump.intra.peff.net>
In-Reply-To
<1220948830-3275-4-git-send-email-gitster@pobox.com>
On Tue, Sep 09, 2008 at 01:27:09AM -0700, Junio C Hamano wrote:
> +struct extra_have_objects {
> +	int nr, alloc;
> +	unsigned char (*array)[20];
> +};

This declaration made me double-take. I think it is correct, and you are saving an extra pointer over a malloc. But the syntax ends up a little confusing:

        hashcpy(&(extra->array[extra->nr][0]), sha1);

Using a struct probably would have been a little easier to read. I don't know if this is worth changing.

> +	if (extra->alloc <= extra->nr)
> +		ALLOC_GROW(extra->array, extra->nr + 1, extra->alloc);
Isn't the conditional superfluous (ALLOC_GROW already makes this check)?
-Peff
Previous: Junio C HamanoNext: Paolo Bonzini
Message 6 of 12 in “Pushing into a repository with alternates”
  1. 0/4 Pushing into a repository with alternatesJunio C Hamano, Sep 9, 2008
  2. 1/4 is_directory(): a generic helper functionJunio C Hamano, Sep 9, 2008
  3. 2/4 receive-pack: make it a builtinJunio C Hamano, Sep 9, 2008
  4. 3/4 push: prepare sender to receive extended ref information from the receiverJunio C Hamano, Sep 9, 2008
  5. 4/4 push: receiver end advertises refs from alternate repositoriesJunio C Hamano, Sep 9, 2008
  6. Jeff KingSep 9, 2008
  7. Paolo BonziniSep 9, 2008
  8. Junio C HamanoSep 9, 2008
  9. Paolo BonziniSep 9, 2008
  10. Johannes SixtSep 9, 2008
  11. Jeff KingSep 9, 2008
  12. Junio C HamanoSep 9, 2008

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.