Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork941
Closed
Description
Based on thedocs forcreate_submodule
, it sounds like it proceeds throughSubmodule.add
. According to thedocs forSubmodule.add
, it sounds likeadd
should still work fine if the submodule already exists. However that does not appear to be the case. Have included an example of the issue experienced below along with details about how to create an environment where this issue can be reproduced.
Example:
In [1]:importosIn [2]:importgitIn [3]:r=git.Repo.clone_from("https://github.com/conda-forge/feedstocks","feedstocks")In [4]:r.create_submodule(name="addict",path=os.path.join("feedstocks","addict"),url="https://github.com/conda-forge/addict-feedstock",branch="master")Out[4]:---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)/zopt/conda2/envs/test/lib/python3.6/site-packages/IPython/core/formatters.pyin__call__(self,obj)700type_pprinters=self.type_printers,701deferred_pprinters=self.deferred_printers)-->702printer.pretty(obj)703printer.flush()704returnstream.getvalue()/zopt/conda2/envs/test/lib/python3.6/site-packages/IPython/lib/pretty.pyinpretty(self,obj)393ifcallable(meth):394returnmeth(obj,self,cycle)-->395return_default_pprint(obj,self,cycle)396finally:397self.end_group()/zopt/conda2/envs/test/lib/python3.6/site-packages/IPython/lib/pretty.pyin_default_pprint(obj,p,cycle)508if_safe_getattr(klass,'__repr__',None)isnotobject.__repr__:509# A user-provided repr. Find newlines and replace them with p.break_()-->510_repr_pprint(obj,p,cycle)511return512p.begin_group(1,'<')/zopt/conda2/envs/test/lib/python3.6/site-packages/IPython/lib/pretty.pyin_repr_pprint(obj,p,cycle)699"""A pprint that just redirects to the normal repr function."""700# Find newlines and replace them with p.break_()-->701output=repr(obj)702foridx,output_lineinenumerate(output.splitlines()):703ifidx:/zopt/conda2/envs/test/lib/python3.6/site-packages/git/objects/submodule/base.pyin__repr__(self)170def__repr__(self):171return"git.%s(name=%s, path=%s, url=%s, branch_path=%s)"\-->172% (type(self).__name__,self._name,self.path,self.url,self.branch_path)173174 @classmethod/zopt/conda2/envs/test/lib/python3.6/site-packages/gitdb/util.pyin__getattr__(self,attr)254tobecreatedandset.Nexttimethesameattributeisreqeusted,itissimply255returnedfromourdict/slots. """--> 256 self._set_cache_(attr) 257 # will raise in case the cache was not created 258 return object.__getattribute__(self, attr)/zopt/conda2/envs/test/lib/python3.6/site-packages/git/objects/submodule/base.py in _set_cache_(self, attr) 133 self._branch_path = reader.get_value(self.k_head_option, git.Head.to_full_path(self.k_head_default)) 134 elif attr == '_name':--> 135 raise AttributeError("Cannot retrieve the name of a submodule if it was not set initially") 136 else: 137 super(Submodule, self)._set_cache_(attr)AttributeError: Cannot retrieve the name of a submodule if it was not set initially
Environment (withconda
):
# environment.yamlname:testchannels:-nanshe-conda-forge-defaultsdependencies:-appnope=0.1.0=py36_0-ca-certificates=2017.7.27.1=0-certifi=2017.7.27.1=py36_0-decorator=4.1.2=py36_0-gitdb2=2.0.2=py36_0-gitpython=2.1.5=py36_0-ipython=6.2.1=py36_0-ipython_genutils=0.2.0=py36_0-jedi=0.10.2=py36_0-ncurses=5.9=10-openssl=1.0.2l=0-pexpect=4.2.1=py36_0-pickleshare=0.7.4=py36_0-pip=9.0.1=py36_0-prompt_toolkit=1.0.15=py36_0-ptyprocess=0.5.2=py36_0-pygments=2.2.0=py36_0-python=3.6.2=0-readline=6.2=0-setuptools=36.3.0=py36_0-simplegeneric=0.8.1=py36_0-six=1.11.0=py36_1-smmap2=2.0.3=py36_0-sqlite=3.13.0=1-tk=8.5.19=2-traitlets=4.3.2=py36_0-wcwidth=0.1.7=py36_0-wheel=0.30.0=py_1-xz=5.2.3=0-zlib=1.2.11=0
FWIW relevant entry in.gitmodules
:
...[submodule "addict"]path = feedstocks/addicturl = https://github.com/conda-forge/addict-feedstock.git...
Metadata
Metadata
Assignees
Labels
No labels