Is' there any "git worktree" like command when I hope to use other xml as manifest?

327 views
Skip to first unread message

First Love

unread,
Nov 30, 2021, 2:35:02 AM11/30/21
to Repo and Gerrit Discussion
Hi, all

I have two manifests, A and B. Some projects exist only in A or only in B, some projets exist in both A and B. git init -m A then git init -m B in different directories is a choice, but not the best, because it waste many disk space for these projects which exist in both A and B.

git have a command named "git worktree", it can make different branches stay in different directories, but share the same git object dir.

I wonder does repo have function like this to share git object dir between A and B?

Regards,
Li

Mike Frysinger

unread,
Nov 30, 2021, 1:52:51 PM11/30/21
to Repo and Gerrit Discussion
you can do one way sharing with `repo init --reference ...`

otherwise, you could create a manifest that includes manifest A & manifest B, then do a --mirror of that, and then have your checkouts use that mirror as a --reference.  then when syncing, always sync the mirror checkout first.
-mike

First Love

unread,
Dec 1, 2021, 9:53:11 PM12/1/21
to Repo and Gerrit Discussion
Thanks, from the manual:
> The --reference option can be used to point to a directory that has the
content of a --mirror sync. This will make the working directory use as
much data as possible from the local reference directory when fetching
from the server. This will make the sync go a lot faster by reducing
data traffic on the network.

IIUC, I should do something like:
1. dir1: repo init -m A --mirror
2. dir2: repo init -m B --reference dir1


Is it right?

Regards,
Li
Reply all
Reply to author
Forward
0 new messages