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

[WIP 0/2] Submodule ref backend that mirrors superproject

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Dec 1, 2017, 22:50 UTC
Message-ID
<cover.1512168087.git.jonathantanmy@google.com>

I sent out an earlier email [1] that discusses the idea of a submodule ref backend that mirrors the superproject. Basically, if this backend is used (for example, through a configuration option), the submodule itself will not store any "refs/..." refs, but will check the gitlink of the commit of the ref of the same name in the superproject. For example, if the superproject has at refs/heads/foo:

    superproject/
      sub [gitlink -> 1234...]
and at refs/heads/bar:
    superproject/
      sub [gitlink -> 5678...]

Inside sub, "git rev-parse foo" will output "1234...", and "git rev-parse bar" will output "5678...", even though "foo" and "bar" are not defined anywhere inside sub.

(The submodule handles refs that do not start with "refs/" - for example, HEAD and FETCH_HEAD - like usual.)

[1] also describes what happens when the submodule attempts to write to any "refs/..." ref.

For those interested, here's what such an implementation might look like, and a test to demonstrate such functionality. I have partial read-only functionality - a lot of it still remains to be done.

[1] https://public-inbox.org/git/20171108172945.33c42a0e91b4ac494217b788@google.com/
Jonathan Tan (2):
  submodule: refactor acquisition of superproject info
  submodule: read-only super-backed ref backend
 Makefile                       |   1 +
 refs.c                         |  11 +-
 refs/refs-internal.h           |   1 +
 refs/sp-backend.c              | 261 +++++++++++++++++++++++++++++++++++++++++
 submodule.c                    | 107 +++++++++++------
 submodule.h                    |   5 +
 t/t1406-submodule-ref-store.sh |  26 ++++
 7 files changed, 374 insertions(+), 38 deletions(-)
 create mode 100644 refs/sp-backend.c
-- 
2.15.0.531.g2ccb3012c9-goog
Next: Jonathan Tan
Message 1 of 5 in “[WIP 0/2] Submodule ref backend that mirrors superproject”
  1. Jonathan TanDec 1, 2017
  2. 1/2 submodule: refactor acquisition of superproject infoJonathan Tan, Dec 1, 2017
  3. Stefan BellerDec 5, 2017
  4. 2/2 submodule: read-only super-backed ref backendJonathan Tan, Dec 1, 2017
  5. Stefan BellerDec 5, 2017

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.