git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Lars Hjemli <hjemli@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into  submodules
Date: Sun, 18 Jan 2009 19:02:16 -0800	[thread overview]
Message-ID: <7v7i4st2vb.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <8c5c35580901180945u17a69140vff2736765ee6073@mail.gmail.com> (Lars Hjemli's message of "Sun, 18 Jan 2009 18:45:40 +0100")

Lars Hjemli <hjemli@gmail.com> writes:

> On Sun, Jan 18, 2009 at 16:48, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> ...
>> Seems you want to fall back to look in the superproject's object database.
>> But I think that is wrong, as I have a superproject with many platform
>> dependent submodules, only one of which is checked out, and for
>> convenience, the submodules all live in the superproject's repository.
>
> Actually, I want this to work for bare repositories by specifying the
> submodule odbs in the alternates file. So if the current submodule odb
> wasn't found my plan was to check if the commit object was accessible
> anyways but don't die() if it wasn't.

The current submodule design is "do not recurse into them by default
without being told" throughout the Porcelain.  We can think of various
ways for the users to tell which submodules are of interest and which are
uninteresting.

The most general solution would be to give a list of submodules you are
interested in recursing into from the command line, something like:

    $ git command --with-submodule=path1 --with-submodule=path2...

That approach would work equally "well" with a bare repository or with a
non-bare repository, but if you have N submodules, you need to give up to
N extra options, which may be cumbersome (meaning, "works equally well"
above actually may mean "works equally awkwardly").  One way to solve
awkwardness may be to support a mechanism that allows you to use
configuration variables to name a group of submodules.

In addition to such configuration variables, you already have one default
group of submodules, defined by the way you set up your work tree, when
your superproject does have a work tree.  Some submodules have
repositories cloned in the work tree, while some don't, and the ones
without clones can be defined as "uninteresting ones" (to the work tree
owner) that are outside the default group.  For many work tree oriented
operations, it may even make sense to allow that group to be used with a
single "git command --with-submodule" (i.e. when you do not say which
submodule you mean, that can default to "cloned" group).

I do not know "has an entry in the superproject's alternate list that
points to its object store" is a good basis to define another default
group useful especially in a bare repository setting; you seem to be
suggesting that, and you might be correct.

For "git archive", however, I suspect the "default group based on work
tree checkout state" may make the least sense.  "git archive HEAD" is
expected to give a reproducible dump of the state recorded by the HEAD
commit no matter who runs it in what repository, and I think there should
be a conscious and explicit instruction from the end user that says "Here
is a dump from this commit in the superproject, *BUT* it was made together
with contents from this and that submodule".  Command line options that
list "this and that submodule" is explicit enough, and a configured
nickname given to a known group of submodules from the command line may be
so as well, but the group based on the checkout state feels a bit too
implicit and magical to my taste.  The group based on the "has an entry in
superproject's alternates" criterion is not much better in this regard,
methinks.

Another worrysome thing about "git archive" is that it marks the resulting
archive with the commit object name the tarball was taken from.  If you
allow recursing into an arbitrary subset of submodule, a project with N
submodules can produce 2^N different varieties of archive, all marked with
the same commit object name from the superproject.  That might be a bit
too confusing.

  parent reply	other threads:[~2009-01-19  3:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-18 10:53 [PATCH 0/3] Implement 'git archive --submodules' Lars Hjemli
2009-01-18 10:53 ` [PATCH 1/3] sha1_file: add function to insert alternate object db Lars Hjemli
2009-01-18 10:53   ` [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules Lars Hjemli
2009-01-18 10:53     ` [PATCH 3/3] git-archive: add support for --submodules Lars Hjemli
2009-01-18 15:51       ` Johannes Schindelin
2009-01-18 15:48     ` [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules Johannes Schindelin
2009-01-18 17:45       ` Lars Hjemli
2009-01-18 18:33         ` Johannes Schindelin
2009-01-18 19:45           ` Lars Hjemli
2009-01-18 21:02             ` Johannes Schindelin
2009-01-18 21:31               ` Lars Hjemli
2009-01-18 21:55                 ` Johannes Schindelin
2009-01-18 22:46                   ` Lars Hjemli
2009-01-19  1:24                     ` Johannes Schindelin
2009-01-19  2:01                       ` [PATCH/RFC v1 1/1] bug fix, diff whitespace ignore options Keith Cascio
2009-01-19  3:53                         ` Johannes Schindelin
2009-01-19 18:03                           ` [PATCH/RFC v2 " Keith Cascio
2009-01-19 18:36                             ` Johannes Schindelin
2009-01-20  7:04                             ` Junio C Hamano
2009-01-19  3:02         ` Junio C Hamano [this message]
2009-01-18 16:13     ` [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules René Scharfe
2009-01-18 16:37       ` Lars Hjemli
2009-01-18 19:00         ` Junio C Hamano
2009-01-18 19:50           ` Lars Hjemli
2009-01-18 15:32   ` [PATCH 1/3] sha1_file: add function to insert alternate object db Johannes Schindelin
2009-01-18 15:55     ` [PATCH] " Lars Hjemli

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v7i4st2vb.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=hjemli@gmail.com \
    /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.
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).