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

Re: git commit/push can fail silently when clone omits ".git"

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Nov 9, 2012, 18:42 UTC
Message-ID
<20121109184225.GA1190@book.hvoigt.net>
In-Reply-To
<20121108185643.GN15560@sigill.intra.peff.net>
Hi,
On Thu, Nov 08, 2012 at 01:56:43PM -0500, Jeff King wrote:
Show 7 quoted lines
> Unfortunately, the patch below which does that seems to make t7407 very
> unhappy. It looks like the submodule test uses "git clone ." and
> "git-submodule add" expects the "/." to still be at the end of the
> configured URL when processing relative submodule paths. I'm not sure if
> that is important, or an unnecessary brittleness in the submodule code.
> 
> Jens, Heiko?

After some analysis it seems to me that the test deviates from the expected behavior. For relative urls we have documented that if we have a remote in the superproject a relative submodule path is relative to that remotes url.

In the test super has been cloned from ".". So the tests root directory should be the directory the submodule path is relative to. That would be ./submodule (since submodule is also in the root directory) and not ../submodule.

Before your patch a "/." was added to the origin of super and "/." is currently counted as a path component.

So we have another corner case here: When your superproject was cloned from "." the urls you currently have to specify with submodule add are wrong (one ".." to much).

Since this is a change in behaviour I would like to further think about the implications this brings if we fix this. Not sure how many people clone from ".". The correct behavior (as documented) is the one you introduce with your patch. If we decide to fix this we should also correct the path calculation in git-submodule.sh.

Cheers Heiko
Previous: Jeff KingNext: Heiko Voigt
Message 3 of 7 in “git commit/push can fail silently when clone omits ".git"”
  1. Jeffrey S. HaemerNov 4, 2012
  2. Jeff KingNov 8, 2012
  3. Heiko VoigtNov 9, 2012
  4. 0/3 fix cloning superprojects from "."Heiko Voigt, Nov 13, 2012
  5. 1/3 Fix relative submodule setup of submodule testsHeiko Voigt, Nov 13, 2012
  6. 2/3 ensure that relative submodule url needs ./ or ../Heiko Voigt, Nov 13, 2012
  7. 3/3 fix corner case for relative submodule path calculationHeiko Voigt, Nov 13, 2012

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.