Not able to checkout particular branch when the branch is available in the remote repository.

1,082 views
Skip to first unread message

Raf

unread,
May 16, 2013, 2:48:23 AM5/16/13
to repo-d...@googlegroups.com
Hi,

After repo init and repo sync, I am not able to checkout a remote branch it shows an message: "error: pathspec 'branchA' did not match any file(s) known to git".

I am thinking it might be due to my setup for my local AOSP mirror.  Can someone advise if I have done anything wrong?

Here is what I do:
1/ update the manifest file to add the line:
  <remote fetch="ssh://gitserver1/data1/repo/aosp_mirror" name="origin" review="gitserver1"/>
  <default remote="origin" revision="branchA"/>

As all the projects I have created a branch branchA, I've set the revision to branchA


2/  Repo init
$repo init -u ssh://gitserver1/data1/repo/aosp_mirror/platform/manifest.git -b branchA
As you can see that I have created a same name branch, branchA, in the /platform/manifest.git repo.

3/ Repo Sync
$repo sync -j4

4/ Go to kernel and tries to checkout branchA
$cd kernel
$git checkout branchA
error: pathspec 'branchA' did not match any file(s) known to git.

Then, I go and check the list of branches available
$ git branch -a
remotes/m/branchA -> origin/branchA
...
...
remotes/origin/branchA

So it is obvious the branch is there, but why am I unable to checkout the branch?

Is it due to the manifest repo branch name is the same as the revision in all the projects?

Should I change the manifest repo branch name to another name?

Kindly advise.

Thanks in advance!

Pursehouse, David (Sony Mobile)

unread,
May 16, 2013, 2:59:19 AM5/16/13
to Raf, repo-d...@googlegroups.com
> $cd kernel
> $git checkout branchA
> error: pathspec 'branchA' did not match any file(s) known to git.

What is the output of `git branch -r`?

Does it work if you do `git checkout origin/branchA`?

Magnus Bäck

unread,
May 16, 2013, 9:59:13 AM5/16/13
to repo-d...@googlegroups.com
On Thursday, May 16, 2013 at 02:48 EDT,
Raf <rafeah....@gmail.com> wrote:

[...]

> 3/ Repo Sync
> $repo sync -j4

If you specify the sync-j attribute to the 'default' element in the
manifest you don't have to specify that option manually. See how it's
done in the original AOSP manifest.

> 4/ Go to kernel and tries to checkout branchA
> $cd kernel
> $git checkout branchA
> error: pathspec 'branchA' did not match any file(s) known to git.
>
> Then, I go and check the list of branches available
> $ git branch -a
> remotes/m/branchA -> origin/branchA
> ...
> ...
> remotes/origin/branchA
>
> So it is obvious the branch is there, but why am I unable to checkout the
> branch?

Normally, when saying

git checkout foo

Git wouldn't search refs/remotes/origin to find the foo ref, but Git
1.6.6 introduced a do-what-I-mean patch (commit 70c9ac2, documented in
commit 00bb437) that made the command above a shortcut for

git checkout -b foo --track <remote>/foo

if there's no local ref with this name and only a single remote with
this ref. But, in your case there are two remotes with this ref as a
leaf, refs/remotes/m/branchA and refs/remotes/origin/branchA, so Git
forces you to be explicit.

In addition to this, your Git might be older than 1.6.6. Repo would've
died on you since it requires 1.7.2, but perhaps you still run an older
version of the 'repo' wrapper script? What does

grep 'VERSION = ' $(which repo)

tell you? Prior to Repo 1.19, released around Jan 3 this year, Repo
only required Git 1.5.4.

The exact rules for Git's ref matching logic can be found in
git-checkout(1) under SPECIFYING REVISIONS.

What did you hope to accomplish with this command? If the manifest lists
branchA for the kernel git then you already have the tip of that branch
checked out after a sync. It makes sense if you want a local branch to
work on (assuming you want to take advantage of Git's do-what-I-mean
feature), but there's also 'repo start' to start local topic branches.

> Is it due to the manifest repo branch name is the same as the revision
> in all the projects?

Yes, sort of. If those names match then checkout's do-what-I-mean is
effectively disabled.

> Should I change the manifest repo branch name to another name?

No, no need for that.

--
Magnus Bäck
ba...@google.com
Reply all
Reply to author
Forward
0 new messages