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

Re: [RFC/PATCH] Disallow commands from within unpopulated submodules.

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 20, 2017, 21:58 UTC
Message-ID
<xmqqy3y5wg0l.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqq37gdxvbx.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
> Jeff King <peff@peff.net> writes:
>
>>> And in my current understanding of submodules the check in
>>> .gitmodules ought to be enough, too.
>>
>> Yeah, that probably makes sense. You can have a gitlink without a
>> .gitmodules file, but I don't quite know what that would mean in terms
>> of submodules (I guess it's not a submodule but "something else").
>
> That may be a lot better than reading the index unconditionally, but
> I'd rather not to see "git rev-parse" read ".gitmodules" at all.  It
> would discourage scripted use of Git for no good reason.
Thinking about this more, I suspect that
	cd sub && git anything

when the index of the top-level thinks "sub" must be a submodule and the user is not interested in "sub" (hence it hasn't gone through "git submodule init" or "update") should get the same error as you would get if you did

	cd /var/tmp/ && git anything

when none of /, /var, /var/tmp/ is controlled by any Git repository. I.e. "fatal: Not a git repository".

Perhaps we can update two things and make it cheap.
 - checking out the top-level working tree without populating the
   working tree of a submodule learns to do a bit more than just
   creating an empty directory.  Instead, it creates the third kind
   of ".git" (we currently support two kinds of ".git", one that is
   a repository itself, and another that is points at a repository),
   that tells us that there is not (yet) a repository there.
 - the "discovering the root of the working tree" logic learns to
   notice the third kind of ".git" and stop with "Not a git
   repository".
Previous: Jeff KingNext: Jeff King
Message 10 of 13 in “Disallow commands from within unpopulated submodules.”
  1. Disallow commands from within unpopulated submodules.Stefan Beller, Jan 19, 2017
  2. Jeff KingJan 20, 2017
  3. Stefan BellerJan 20, 2017
  4. Jeff KingJan 20, 2017
  5. Stefan BellerJan 20, 2017
  6. Jeff KingJan 20, 2017
  7. Stefan BellerJan 20, 2017
  8. Junio C HamanoJan 20, 2017
  9. Jeff KingJan 20, 2017
  10. Junio C HamanoJan 20, 2017
  11. Jeff KingJan 20, 2017
  12. Stefan BellerJan 20, 2017
  13. Duy NguyenJan 21, 2017

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.