How to make a repo compatible repository?

169 views
Skip to first unread message

Simon Liu

unread,
Jan 16, 2009, 9:28:20 AM1/16/09
to Repo and Gerrit Discussion
I have some git repository which have some local tags and remote refs
in .git/remotes. Actually, these repository are generated by " repo
init -u git://android.git.kernel.org/platform/manifest.git " and "repo
sync".

Now I want to make these git repositories as a "repo mirror" so others
people can use repo to download them from my machine. How can I make
this?

I tried these steps:
1. use " git clone --bare " to make a copy of these git repositories.
2. make a manifest.git directory with a customize default.xml
3. use git-daemon to host them

And I try to use repo to download them from another machine, like "
repo init -u git://my.machine.com/manifest.git". It's worked.
And when I use " repo sync " to download the code, it report error
like:

Initializing project system/wlan/ti ...
Traceback (most recent call last):
File "/apps/mds_lrt/kfqp84/re/.repo/repo/main.py", line 202, in
<module>
_Main(sys.argv[1:])
File "/apps/mds_lrt/kfqp84/re/.repo/repo/main.py", line 186, in
_Main
repo._Run(argv)
File "/apps/mds_lrt/kfqp84/re/.repo/repo/main.py", line 96, in _Run
cmd.Execute(copts, cargs)
File "/apps/mds_lrt/kfqp84/re/.repo/repo/subcmds/sync.py", line 106,
in Execute
if not project.Sync_LocalHalf():
File "/apps/mds_lrt/kfqp84/re/.repo/repo/project.py", line 607, in
Sync_LocalHalf
self._InitWorkTree()
File "/apps/mds_lrt/kfqp84/re/.repo/repo/project.py", line 1008, in
_InitWorkTree
rev = self.bare_git.rev_parse('%s^0' % rev)
File "/apps/mds_lrt/kfqp84/re/.repo/repo/project.py", line 1191, in
runner
p.stderr))
error.GitError: bionic rev-parse: fatal: ambiguous argument 'refs/
remotes/simon/master^0': unknown revision or path not in the working
tree.
Use '--' to separate paths from revisions

It's seems that it doesn't have these references in /refs/xxx . How
can I make it?

In shortly, how to make a repositories that can use "repo" tool to
manage it?


Thank you!

Regards
Simon Liu

Shawn Pearce

unread,
Jan 16, 2009, 10:17:41 AM1/16/09
to repo-d...@googlegroups.com
On Fri, Jan 16, 2009 at 06:28, Simon Liu <yunta...@gmail.com> wrote:

Now I want to make these git repositories as a "repo mirror" [...]


I tried these steps:
1. use " git clone --bare " to make a copy of these git repositories.
2. make a manifest.git directory with a customize default.xml
3. use git-daemon to host them
...
error.GitError: bionic rev-parse: fatal: ambiguous argument 'refs/
remotes/simon/master^0': unknown revision or path not in the working
tree.
Use '--' to separate paths from revisions

That sounds like the bionic repository is missing a refs/heads/master.  When you run "git branch" inside of the bare bionic.git, do you see master output?  Because that's what repo is looking for here.  The "master" branch is fetched over as "refs/remotes/simon/master" by repo sync, but it wasn't obtained and that's why this error was thrown.
 
In shortly, how to make a repositories that can use "repo" tool to
manage it?

You basically have it, I just think you missed creating a branch in the projects.  Maybe you need to loop through every project and create the 'master' branch.  (repo forall -c git branch master)   You also want to make sure the projects are using master as their default branch (repo forall -c git symbolic-ref HEAD refs/heads/master).  The latter item is less of an issue for repo and more a git compatibility thing, to keep standard Git from getting confused.

Another approach would have been to use "repo init --mirror" to create a mirror structure, then pushed to it from your client (repo forall -c 'git push /my/mirror/$REPO_PROJECT.git HEAD:refs/heads/simon'), then configured your manifest to use revision="simon" (or whatever branch you chose).

lingy...@gmail.com

unread,
Jan 17, 2009, 12:42:51 AM1/17/09
to Repo and Gerrit Discussion
Shawn,

Thank you very much for your guide!

Simon,
I created master branch in all projects in myandroid repo with command
"repo forall -c git branch master". Could you please have a try?

Shawn,
When I run command "repo forall -c git branch master", there's several
error as below.
fatal: A branch named 'master' already exists.
fatal: A branch named 'master' already exists.
fatal: A branch named 'master' already exists.
fatal: A branch named 'master' already exists.

I'm sure that I didn't create master branch before, I meet same issue
when I tried to apply tag for all projects. Do you know what's the
problem?

$ repo forall -c git tag mytag
fatal: tag 'mytag' already exists
fatal: tag 'mytag' already exists
fatal: tag 'mytag' already exists
fatal: tag 'mytag' already exists
fatal: tag 'mytag' already exists

Thanks,
Emily

On Jan 16, 11:17 pm, Shawn Pearce <s...@google.com> wrote:

Shawn Pearce

unread,
Jan 19, 2009, 12:07:41 PM1/19/09
to repo-d...@googlegroups.com
It looks like the name already existed, probably because you had created it already.  I can't think of another reason why it is already present.

Simon Liu

unread,
Jan 19, 2009, 11:24:40 PM1/19/09
to Repo and Gerrit Discussion
Thank you Shawn.

After "git clone --bare", I use "git ls-remote " to get all the
references of the remote repository, and put them to /refs/ in local
cloned repository.
In this step, I replace the refs like refs/remote/xxx/yyy to /refs/
heads/yyy . I see this replacement in your repo tool where deal with
"--mirror" option.

It's finally work now. Is what I did enough?

On 1月16日, 下午11时17分, Shawn Pearce <s...@google.com> wrote:

Shawn Pearce

unread,
Jan 20, 2009, 1:44:20 AM1/20/09
to repo-d...@googlegroups.com
Yes.  But if you are using "git clone" directly, "git clone --mirror" might be easier than "git clone --bare" as it does the replacement like "repo init --mirror" would do.  :-)
Reply all
Reply to author
Forward
0 new messages