From: Phil Hord <phil.hord@gmail.com>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Junio C Hamano <gitster@pobox.com>, Git <git@vger.kernel.org>,
Jens Lehmann <jens.lehmann@web.de>,
Jonathan Nieder <jrnieder@gmail.com>, Jeff King <peff@peff.net>,
"W. Trevor King" <wking@tremily.us>,
Eric Sunshine <sunshine@sunshineco.com>,
Karsten Blees <karsten.blees@gmail.com>
Subject: Re: [PATCH v5 1/4] implement submodule config API for lookup of .gitmodules values
Date: Wed, 8 Jul 2015 16:52:14 -0400 [thread overview]
Message-ID: <CABURp0pyYcKvmbEeDSYqm15DtXvH7g_UXASR3utGco+=D95bOA@mail.gmail.com> (raw)
In-Reply-To: <ef740bdea9af35564c75efd2a6daae65f3108df5.1434400625.git.hvoigt@hvoigt.net>
On Mon, Jun 15, 2015 at 5:06 PM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
> In a superproject some commands need to interact with submodules. They
> need to query values from the .gitmodules file either from the worktree
> of from certain revisions. At the moment this is quite hard since a
> caller would need to read the .gitmodules file from the history and then
> parse the values. We want to provide an API for this so we have one
> place to get values from .gitmodules from any revision (including the
> worktree).
>
> The API is realized as a cache which allows us to lazily read
> .gitmodules configurations by commit into a runtime cache which can then
> be used to easily lookup values from it. Currently only the values for
> path or name are stored but it can be extended for any value needed.
>
> It is expected that .gitmodules files do not change often between
> commits. Thats why we lookup the .gitmodules sha1 from a commit and then
> either lookup an already parsed configuration or parse and cache an
> unknown one for each sha1. The cache is lazily build on demand for each
> requested commit.
>
> This cache can be used for all purposes which need knowledge about
> submodule configurations. Example use cases are:
>
> * Recursive submodule checkout needs to lookup a submodule name from
> its path when a submodule first appears. This needs be done before
> this configuration exists in the worktree.
>
> * The implementation of submodule support for 'git archive' needs to
> lookup the submodule name to generate the archive when given a
> revision that is not checked out.
>
> * 'git fetch' when given the --recurse-submodules=on-demand option (or
> configuration) needs to lookup submodule names by path from the
> database rather than reading from the worktree. For new submodule it
> needs to lookup the name from its path to allow cloning new
> submodules into the .git folder so they can be checked out without
> any network interaction when the user does a checkout of that
> revision.
>
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
> ---
> .gitignore | 1 +
> Documentation/technical/api-submodule-config.txt | 46 +++
> Makefile | 2 +
> submodule-config.c | 445 +++++++++++++++++++++++
> submodule-config.h | 27 ++
> submodule.c | 1 +
> submodule.h | 1 +
> t/t7411-submodule-config.sh | 85 +++++
> test-submodule-config.c | 66 ++++
> 9 files changed, 674 insertions(+)
> create mode 100644 Documentation/technical/api-submodule-config.txt
> create mode 100644 submodule-config.c
> create mode 100644 submodule-config.h
> create mode 100755 t/t7411-submodule-config.sh
> create mode 100644 test-submodule-config.c
Instead of test-submodule-config.c to test this new module, it could
be useful to implement these as extensions to rev-parse:
git rev-parse --submodule-name [<ref>:]<path>
git rev-parse --submodule-path [<ref>:]<name>
git rev-parse --submodule-url [<ref>:]<name>
git rev-parse --submodule-ignore [<ref>:]<name>
git rev-parse --submodule-recurse [<ref>:]<name>
Has this already been considered and rejected for some reason?
next prev parent reply other threads:[~2015-07-08 20:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 21:06 [PATCH v5 0/4] submodule config lookup API Heiko Voigt
2015-06-15 21:06 ` [PATCH v5 1/4] implement submodule config API for lookup of .gitmodules values Heiko Voigt
2015-06-16 10:54 ` Heiko Voigt
2015-07-08 20:52 ` Phil Hord [this message]
2015-07-09 12:09 ` Heiko Voigt
2015-07-09 15:49 ` Jeff King
2015-07-09 19:41 ` Jens Lehmann
2015-07-09 20:00 ` Junio C Hamano
2015-07-13 11:17 ` Heiko Voigt
2015-07-13 15:49 ` Junio C Hamano
2015-06-15 21:06 ` [PATCH v5 2/4] extract functions for submodule config set and lookup Heiko Voigt
2015-06-15 21:06 ` [PATCH v5 3/4] use new config API for worktree configurations of submodules Heiko Voigt
2015-06-15 21:06 ` [PATCH v5 4/4] do not die on error of parsing fetchrecursesubmodules option Heiko Voigt
2015-06-15 21:48 ` [PATCH v5 0/4] submodule config lookup API Junio C Hamano
2015-08-10 19:23 ` Stefan Beller
2015-08-12 17:53 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CABURp0pyYcKvmbEeDSYqm15DtXvH7g_UXASR3utGco+=D95bOA@mail.gmail.com' \
--to=phil.hord@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=jens.lehmann@web.de \
--cc=jrnieder@gmail.com \
--cc=karsten.blees@gmail.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
--cc=wking@tremily.us \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).