Skip to content

subgit created repo causes GitPython to assert #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
barry-scott opened this issue Jun 25, 2016 · 1 comment
Closed

subgit created repo causes GitPython to assert #480

barry-scott opened this issue Jun 25, 2016 · 1 comment
Labels

Comments

@barry-scott
Copy link
Contributor

barry-scott commented Jun 25, 2016

I get this assert:

File "/home/barry/wc/git/scm-workbench/Source/Git/wb_git_project.py", line 217, in canPush
for ref in remote.refs:
File "/home/barry/wc/git/scm-workbench/Source/Git/git/remote.py", line 463, in refs
assert out_refs, "Remote %s did not have any references" % self.name
AssertionError: Remote origin did not have any references

But git remote -v is happy:

$ git remote -v
origin https://github.com/barry-scott/BarrysEmacs.git (fetch)
origin https://github.com/barry-scott/BarrysEmacs.git (push)

It seems that subgit used the .git/.config file to setup the remote. Here is the .git/config

cat config 
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        autocrlf = false
        eol = lf
        symlinks = true
[remote "origin"]
        url = https://github.com/barry-scott/BarrysEmacs.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[gc]
        autodetach = false
        auto = 0

It seems that GitPython should be looking in config as well to find remote info but is not.

@Byron Byron added the wont fix label Jun 25, 2016
@Byron
Copy link
Member

Byron commented Jun 25, 2016

The assertion doesn't indicate the remote was not found, but that there are no references to be returned. Maybe it has to be fetched first.

However, I do wonder whether this assertion is truly necessary, as clients could just iterate a possibly empty list without problems.

If you think the assertion is in the way, please submit a PR with it removed.

Please also note that the line number stated here seems to indicate you are using an older version of GitPython, which is not recommended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants