Repo Not on a Branch

2,572 views
Skip to first unread message

Charlie M

unread,
Dec 27, 2008, 12:03:55 PM12/27/08
to Repo and Gerrit Discussion
Hi all,

I am very new to repo, so this may be a deliberate feature, a bug or
just some problem caused by my config. I have been trying to use repo
with my own project which consists of several different git repos. Its
actually the source to a few client server apps so as you can imagine
much of the projects code is shared between each app hence why it
needs to be in separated in to separate repos.

I have noticed that after running repo sync all appears to have worked
fine but if I go into one of the working directories and do git branch
its not on the specified branch. Shouldn't repo do something other
than leaving the working space on no local branch? After all there are
files already in the working directory so they must belong to some
branch? Is this is what's supposed to happen?

Blow is an example of the output during the initial repo sync:
From ssh://example.org/repo
* [new branch] master -> vault/master

After the projects synced:
git branch
* (no branch)

So I end up having to do:

git branch master
git checkout master

Below is an example of one of the manifest files.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="vault" fetch="ssh://example.org/repo/" />
<default revision="master" remote="vault"/>
<project path="manifest" name="controlnode/manifest"
revision="master" />

<project path="source" name="controlnode/source" revision="master" />

<project path="shared/kernel" name="kernel/source" revision="master" /
>
<project path="shared/platformprotocol" name="platformprotocol/
source" revision="master" />
<project path="shared/security" name="security/source"
revision="master" />
<project path="shared/utilities" name="utilities/source"
revision="master" />
</manifest>

Charlie M

Shawn Pearce

unread,
Dec 27, 2008, 12:21:47 PM12/27/08
to repo-d...@googlegroups.com
This is intended behavior.

During "repo sync" the sync task tries to make the different projects match up to the manifest.  It checks out the revision on a detached head, which "git branch" reports as "(no branch)".  This is done to prevent repo from attempting to use a branch name that you yourself also wanted to use for development work.

You should be using "git checkout --track -b master vault/master" to create and switch to a new branch called "master" in a project before working on it.  Or use "repo start master [projname...]".  Without the --track and vault/master options being passed in the necessary branch.$name.remote and branch.$name.merge values aren't written into .git/config, so "repo sync" can't figure out if the current branch matches with the revision listed in the manifest XML.  (These options also configure stock "git pull" (with no arguments) to fetch and merge vault/master when on that branch.)
Reply all
Reply to author
Forward
0 new messages