qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gitmodules: recurse by default


From: Daniel P . Berrangé
Subject: Re: [PATCH] gitmodules: recurse by default
Date: Fri, 7 Oct 2022 11:45:56 +0100
User-agent: Mutt/2.2.7 (2022-08-07)

On Fri, Oct 07, 2022 at 06:11:25AM -0400, Michael S. Tsirkin wrote:
> On Fri, Oct 07, 2022 at 09:07:17AM +0100, Daniel P. Berrangé wrote:
> > On Thu, Oct 06, 2022 at 08:24:01PM -0400, Michael S. Tsirkin wrote:
> > > On Thu, Oct 06, 2022 at 07:54:52PM +0100, Daniel P. Berrangé wrote:
> > > > On Thu, Oct 06, 2022 at 07:39:07AM -0400, Michael S. Tsirkin wrote:
> > > > > The most commmon complaint about submodules is that
> > > > > they don't follow when one switches branches in the
> > > > > main repo. Enable recursing into submodules by default
> > > > > to address that.
> > > > > 
> > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > > ---
> > > > >  .gitmodules | 23 +++++++++++++++++++++++
> > > > >  1 file changed, 23 insertions(+)
> > > > 
> > > > What am I missing, as I tried something equiv to this change
> > > > with one submodule and it didn't appear to have any effect.
> > > > I started from a clean slate:
> > > > 
> > > > $ git submodule  deinit --all --force
> > > > 
> > > > The .gitmodules config has 'recurse = true' for the ui/keycodemapdb
> > > > module:
> > > > 
> > > > $ grep keycodemap --after 1 .gitmodules 
> > > > [submodule "ui/keycodemapdb"]
> > > >         path = ui/keycodemapdb
> > > >         url = https://gitlab.com/qemu-project/keycodemapdb.git
> > > >         recurse = true
> > > > 
> > > > I have a change on master setting the submodule commit:
> > > > 
> > > > $ git show master | grep +Sub
> > > > +Subproject commit 7381b9bfadd31c4c9e9a10b5bb5032f9189d4352
> > > > 
> > > > and check it out:
> > > > 
> > > > $ git submodule update --init ui/keycodemapdb
> > > > Submodule 'ui/keycodemapdb' 
> > > > (https://gitlab.com/qemu-project/keycodemapdb.git) registered for path 
> > > > 'ui/keycodemapdb'
> > > > Submodule path 'ui/keycodemapdb': checked out 
> > > > '7381b9bfadd31c4c9e9a10b5bb5032f9189d4352'
> > > > 
> > > > 
> > > > In another branch I have a different commit:
> > > > 
> > > > $ git show sub-foo  | grep +Sub
> > > > +Subproject commit 57ba70da5312170883a3d622cd2aa3fd0e2ec7ae
> > > > 
> > > > 
> > > > Now I switch branches and nothing happens, the submodule
> > > > is marked as dirty:
> > > > 
> > > > $ git checkout sub-foo
> > > > M       ui/keycodemapdb
> > > > Switched to branch 'sub-foo'
> > > > 
> > > > $ (cd ui/keycodemapdb && git show | head -1)
> > > > commit 7381b9bfadd31c4c9e9a10b5bb5032f9189d4352
> > > > 
> > > > 
> > > > >From your description (and indeed that of the man page) it
> > > > sounded like ui/keycodemapdb should have got updated to
> > > > commit 57ba70da5312170883a3d622cd2aa3fd0e2ec7ae when I did
> > > > 'git checkout', but that didn't happen
> > > 
> > > I think .gitmodules got overwritten when you checked out the branch.
> > > Possible?
> > 
> > No, it the same in both branches, since they share a common
> > ancestor commit which added the recurse tag
> > 
> > $ git checkout master
> > Switched to branch 'master'
> > $ git grep keycodemapdb --after 1 .gitmodules 
> > [submodule "ui/keycodemapdb"]
> >     path = ui/keycodemapdb
> >     url = https://gitlab.com/qemu-project/keycodemapdb.git
> >     recurse = true
> > $ git checkout sub-foo 
> > M   ui/keycodemapdb
> > Switched to branch 'sub-foo'
> > $ grep keycodemapdb --after 1 .gitmodules 
> > [submodule "ui/keycodemapdb"]
> >     path = ui/keycodemapdb
> >     url = https://gitlab.com/qemu-project/keycodemapdb.git
> >     recurse = true
> > 
> 
> I just retested and it's not working for me either :(
> I was sure it worked but I guess the testing wasn't done properly.
> Back to the drawing board sorry.

I think the problem is that this setting doesn't apply in the context
of .gitmodules. Various commands take a '--recurse-submodules' parameter,
and like many params this can be set in the .git/config file. The
problem is .git/config isn't a file we can influence automatically,
it is upto the dev to set things for every clone they do :-(

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]