All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Rose Kunkel <rose@rosekunkel.me>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Rose Kunkel <rose@rosekunkel.me>,
	git@vger.kernel.org
Subject: Re: [BUG] `git reset --hard` fails with `update = none` submodules
Date: Tue, 15 Jun 2021 18:46:23 -0700	[thread overview]
Message-ID: <CAKjYmsEjizYapQVy+pzm9mOxS=0EBwEgzqsO1xO-ct-1AdYuZQ@mail.gmail.com> (raw)
In-Reply-To: <CAKjYmsFVfMW4DKz4cA_fNugGim4m+-aJgOW+k0za+T-D8YHc7g@mail.gmail.com>

Actually, nevermind that last comment. I misunderstood what `git
submodule init` does. I thought it cloned missing submodules, but
apparently that's done by `git submodule update`, so the behavior does
make sense.

On Tue, Jun 15, 2021 at 6:39 PM Rose Kunkel <rose@rosekunkel.me> wrote:
>
> That sounds reasonable to me.
>
> I do think it's pretty unintuitive that `update = none` means that
> submodules never get initialized, even with an explicit `git submodule
> init` command. If this is intended behavior, it should be better
> documented. If not, fixing that would also fix this bug.
>
> On Tue, Jun 15, 2021 at 6:25 PM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> >
> > On 2021-06-16 at 01:03:40, Rose Kunkel wrote:
> > > Potentially relevant: `git config --global --list` shows
> > > ```
> > > status.showstash=true
> > > status.submodulesummary=true
> > > submodule.recurse=true
> >
> > Thanks for this additional information.  This line is the critical
> > piece.  Now I get this:
> >
> >   $ git reset --hard
> >   fatal: not a git repository: ../../.git/modules/repos/agda
> >   fatal: could not reset submodule index
> >
> > Predictably, "git -c submodules.recurse=true reset --hard" also results
> > in the same thing.
> >
> > The --recurse-submodules option for git reset says this (emphasis mine):
> >
> >   When the working tree is updated, using --recurse-submodules will also
> >   recursively reset the working tree of all *active* submodules
> >   according to the commit recorded in the superproject, also setting the
> >   submodules' HEAD to be detached at that commit.
> >
> > On my system, .git/config has this:
> >
> >   [submodule]
> >           active = .
> >
> > So these submodules are active, but they probably should not be, since
> > we haven't checked anything out (or, for that matter, cloned any data)
> > and it wouldn't make sense to try to operate on them automatically with
> > submodules.recurse or --recurse-submodules.
> >
> > My gut tells me that we should probably mark submodules with update=none
> > set on a clone as inactive.  Of course, this is a tricky area that I'm
> > not super familiar with, so opinions or thoughts are welcome.
> >
> > If folks think this is a good way forward, I'll look into writing a
> > patch, probably tomorrow evening since it's starting to get late here.
> > --
> > brian m. carlson (he/him or they/them)
> > Toronto, Ontario, CA

  reply	other threads:[~2021-06-16  1:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16  0:16 [BUG] `git reset --hard` fails with `update = none` submodules Rose Kunkel
2021-06-16  0:51 ` brian m. carlson
2021-06-16  0:57   ` Rose Kunkel
2021-06-16  1:03     ` Rose Kunkel
2021-06-16  1:15       ` Rose Kunkel
2021-06-16  1:25       ` brian m. carlson
2021-06-16  1:39         ` Rose Kunkel
2021-06-16  1:46           ` Rose Kunkel [this message]
2021-06-16  3:10         ` Junio C Hamano
2021-06-16 13:20           ` Philippe Blain
2021-06-17 23:52             ` brian m. carlson
2021-06-19 21:44               ` [PATCH] submodule: mark submodules with update=none as inactive brian m. carlson
2021-06-22  3:45                 ` Philippe Blain
2021-06-25 23:02                   ` brian m. carlson
2021-06-26 15:12                     ` Philippe Blain
2021-07-01 22:51               ` [PATCH v2] " brian m. carlson
2021-07-09 20:26                 ` Philippe Blain
2021-07-11 16:59                   ` brian m. carlson

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='CAKjYmsEjizYapQVy+pzm9mOxS=0EBwEgzqsO1xO-ct-1AdYuZQ@mail.gmail.com' \
    --to=rose@rosekunkel.me \
    --cc=git@vger.kernel.org \
    --cc=sandals@crustytoothpaste.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.