Re: [PATCH 2/6] git rm: Support for removing submodules
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 12, 2008, 22:42 UTC
- Message-ID
- <7vk5dhm1e9.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20080912222429.GE10360@machine.or.cz>
Petr Baudis <pasky@suse.cz> writes:
Show 13 quoted lines
>> >> +{
>> >> + char *key = submodule_by_path(name);
>> >> + char *sectend = strrchr(key, '.');
>> >> +
>> >> + assert(sectend);
>> >> + *sectend = 0;
>> >
>> > Here is one caller I questioned in my comments on [1/6]...
>>
>> Another thing --- can submodule_by_path() ever return NULL saying "I do
>> not see one in the configuration"?
>
> No, it would rather die().Hmmmm. If I did...
$ git init
$ create and add normal paths
$ git clone git://..../gitk.git gitk
$ git add gitk
: heh, I changed my mind
$ git rm gitkthe last step would die, because I changed my mind before fully initializing gitk repository as a proper submodule?
How would I get rid of the index entry to recover from the mistake?
$ rm -fr gitk
$ git rm gitkwould presumably fail the same way, no? I hope I am misreading the code...
We need to be extremely careful not to break people who do not (yet) have [submodule "xyzzy"] entries in config and/or .gitmodules when dealing with the gitlink entries in the index.