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

Re: [Bug] data loss with cyclic alternates

From
Ephrim Khong <dr.khong@gmail.com>
Date
Jul 13, 2014, 10:44 UTC
Message-ID
<53C26309.5040401@gmail.com>
In-Reply-To
<xmqqy4vz51gb.fsf@gitster.dls.corp.google.com>
Am 11.07.14 18:01, schrieb Junio C Hamano:
Show 10 quoted lines
> Ephrim Khong <dr.khong@gmail.com> writes:
>
>> git seems to have issues with alternates when cycles are present (repo
>> A has B/objects as alternates, B has A/objects as alternates).
>
> Yeah, don't do that.  A thinks "eh, the other guy must have it" and
> B thinks the same.  In general, do not prune or gc a repository
> other repositories borrow from, even if there is no cycle, because
> the borrowee does not know anythning about objects that it itself no
> longer needs but are still needed by its borrowers.

It seems that there is a safeguard against this in sha1_file.c, link_alt_odb_entry(), that doesn't work as intended:

	if (!strcmp(ent->base, objdir)) {
		free(ent);
		return -1;
	}

However, printf-debugging tells me that ent->base is absolute and objdir is relative (".git/objects") at this point, so the strings are different even though the files are the same.

I never submitted a patch to git. Do you think someone can fix this hickup, otherwise I'll give it a shot next week.

Previous: Keller, Jacob ENext: Ephrim Khong
Message 6 of 16 in “[Bug] data loss with cyclic alternates”
  1. Ephrim KhongJul 11, 2014
  2. Junio C HamanoJul 11, 2014
  3. Keller, Jacob EJul 11, 2014
  4. Jeff KingJul 12, 2014
  5. Keller, Jacob EJul 14, 2014
  6. Ephrim KhongJul 13, 2014
  7. sha1_file: do not add own object directory as alternateEphrim Khong, Jul 14, 2014
  8. Duy NguyenJul 14, 2014
  9. Ephrim KhongJul 14, 2014
  10. Johannes SixtJul 15, 2014
  11. sha1_file: do not add own object directory as alternateEphrim Khong, Jul 15, 2014
  12. Junio C HamanoJul 15, 2014
  13. Ephrim KhongJul 16, 2014
  14. Eric SunshineJul 15, 2014
  15. Junio C HamanoJul 15, 2014
  16. Ephrim KhongJul 16, 2014

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.