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

Re: [PATCH/RFC] Revoke write access to refs and odb after importing another repo's odb

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jan 23, 2013, 20:38 UTC
Message-ID
<51004A37.6040301@web.de>
In-Reply-To
<7v1udbj0kt.fsf@alter.siamese.dyndns.org>
Am 23.01.2013 18:01, schrieb Junio C Hamano:
Show 24 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
> 
>> add_submodule_odb() can be used to import objects from another
>> repository temporarily. After this point we don't know which objects
>> are ours, which are external. If we create an object that refers to an
>> external object, next time git runs, it may find a hole in the object
>> graph because the external repository may not be imported. The same
>> goes for pointing a ref to an external SHA-1.
>>
>> To protect ourselves, once add_submodule_odb() is used:
>>
>>  - trees, tags and commits cannot be created
>>  - refs cannot be updated
>>
>> In certain cases that submodule code knows that it's safe to write, it
>> can turn the readonly flag off.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>>  I think this is a good safety check.
> 
> Two step implementation to bring "read-only" support into a testable
> shape and then flip that bit in add_submdule_odb() would be a
> sensible approach.

I agree this is a worthwhile change so nobody accidentally screws things up.

>>  It catches at least a case in
>>  t7405.3. I did not investigate further though.

This is a false positive. The merge algorithm picked a fast-forward in a submodule as a proper merge result and records that in a gitlink. But as Duy pointed out this could be easily fixed by turning the readonly flag off in that case.

Show 6 quoted lines
> I however have this suspicion that this will become a losing battle
> and we would be better off getting rid of add_submodule_odb();
> instead operations that work across repositories will be done as a
> subprocess, which will get us back closer to one of the original
> design goals of submodule support to have a clear separation between
> the superproject and its submodules.

Please don't. While I agree with your goal, I'd be unhappy to do that because of the performance drop (especially on fork-challenged operating systems).

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 7 in “Revoke write access to refs and odb after importing another repo's odb”
  1. Revoke write access to refs and odb after importing another repo's odbNguyễn Thái Ngọc Duy, Jan 23, 2013
  2. Duy NguyenJan 23, 2013
  3. Junio C HamanoJan 23, 2013
  4. Jens LehmannJan 23, 2013
  5. Junio C HamanoJan 23, 2013
  6. Duy NguyenJan 24, 2013
  7. Duy NguyenJan 24, 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.