All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>,
	Brandon Williams <bmwill@google.com>,
	David Turner <David.Turner@twosigma.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Johannes Sixt <j6t@kdbg.org>
Subject: Re: [PATCHv5 4/4] rm: absorb a submodules git dir before deletion
Date: Tue, 27 Dec 2016 13:55:32 -0800	[thread overview]
Message-ID: <xmqqeg0t6nqj.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAGZ79kZLk2bNj2Z_PFfo9KzODn8nSihDLdLuKvpSPodR9Eg-4w@mail.gmail.com> (Stefan Beller's message of "Tue, 27 Dec 2016 10:26:37 -0800")

Stefan Beller <sbeller@google.com> writes:

>>>> @@ -358,9 +331,6 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
>>>>                       oidclr(&oid);
>>>>               if (check_local_mod(&oid, index_only))
>>>>                       exit(1);
>>>> -     } else if (!index_only) {
>>>> -             if (check_submodules_use_gitfiles())
>>>> -                     exit(1);
>>>>       }
>>>>
>>>
>>> Hmph.  It may be a bit strange to see an "index-only" remove to
>>> touch working tree, no?  Yet submodules_absorb_gitdir_if_needed() is
>>> unconditionally called above, which feels somewhat unexpected.
>> ...
> Well scratch that.
> is_staging_gitmodules_ok only checks for the .gitmodules file and not
> for the submodule itself (the submodule is not an argument to that function)
>
> The actual answer is found in check_local_mod called via
>
>     if (!force) {
>         struct object_id oid;
>         if (get_oid("HEAD", &oid))
>             oidclr(&oid);
>         if (check_local_mod(&oid, index_only))
>             exit(1);
>     }

OK, that happens way before this loop starts finding submodules and
removing them, so we can say that the latter is well protected.

Thanks.

      reply	other threads:[~2016-12-27 21:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 23:20 [PATCHv5 0/4] git-rm absorbs submodule git directory before deletion Stefan Beller
2016-12-20 23:20 ` [PATCHv5 1/4] submodule.h: add extern keyword to functions Stefan Beller
2016-12-27  1:13   ` Junio C Hamano
2016-12-27 17:59     ` Stefan Beller
2016-12-20 23:20 ` [PATCHv5 2/4] submodule: modernize ok_to_remove_submodule to use argv_array Stefan Beller
2016-12-20 23:20 ` [PATCHv5 3/4] submodule: rename and add flags to ok_to_remove_submodule Stefan Beller
2016-12-27  0:53   ` Junio C Hamano
2016-12-27 17:55     ` Stefan Beller
2016-12-20 23:20 ` [PATCHv5 4/4] rm: absorb a submodules git dir before deletion Stefan Beller
2016-12-27  1:10   ` Junio C Hamano
2016-12-27 18:17     ` Stefan Beller
2016-12-27 18:26       ` Stefan Beller
2016-12-27 21:55         ` Junio C Hamano [this message]

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=xmqqeg0t6nqj.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=David.Turner@twosigma.com \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=sandals@crustytoothpaste.net \
    --cc=sbeller@google.com \
    /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.