From: Tim Harper <timcharper@gmail.com>
To: git@vger.kernel.org
Subject: Re: Making submodules easier to work with (auto-update on checkout or merge, stash & restore submodules)
Date: Tue, 29 Apr 2008 22:47:25 -0600 [thread overview]
Message-ID: <EC4DE72E-665B-44C9-A85C-C12C26B00C3A@gmail.com> (raw)
In-Reply-To: <8B885217-8C18-417E-8F11-BB6661792CD3@gmail.com>
clarification:
SUGGESTED ALGORITHM (AS HAS BEEN IMPLEMENTED IN THE GIT TEXTMATE BUNDLE)
When pulling / merging / changing branches:
1) cache all submodules to .git/submodules_cache
- a) move the submodule to .git/submodules_cache/`echo
"$submodule_path\n$submodule_url" | md5`
2) execute the pull / merge / branch change
3) restore all defined submodules from .git/submodules_cache to their
respective working directory locations (only the submodules that are
still defined after the merge / change / pull)
4) execute git "submodule init && git submodule update"
On Apr 29, 2008, at 10:08 PM, Tim Harper wrote:
> OVERVIEW:
> On the Git TextMate Bundle, I've automated a lot of the submodule
> commands to make them not a terrible pain to work with. (don't get
> me wrong - I really like the git submodule implementation, I just
> don't like how hard it is to work with).
>
> "WARTS" WITH EXISTING IMPLEMENTATION
> 1) The submodule stays in the working copy when changing to a branch
> that does not have a submodule. This can break a build and cause
> problems. To work around, I have to delete the folder completely
> (git-clean). Then, when I switch back to the branch again, I have
> to re-download the submodule.
> 2) I have to type "git checkout branch && git submodule init && git
> submodule update" to be sure that I really have the whole contents
> of the branch. That's 3 commands, and a lot of typing.
> 3) If I don't run "git submodule update", and carelessly run "git
> commit -a" or "git add .", I risk propagating a submodule version
> from another branch or undoing an important change.
>
> SUGGESTED ALGORITHM (AS HAS BEEN IMPLEMENTED IN THE GIT TEXTMATE
> BUNDLE)
> When pulling / merging / changing branches:
> 1) cache all submodules to ~/.git/submodules_cache
> a) move from the working directory to a folder that is a MD5 hex-
> hash of both the submodule path and the submodule url
> 2) execute the pull / merge / branch change
> 3) restore all defined submodules to ~/.git/submodules_cache (only
> the submodules that are still defined after the merge / change / pull)
> 4) execute git submodule init && git submodule update
>
>
> PITFALLS:
> pitfall)
> If you commit a change on a submodule that's not on a branch, auto-
> updating submodules will make it difficult to revive that change.
>
> workaround)
> Don't allow the user to commit unless they are on a branch.
>
> ... couldn't think of anymore. Anyone?
>
> CONCLUSION
> So far, this algorithm holds up well in my use cases, and has made
> submodule management seamless for me (I don't have to know that I'm
> working with submodules). It's resolved every one of the above
> outlined interface warts.
>
> Would it be a good idea to build this algorithm into git? What
> would be the best approach? Am I completely overlooking something
> by designing the Git TextMate bundle to handle submodules this way?
>
> Thanks,
> Tim
next prev parent reply other threads:[~2008-04-30 4:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-30 4:08 Making submodules easier to work with (auto-update on checkout or merge, stash & restore submodules) Tim Harper
2008-04-30 4:47 ` Tim Harper [this message]
2008-04-30 6:14 ` Andreas Ericsson
2008-04-30 10:31 ` Johannes Schindelin
2008-04-30 16:47 ` Avery Pennarun
2008-04-30 17:21 ` Ping Yin
2008-04-30 19:55 ` Roman Shaposhnik
2008-04-30 20:26 ` Avery Pennarun
2008-04-30 20:19 ` Tim Harper
2008-04-30 20:31 ` Avery Pennarun
2008-04-30 21:37 ` Tim Harper
2008-04-30 21:48 ` Avery Pennarun
2008-04-30 22:23 ` Roman Shaposhnik
2008-04-30 22:28 ` Avery Pennarun
2008-05-01 18:38 ` Making submodules easier to work with Finn Arne Gangstad
2008-05-01 19:55 ` Avery Pennarun
2008-05-06 23:47 ` Roman Shaposhnik
2008-05-07 16:14 ` Avery Pennarun
2008-05-08 1:13 ` Ping Yin
2008-05-01 23:29 ` Steven Grimm
2008-05-06 23:17 ` Roman Shaposhnik
2008-05-01 4:56 ` Making submodules easier to work with (auto-update on checkout or merge, stash & restore submodules) Ping Yin
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=EC4DE72E-665B-44C9-A85C-C12C26B00C3A@gmail.com \
--to=timcharper@gmail.com \
--cc=git@vger.kernel.org \
/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).