lmi
[Top][All Lists]
Advanced

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

Re: [lmi] "Subproject commit"


From: Vadim Zeitlin
Subject: Re: [lmi] "Subproject commit"
Date: Sat, 23 Oct 2021 15:04:19 +0200

On Fri, 22 Oct 2021 23:38:04 +0000 Greg Chicares <gchicares@sbcglobal.net> 
wrote:

GC> I'm almost ready to push your PR 193 changes, but now that
GC> I've cherry-picked them all, git-diff reports:
GC> 
GC> diff --git a/third_party/wx b/third_party/wx
GC> index efd7bf881..c9486f9ce 160000
GC> --- a/third_party/wx
GC> +++ b/third_party/wx
GC> @@ -1 +1 @@
GC> -Subproject commit efd7bf881e9b5fceca6ceaf1edba072a56de971b
GC> +Subproject commit c9486f9cebb2843fdd3cb3e6433045644c456e38

 This is indeed the same problem as before, i.e. git-cherry-pick didn't
update the submodule, as it would have done with any normal file, because
submodules are not updated automatically by default.

GC> In the older one, the quotation at the top of this email shows what
GC> git-status reports. I don't want to rebuild wx in this chroot yet,
GC> but I need git-diff to be clean so that I can't accidentally commit
GC> something wrong.

 FWIW in this particular case git-diff showing this diff can be ignored.

GC> I know I did the wrong thing last time, so...

 Last time you did "git add third_party/wx", and this is about the only
thing you should _not_ do.

GC> >  One of the confusing things about git submodules is that they, unlike
GC> > normal files, are not updated automatically. This makes sense because
GC> > updating a submodule is much, much more expensive than updating a single
GC> > file, so you wouldn't want this to happen automatically when using many
GC> > and/or big submodules (and wx is big enough already), but, again, it is
GC> > confusing.
GC> > 
GC> >  Instead you need to update the submodules manually whenever they are
GC> > modified by a commit not done by you (if you had committed the submodule
GC> > yourself, it is already at the right version). This is done using
GC> > "git submodule update third_party/wx" command or, if you want to save on
GC> > typing, just "git submodule update", which updates all submodules.
GC> 
GC> Okay, that's what I'll do when I'm ready. Tonight, though, I just
GC> want to get rid of the change that git-diff reports, so...

 To get rid of this change you need to do "git submodule update". Or you
can just ignore it if you really don't want to change wxWidgets now. OTOH
the change to wx is pretty small, so if you build it again without
rebuilding everything (i.e. with wx_skip_clean=1), it wouldn't take long at
all to do it.

GC> Should I now do:
GC>   git checkout -- third_party/wx
GC> ?

 This won't work for submodules, they are ignored by git-checkout (which is
just another way of saying that they're not updated by git by default).

GC> And later, when I do
GC>   git submodule update third_party/wx
GC> will that just DTRT?

 You have to do this, if you absolutely want to not have any diffs.

 Sorry, but there is no other way: either you update the submodule or you
don't, and if you don't, you're going to have a diff for it because the
commit you had cherry-picked did update it, so your local version now
differs from it.

 Please let me know if you have any questions,
VZ

Attachment: pgpoPowO3zBXs.pgp
Description: PGP signature


reply via email to

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