Thread (1 message) 1 message, 1 author, 2016-09-16

Re: [wishlist?] make submodule commands robust to having non-submodule Subprojects

From: Junio C Hamano <hidden>
Date: 2016-09-16 18:29:00

Heiko Voigt [off-list ref] writes:
On Thu, Sep 15, 2016 at 11:27:54AM -0700, Junio C Hamano wrote:
quoted
If the trend in Git community collectively these days is to make
usage of submodules easier and smoother, I'd imagine that you would
want to teach "git add" that was given a submodule to "git submodule
add" instead by default, with an option "git add --no-gitmodules
sub" to disable it, or something like that.
quoted
         $ git submodule add --fixup-modules-file ./sub sub
         Adding .gitmodule entry only for `sub` to use `git -C remote
show origin` as URL.
I agree that a feature like this is needed regardless of what
happens at "git add" time.
How about just

   git submodule add <submodulepath>
When I said "a feature like this is needed", I didn't care about
exact syntax.  I am not sure how often people need the "fixup", what
kind of causes there are that they need the "fixup", and what the
distribution of vaious causes would be like.  If the _ONLY_ kind of
fixup necessary is "I meant to say 'git submodule add ./path path'
but I said 'git add path' instead", then I think it makes sense to
teach "submodule add" that the form "git submodule add <path>" is a
short-pand for "git submodule add ./<path> <path>".  I am not sure
if we want to _ignore_ a gitlink that is already in the index
unconditionally, i.e. if it is a good idea to let the second one
override the first one

	git submodule add $URL sub &&
        git submodule add sub

in this sequence, though.
? I remember back in the days when I started with submodules thats the
way I imagined submodules would work:

1. clone the submodule into a directory
2. git submodule add it
3. git commit everything

Because that how you basically work with files.  So instead of adding
another option I would rather like to autodetect that:

 * its a relative path inside this repo that is passed to
   'git submodule add'
 * there is no .gitmodules entry
 * and no .git/config
==> create those from a remote in the submodule
In other words, I agree with the general direction but I'd add
another condition to the above three, i.e.

   * and there is no gitlink for that path in the index yet.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help