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

Re: [PATCH] fetch-pack: speed up loading of refs via commit graph

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 4, 2021, 17:45 UTC
Message-ID
<xmqqczqtp0ip.fsf@gitster.g>
In-Reply-To
<08519b8ab6f395cffbcd5e530bfba6aaf64241a2.1628085347.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 9 quoted lines
> -	if (type == OBJ_COMMIT)
> -		return (struct commit *) parse_object(the_repository, oid);
> +
> +	if (type == OBJ_COMMIT) {
> +		struct commit *commit = lookup_commit(the_repository, oid);
> +		if (!commit || repo_parse_commit(the_repository, commit))
> +			return NULL;
> +		return commit;
> +	}
OK.

Asking parse_object() to turn an object name to an in-core instance of the object is a pretty much standard and generic idiom, but in this codepath, we have already asked for the type and know it must be a commit, so asking parse_commit() that is more specialized makes quite a lot of sense.

Thanks.
Previous: Derrick StoleeNext: Jeff King
Message 3 of 12 in “fetch-pack: speed up loading of refs via commit graph”
  1. fetch-pack: speed up loading of refs via commit graphPatrick Steinhardt, Aug 4, 2021
  2. Derrick StoleeAug 4, 2021
  3. Junio C HamanoAug 4, 2021
  4. Jeff KingAug 4, 2021
  5. Junio C HamanoAug 4, 2021
  6. Patrick SteinhardtAug 5, 2021
  7. Patrick SteinhardtAug 5, 2021
  8. Junio C HamanoAug 5, 2021
  9. Jeff KingAug 5, 2021
  10. Jeff KingAug 5, 2021
  11. Ævar Arnfjörð BjarmasonAug 5, 2021
  12. Jeff KingAug 5, 2021

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.