git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 gitk

the 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 gitk

would 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.

Previous: Petr BaudisNext: Petr Baudis
Message 10 of 18 in “Submodule support for git mv and git rm”
  1. 0/6 Submodule support for git mv and git rmPetr Baudis, Sep 12, 2008
  2. 1/6 submodule.*: Introduce simple C interface for submodule lookup by pathPetr Baudis, Sep 12, 2008
  3. Junio C HamanoSep 12, 2008
  4. Jakub NarebskiSep 12, 2008
  5. Petr BaudisSep 12, 2008
  6. 2/6 git rm: Support for removing submodulesPetr Baudis, Sep 12, 2008
  7. Junio C HamanoSep 12, 2008
  8. Junio C HamanoSep 12, 2008
  9. Petr BaudisSep 12, 2008
  10. Junio C HamanoSep 12, 2008
  11. 3/6 git mv: Support moving submodulesPetr Baudis, Sep 12, 2008
  12. git mv: Support moving submodulesPetr Baudis, Sep 12, 2008
  13. Junio C HamanoSep 12, 2008
  14. 4/6 t7403: Submodule git mv, git rm testsuitePetr Baudis, Sep 12, 2008
  15. 5/6 t7400: Add short "git submodule add" testsuitePetr Baudis, Sep 12, 2008
  16. 6/6 git submodule add: Fix naming clash handlingPetr Baudis, Sep 12, 2008
  17. Junio C HamanoSep 13, 2008
  18. Lars HjemliSep 13, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.