Repository navigation
Closed
Labels
Description
not sure if related to still open #279
I have bunch of freshly added, and then also modified submodules. That leads to following kaboom:
$> pip install --upgrade GitPython
Collecting GitPython
Downloading GitPython-2.1.3-py2.py3-none-any.whl (442kB)
Requirement already up-to-date: gitdb2>=2.0.0 in /home/yoh/proj/datalad/datalad/venv-tests/lib/python2.7/site-packages (from GitPython)
Requirement already up-to-date: smmap2>=2.0.0 in /home/yoh/proj/datalad/datalad/venv-tests/lib/python2.7/site-packages (from gitdb2>=2.0.0->GitPython)
Installing collected packages: GitPython
Found existing installation: GitPython 2.1.0
Uninstalling GitPython-2.1.0:
Successfully uninstalled GitPython-2.1.0
Successfully installed GitPython-2.1.3
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$> python -c 'from git import Repo; print Repo(".").submodules'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/yoh/proj/datalad/datalad/venv-tests/local/lib/python2.7/site-packages/git/repo/base.py", line 290, in submodules
return Submodule.list_items(self)
File "/home/yoh/proj/datalad/datalad/venv-tests/local/lib/python2.7/site-packages/git/util.py", line 932, in list_items
out_list.extend(cls.iter_items(repo, *args, **kwargs))
File "/home/yoh/proj/datalad/datalad/venv-tests/local/lib/python2.7/site-packages/git/objects/submodule/base.py", line 1181, in iter_items
sm = rt[p]
File "/home/yoh/proj/datalad/datalad/venv-tests/local/lib/python2.7/site-packages/git/objects/tree.py", line 293, in __getitem__
info = self._cache[item]
IndexError: list index out of range
$> git submodule
+60d265e09441a6316f7c3336c0eba4370afed2ac 2009 (heads/master)
+5cdff4402dec87be62ae0ba197c63ad1da7ba2c2 2010 (heads/master)
+e5638100b6e4514a6e6e7379a581fb2801b7a59b 2011 (heads/master)
+62bf8ad207a8d70706a3b1288e2aaa6b1efe20ed 2013 (heads/master)
+214a854c94d9d8c5283643a59fb633f46563fbd0 2014 (heads/master)
+a6770f5aa5c8552b3cd803b138e5ae71c281188b 2015 (heads/master)
+4790ba30c6e666c86ec26d78042eb2a82cb043f8 2016 (heads/master)
+bf191a0120bce11be84f3e9a260eb830939fecbc 2017 (heads/master)
$> git diff
diff --git a/2009 b/2009
index b547198..60d265e 160000
--- a/2009
+++ b/2009
@@ -1 +1 @@
-Subproject commit b547198f5c417a88fa3e683c7a73b2ba014b2331
+Subproject commit 60d265e09441a6316f7c3336c0eba4370afed2ac
...
$> head .gitmodules
[submodule "2009"]
path = 2009
url = ./2009
[submodule "2010"]
path = 2010
url = ./2010
[submodule "2011"]
path = 2011
url = ./2011
Failed to replicate with a simplistic
$> rm -rf /tmp/test && mkdir /tmp/test && cd /tmp/test; git init; echo smth > smth; git add smth; git commit -m smth; mkdir sub; cd sub; git init; echo 123 > 123; git add 123; git commit -m added ; cd ../; git submodule add ./sub sub; cd sub; echo 124 >| 123; git add 123; git commit -m changed; cd ..; git submodule; python -c 'from git import Repo; print Repo(".").submodules'
Initialized empty Git repository in /tmp/test/.git/
[master (root-commit) bbfc6e1] smth
1 file changed, 1 insertion(+)
create mode 100644 smth
Initialized empty Git repository in /tmp/test/sub/.git/
[master (root-commit) 6063d92] added
1 file changed, 1 insertion(+)
create mode 100644 123
smth sub/
Adding existing repo at 'sub' to the index
123
[master 4a3e397] changed
1 file changed, 1 insertion(+), 1 deletion(-)
smth sub/
+4a3e397542e87ff842555f8f6c6fdfafffa0c375 sub (heads/master)
[git.Submodule(name=sub, path=sub, url=./sub, branch_path=refs/heads/master)]
changes on filesystem:
sub | 2 +-
cached/staged changes:
.gitmodules | 3 +++
sub | 1 +so I guess I have missed some aspect
Activity
Byron commentedon Apr 9, 2017
Thanks for letting me know. I assume that the original repository that is showing the issue is not public, so we are left with an issue that is not reproducible.
What do you suggest we should do?
yarikoptic commentedon Apr 9, 2017
eh -- took me a while to find that repo where I originally ran into it (again blaming myself for not quoting enough info for myself)... found it -- now you can get the entirety of it in its dirty state from http://www.onerussian.com/tmp/phsyionet-challenge.tar.gz
Byron commentedon Apr 9, 2017
@yarikoptic Thanks for taking the time to look - I pulled the file and was able to easily reproduce the issue. Just to be on the safe side, I put it into a gist.
This is how to reproduce the issue, assuming you have gitpython in your PYTHON_PATH:
yarikoptic commentedon Sep 7, 2017
In datalad/datalad#1801 we ran into our datalad crashing because we used GitPython's parser for .gitmodules and used
get_valuewhich automagically casts values into int and bool whenever it could. We fixed it on our end, but then decided to test more... Now I have managed to reproduce both crashes -- the one we have in that datalad issue (when I use bool value for the name) and this one (when I use numeric), so I guess the reason could be the same "misuse" ofget_value(casts) whenevergetshould have been used (no casting):clean run:
int:
bool: