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

Re: Possible submodule or submodule documentation issue

From
BZBill Zaumen <bill.zaumen+git@gmail.com>
Date
Dec 29, 2011, 02:50 UTC
Message-ID
<1325127030.1681.35.camel@yos>
In-Reply-To
<4EFB725C.7030600@web.de>
On Wed, 2011-12-28 at 20:47 +0100, Jens Lehmann wrote:
Show 7 quoted lines
> Am 27.12.2011 20:24, schrieb Bill Zaumen:
> > For the 'add' command, the man page for get-submodule states
> > 
> > "<repository> is the URL of the new submodule’s origin repository. This
> > may be either an absolute URL, or (if it begins with ./ or ../), the
> > location relative to the superproject’s origin repository."
> >
...
> I assume you did forget to add a "cd library-pkg" here.
Yes, sorry for miscopying.
Show 5 quoted lines
> 
> Hmm, the documentation says "the location relative to the
> superproject’s origin repository", not the directory containing
> it. This means you have to use ".." first to get out of the
> repository itself, no?

The problem is that the documentation also says that "<repository> is the URL of the new submodule's origin repository" and the wording would not make sense if the superproject's origin repository was not also named by a URL. The rules for resolving relative URIs (a URL is a specific type of URI) are given in http://tools.ietf.org/html/rfc3986#section-5.4 which has some examples: if you resolve ./g against http://a/b/c/d;p?q you get http://a/b/c/g (the rules are purely syntactic and the syntax does not indicate that ".../foo.git" is a directory, and even the slashes do not definitively indicate directories in the sense of a file-system directory although they often do). Also, I've enclosed a Java program illustrating the correct behavior (a method in the Java class library can resolve URIs so this is an independent test).

import java.net.*;
public class Test {
    public static void main(String argv[]) {
	try {
	    URI base = new URI("file:///home/USER/Projects/test/repo.git");
	    URI relative = new URI("./submodule.git");
	    URI absolute = base.resolve(relative);
	    System.out.println(relative.toString() + " -> "
			       +absolute.toString());
	    relative = new URI("../submodule.git");
	    absolute = base.resolve(relative);
	    System.out.println(relative.toString() + " -> "
			       +absolute.toString());
	} catch (Exception e) {
	    e.printStackTrace();
	    System.exit(1);
	}
	System.exit(0);
    }
}
Previous: Jens LehmannNext: Jens Lehmann
Message 3 of 6 in “Possible submodule or submodule documentation issue”
  1. Bill ZaumenDec 27, 2011
  2. Jens LehmannDec 28, 2011
  3. Bill ZaumenDec 29, 2011
  4. Jens LehmannJan 1, 2012
  5. Bill ZaumenJan 2, 2012
  6. Junio C HamanoJan 3, 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.