harishchoragudi / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 0 forks source link

git-repo bug on branch.<name>.remote = . #149

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

In a git repository managed through repo, I've set a local branch tracking 
another local branch (instead of a remote branch, which is the default):

  $ cd <subproject>

  $ git checkout -t -b tracking-master master
or
  $ git checkout -b tracking-master master
  $ git branch --set-upstream-to master

This add the following in .git/config:

  [branch "tracking-master"]
          remote = .
          merge = refs/heads/master

It's documented in git-config(1), http://git-scm.com/docs/git-config :

  branch.<name>.merge::

  If you wish to setup git pull so that it merges into <name> from another branch in 
  the local repository, you can point branch.<name>.merge to the desired branch, and 
  use the special setting . (a period) for branch.<name>.remote.

Once the local tracking branch is set up, repo fails to produce overview:

$ repo overview
Traceback (most recent call last):
  File "/home/ydroneaud/src/project/.repo/repo/main.py", line 414, in <module>
    _Main(sys.argv[1:])
  File "/home/ydroneaud/src/project/.repo/repo/main.py", line 390, in _Main
    result = repo._Run(argv) or 0
  File "/home/ydroneaud/src/project/.repo/repo/main.py", line 138, in _Run
    result = cmd.Execute(copts, cargs)
  File "/home/ydroneaud/src/project/.repo/repo/subcmds/overview.py", line 45, in Execute
    for x in project.GetBranches().keys()]
  File "/home/ydroneaud/src/project/.repo/repo/project.py", line 891, in GetUploadableBranch
    base = branch.LocalMerge
  File "/home/ydroneaud/src/project/.repo/repo/git_config.py", line 690, in LocalMerge
    return self.remote.ToLocal(self.merge)
  File "/home/ydroneaud/src/project/.repo/repo/git_config.py", line 635, in ToLocal
    raise GitError('remote %s does not have %s' % (self.name, rev))
error.GitError: remote . does not have refs/heads/master

$ repo info -o
Manifest branch: master
Manifest merge branch: refs/heads/master
----------------------------
Traceback (most recent call last):
  File "/home/ydroneaud/src/project/.repo/repo/main.py", line 414, in <module>
    _Main(sys.argv[1:])
  File "/home/ydroneaud/src/project/.repo/repo/main.py", line 390, in _Main
    result = repo._Run(argv) or 0
  File "/home/ydroneaud/src/project/.repo/repo/main.py", line 138, in _Run
    result = cmd.Execute(copts, cargs)
  File "/home/ydroneaud/src/project/.repo/repo/subcmds/info.py", line 70, in Execute
    self.printCommitOverview(args)
  File "/home/ydroneaud/src/project/.repo/repo/subcmds/info.py", line 160, in printCommitOverview
    for x in project.GetBranches().keys()]
  File "/home/ydroneaud/src/project/.repo/repo/project.py", line 891, in GetUploadableBranch
    base = branch.LocalMerge
  File "/home/ydroneaud/src/project/.repo/repo/git_config.py", line 690, in LocalMerge
    return self.remote.ToLocal(self.merge)
  File "/home/ydroneaud/src/project/.repo/repo/git_config.py", line 635, in ToLocal
    raise GitError('remote %s does not have %s' % (self.name, rev))
error.GitError: remote . does not have refs/heads/master

Original issue reported on code.google.com by yann@droneaud.fr on 12 Sep 2013 at 7:57

GoogleCodeExporter commented 8 years ago
Please find a patch with one proposed way to fix the problem.

Original comment by yann@droneaud.fr on 12 Sep 2013 at 8:58

Attachments:

GoogleCodeExporter commented 8 years ago
Please find a patch with another proposed way to fix the problem.

Original comment by yann@droneaud.fr on 12 Sep 2013 at 8:59

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by cco3@android.com on 9 Mar 2015 at 6:14

GoogleCodeExporter commented 8 years ago
https://gerrit-review.googlesource.com/#/c/65870/

Original comment by cco3@android.com on 9 Mar 2015 at 6:14