Repository URL option causes UnboundLocalError for git repository
Review Request #2836 — Created Jan. 30, 2012 and submitted
Looks like a bug to me. The origin_url.rstrip is already present in the else statement above it. In the if statement the origin_url is not instantiated and error comes up. There is also a possibility of getting empty upstream_branch (i.e. == '') but I am not sure how to fix it properly. The fix comes from my problems with posting git review when my origin url differs from the one present on the RB server. The following error comes up without this fix: File "/data/Work/Development/rbtools/rbtools/clients/git.py", line 153, in get_repository_info url = origin_url.rstrip('/') UnboundLocalError: local variable 'origin_url' referenced before assignment When fixed, I still get: Failed to execute command: ['git', 'merge-base', '', 'refs/heads/git-repo-url-fix'] fatal: Not a valid object name which indicates that upstream_branch is equal to '' (3rd element of the list)... Not sure if there's another bug or my git config is incorrect. My git config is as follows: [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = http://github.com/reviewboard/rbtools.git #url = git://github.com/reviewboard/rbtools.git # <- wont work for me (behind evil proxy) [branch "master"] remote = origin merge = refs/heads/master
Not tested.