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

Re: [PATCH] send-pack: Filter unknown commits from alternates of the remote

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 28, 2009, 04:13 UTC
Message-ID
<7vljswxe3d.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090128035804.GC7503@atjola.homenet>
Björn Steinbrink <B.Steinbrink@gmx.de> writes:
> Uhm, it might be obvious, but what exactly could go wrong?

Between the refs and your object store, there is a contract that guarantees that everything that is reachable from your refs are complete and you won't hit unreachable object while traversing the reachability chain from them. But your object store can contain other garbage objects. The contract is one of the things "git fsck" checks.

Imagine you have fetched from somewhere with a commit walker (e.g. fetch over http), that started fetching from the tip commit and its associated objects, and then got interrupted. Such a transfer will leave the objects in your local repository but it is safe because it won't update your refs.

>> I'd prefer a small helper function to consolidate the duplicated code,
>> like the attached patch, though.  How about doing it like this?
>
> Yeah, that looks a lot nicer :-)

But it was broken. The initial check feed_object() does with has_sha1_file() and NEEDSWORK comment needs to be inside

	if (negative) {
		if (!has_sha1_file(theirs))
			return 1;
		/*
		 * NEEDSWORK: we should not be satisfied by simply having
		 * theirs, but should be making sure it is reachable from
		 * some of our refs.
		 */
	}

to make sure we won't trigger the availability or connectivity check for positive refs.

Previous: Björn SteinbrinkNext: Junio C Hamano
Message 14 of 43 in “Bad objects error since upgrading GitHub servers to 1.6.1”
  1. PJ HyettJan 27, 2009
  2. PJ HyettJan 27, 2009
  3. Johannes SchindelinJan 27, 2009
  4. Shawn O. PearceJan 27, 2009
  5. Junio C HamanoJan 27, 2009
  6. PJ HyettJan 28, 2009
  7. PJ HyettJan 28, 2009
  8. Junio C HamanoJan 28, 2009
  9. Junio C HamanoJan 28, 2009
  10. send-pack: Filter unknown commits from alternates of the remoteBjörn Steinbrink, Jan 28, 2009
  11. Junio C HamanoJan 28, 2009
  12. Junio C HamanoJan 28, 2009
  13. Björn SteinbrinkJan 28, 2009
  14. Junio C HamanoJan 28, 2009
  15. Junio C HamanoJan 28, 2009
  16. Junio C HamanoJan 28, 2009
  17. PJ HyettJan 28, 2009
  18. Shawn O. PearceJan 28, 2009
  19. Junio C HamanoJan 28, 2009
  20. Shawn O. PearceJan 28, 2009
  21. Stephen BannaschJan 28, 2009
  22. Shawn O. PearceJan 28, 2009
  23. Junio C HamanoJan 28, 2009
  24. Junio C HamanoJan 28, 2009
  25. Shawn O. PearceJan 28, 2009
  26. Junio C HamanoJan 28, 2009
  27. Junio C HamanoJan 28, 2009
  28. 1/2 send-pack: do not send unknown object name from ".have" to pack-objectsJunio C Hamano, Jan 28, 2009
  29. Linus TorvaldsJan 28, 2009
  30. Junio C HamanoJan 28, 2009
  31. Jeff KingJan 28, 2009
  32. Junio C HamanoJan 28, 2009
  33. Jeff KingJan 28, 2009
  34. Shawn O. PearceJan 28, 2009
  35. Jeff KingJan 28, 2009
  36. Junio C HamanoJan 28, 2009
  37. Junio C HamanoJan 28, 2009
  38. Jeff KingJan 28, 2009
  39. Shawn O. PearceJan 28, 2009
  40. Nicolas PitreJan 28, 2009
  41. Jeff KingJan 28, 2009
  42. Linus TorvaldsJan 28, 2009
  43. Björn SteinbrinkJan 28, 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.