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

Re: git clone submodules recursive and reference

From
Jens Lehmann <jens.lehmann@web.de>
Date
Apr 23, 2012, 21:20 UTC
Message-ID
<4F95C786.40901@web.de>
In-Reply-To
<CAFj+z05G_LLLc=OqZiqKCJPpTZ21Y4W6HTJ6ZitraVZXEQ50-A@mail.gmail.com>
Am 23.04.2012 10:06, schrieb Samuel Maftoul:
Show 10 quoted lines
>>> I'm sharing objects between repositories by creating a bare
>>> repository, adding the remotes for the repositories and fetch them in
>>> this bare repo.
>>
>> This sounds like a cool way to reduce the disk footprint of the
>> repos on our Jenkins server.
> 
> I'm not using --reference for reducing disk footprint, but rather for
> caching git repos and reducing the impact of slow networks !
> Why would it reduce the disk footprint ?

Because the object store of the referenced repo is reused, the cloned .git directory takes up less space (I think that is why the man page talks about "reducing network and local storage costs").

Show 15 quoted lines
>>> So for me, it makes sense to pass the "--reference" to the submodules
>>> clone, if submodules remotes are added to this reference bare repo and
>>> objects are already fetched (and I'm in this case, as I use a lot of
>>> different projects that shares the same set of submodules).
>>
>> How do you fetch then, do you fetch into the referenced repo first
>> and then do a fetch in the clones afterwards to just update the refs
>> there? Or is the bare repo just a starting point for the initial
>> clone?
> 
> You need to fetch first in the bare repo, than in your clones. When
> you use --reference, the reference leaves untouched, it's your job to
> update the reference (would be nice to have options that allows to
> update the reference at the same time that the clone updates, so no
> need to connect twice to the remote repository).

I think you could also just fetch in the cloned repos, but then you'll have to download the objects over the network for each clone and also won't share the new objects. So I think your approach makes lots of sense, now I'll just have to tune our Jenkins scripts a bit. ;-)

Previous: Samuel MaftoulNext: Phil Hord
Message 6 of 7 in “git clone submodules recursive and reference”
  1. Samuel MaftoulApr 20, 2012
  2. Jens LehmannApr 20, 2012
  3. Samuel MaftoulApr 20, 2012
  4. Jens LehmannApr 21, 2012
  5. Samuel MaftoulApr 23, 2012
  6. Jens LehmannApr 23, 2012
  7. Phil HordJun 29, 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.