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

Re: Questions about repo and git submodule

From
Shawn O. Pearce <spearce@spearce.org>
Date
Dec 23, 2008, 15:29 UTC
Message-ID
<20081223152951.GB27865@spearce.org>
In-Reply-To
<856bfe0e0812230601m1765b483pe62c7902849e9cea@mail.gmail.com>
Emily Ren <lingyan.ren@gmail.com> wrote:
Show 8 quoted lines
> 
> I have some questions about android repo and git submodule.
> 
> I created a repo repository with below commands:
> 1.  repo init -u git://android.git.kernel.org/platform/manifest.git
> 2.  repo initialized in /android
> 
> 1. The android dir is not a git repository,

Correct, it is not a git repository. The repo tool does not use git submodules. The top level of a repo client has a ".repo/" directory with metadata, not a ".git/" directory. The table of contents (the subprojects) is stored in XML files under ".repo/".

<aside> I actually fought against the XML format for repo's manifest, but others felt it was suitable. And then walked away from the project after Android open-sourced its code tree. Leaving me to maintain it. I see a file format simplification in the future for repo. </aside>

> if other people clone my
> android code, how does it work?

Sadly this isn't supported correctly. You can't initialize one repo client from another, even though you can git clone one git repository from any other. Its a bug in repo's design. The data under ".repo/projects/" isn't laid out correctly to permit reuse of one repo client to initialize another.

Its something I keep meaning to fix, but its going to take some real effort.

In the mean time, there is a "--mirror" flag to repo init which can be used to clone everything into bare repositories. Those bare repositories can be published for others to repo init from, though you need to customize the manifest.git:default.xml so that the embedded URL refers back to your server and not android.git.kernel.org. Yet another thing I want to fix.

> 2. I want to make android dir to be a git repository, is it workable
> that I create submodule for each subdirectory in another directory? Is
> there a script for it?
You might be able to do something like this:
	cd /android
	git init
	repo forall -c 'cd /android && git submodule add `pwd`'

Also, you might want to consider asking questions related to repo on the repo-discuss@googlegroups.com mailing list. There's a lot more repo users there than on the git mailing list, and they have started to come up with their own "tips n tricks".

-- 
Shawn.
Previous: Emily RenNext: Emily Ren
Message 2 of 4 in “Questions about repo and git submodule”
  1. Emily RenDec 23, 2008
  2. Shawn O. PearceDec 23, 2008
  3. Emily RenDec 25, 2008
  4. Shawn O. PearceDec 27, 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.