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

Re: [PATCH 1/7] sha1_file: keep track of where an SHA-1 object comes from

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 24, 2013, 17:45 UTC
Message-ID
<7va9rycw4t.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1359016940-18849-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 10 quoted lines
> We currently know if an object is loose or packed. We do not know if
> it's from the repo's object database, or via alternates
> mechanism. With this patch, sha1_object_info_extended() can tell if an
> object comes from alternates source (and which one).
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  How about this way instead: we keep track of where objects come from
>  so we can verify object source when we create or update something
>  that contains SHA-1.

The overall approach taken by this series may be worth considering, but I do not think the check implemented here is correct.

An object may be found in an alternate odb but we may also have our own copy of the same object. You need to prove that a suspicious object is visible to us *ONLY* through add_submodule_odb().

Once you do add_submodule_odb() to contaminate our object pool, you make everything a suspicious object that needs to be checked; that is the worst part of the story.

If I understand the test case that triggers the issue correctly, it makes a merge in the top-level superproject, and while doing so, tries to three-way merge gitlink changes, so that it can detect fast-forward situation inside the submodule. It should just be done with running "git merge-base A B" there; after all, we are in the tree-wide merge of the top-level superproject, which is already a heavy-weight operation. I do not see a reason to make it more brittle than necessary.

If we rip out add_submodule_odb() we do not have to ever worry about this kind of object database breakages that are hard to track down. It is an optimization to allow the code become more brittle, violate the project boundary, and break the object database faster as a result. That is not a good optimization at all.

Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 18 of 21 in “sha1_file: keep track of where an SHA-1 object comes from”
  1. 1/7 sha1_file: keep track of where an SHA-1 object comes fromNguyễn Thái Ngọc Duy, Jan 24, 2013
  2. 2/7 sha1_file: separate alt object db from own repos and submodules'sNguyễn Thái Ngọc Duy, Jan 24, 2013
  3. 3/7 sha1_file: refuse to write commits referring to external objectsNguyễn Thái Ngọc Duy, Jan 24, 2013
  4. 4/7 sha1_file: refuse to write trees referring to external objectsNguyễn Thái Ngọc Duy, Jan 24, 2013
  5. 5/7 sha1_file: refuse to write tags referring to external objectsNguyễn Thái Ngọc Duy, Jan 24, 2013
  6. 6/7 read-cache: refuse to create index referring to external objectsNguyễn Thái Ngọc Duy, Jan 24, 2013
  7. Junio C HamanoJan 24, 2013
  8. Duy NguyenJan 25, 2013
  9. Junio C HamanoJan 25, 2013
  10. Duy NguyenJan 28, 2013
  11. Junio C HamanoJan 28, 2013
  12. Duy NguyenJan 28, 2013
  13. Junio C HamanoJan 28, 2013
  14. Duy NguyenJan 28, 2013
  15. Junio C HamanoJan 28, 2013
  16. Duy NguyenJan 28, 2013
  17. 7/7 refs: do not update ref(log) referring to external objectsNguyễn Thái Ngọc Duy, Jan 24, 2013
  18. Junio C HamanoJan 24, 2013
  19. Duy NguyenJan 25, 2013
  20. Junio C HamanoJan 25, 2013
  21. Duy NguyenJan 25, 2013

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.