git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [WIP 0/2] Submodule ref backend that mirrors superproject
@ 2017-12-01 22:50 Jonathan Tan
  2017-12-01 22:50 ` [WIP 1/2] submodule: refactor acquisition of superproject info Jonathan Tan
  2017-12-01 22:50 ` [WIP 2/2] submodule: read-only super-backed ref backend Jonathan Tan
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Tan @ 2017-12-01 22:50 UTC (permalink / raw)
  To: git; +Cc: sbeller, gitster, jacob.keller, Jonathan Tan

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-05 22:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-01 22:50 [WIP 0/2] Submodule ref backend that mirrors superproject Jonathan Tan
2017-12-01 22:50 ` [WIP 1/2] submodule: refactor acquisition of superproject info Jonathan Tan
2017-12-05 19:57   ` Stefan Beller
2017-12-01 22:50 ` [WIP 2/2] submodule: read-only super-backed ref backend Jonathan Tan
2017-12-05 22:28   ` Stefan Beller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).