git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Hjemli <hjemli@gmail.com>
To: Nanako Shiraishi <nanako3@lavabit.com>
Cc: Eric Kidd <git@randomhacks.net>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Mark Levedahl <mlevedahl@gmail.com>,
	Ping Yin <pkufranky@gmail.com>
Subject: Re: [RFC/PATCHv2] git submodule split
Date: Thu, 19 Feb 2009 20:23:08 +0100	[thread overview]
Message-ID: <8c5c35580902191123h4f1e56c7m3192bc1ffdf9fee6@mail.gmail.com> (raw)
In-Reply-To: <20090217191748.6117@nanako3.lavabit.com>

[* sorry for the late reply *]

On Tue, Feb 17, 2009 at 11:17, Nanako Shiraishi <nanako3@lavabit.com> wrote:
> Quoting Lars Hjemli <hjemli@gmail.com>:
>
>> I didn't look at the patch, but if the submodule uses a single
>> module-name while moving around, the re-cloning problem would by
>> solved if the submodule git-dir was stored inside the git-dir of the
>> containing repository  (by using the git-file mechanism). Maybe I
>> should try to finally implement this...
>
> Is it similar to what was discussed earlier in the thread
> http://thread.gmane.org/gmane.comp.version-control.git/47466/focus=47621
> (I asked gmane for "submodule relocate")?

Well, kind of. We ended up with a scheme similar to what Junio
described in the linked mail: every submodule in a repository is given
a canonical name by the .gitmodules file and this name is then linked
with a url in .git/config. The .gitmodules file also states at which
path(s) this submodule is located. So we can keep track of which
submodules we're interested in (and what urls to use for fetching
objects to those submodules) irrespective of the path used to check
out the submodules.

But when we're switching between branches in which a submodule is
checked out at different paths, we currently loose track of both the
old worktree and its gitdir. My gitfile proposal would salvage the
gitdir but, as Dscho mentioned, uncommited+untracked data in the
worktree would not be handled.

So I currently think it's better to make `git submodule init` update
.git/config with information about the current submodule path (again,
as Dscho mentioned). Then, after switching branches, `git submodule
<some-verb>` could notice that the current path is different from the
one in .git/config and simply `mv oldpath newpath` before updating
.git/config with the new path.

Btw. this wouldn't work smoothly if a single submodule was checked out
at multiple paths in the same revision, but I don't see why anyone
would want to do something like that...

--
larsh

  reply	other threads:[~2009-02-19 19:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 21:50 [RFC] What's the best UI for 'git submodule split'? Eric Kidd
2009-02-14  2:24 ` [RFC/PATCHv2] git submodule split Eric Kidd
2009-02-14  4:37   ` Junio C Hamano
2009-02-14  5:17     ` Eric Kidd
2009-02-14  9:03       ` Lars Hjemli
2009-02-14 11:44         ` Johannes Schindelin
2009-02-17 10:17         ` Nanako Shiraishi
2009-02-19 19:23           ` Lars Hjemli [this message]
2009-02-19 23:04         ` Kyle Moffett
2009-02-14 11:46     ` Johannes Schindelin
2009-02-14 14:11       ` Eric Kidd
2009-02-14 23:01         ` Johannes Schindelin
2009-02-14 23:13           ` Sverre Rabbelier

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=8c5c35580902191123h4f1e56c7m3192bc1ffdf9fee6@mail.gmail.com \
    --to=hjemli@gmail.com \
    --cc=git@randomhacks.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=mlevedahl@gmail.com \
    --cc=nanako3@lavabit.com \
    --cc=pkufranky@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).