Skip to content

demands creating the lock file when I need just to get a list of submodules #569

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

Open
yarikoptic opened this issue Jan 5, 2017 · 4 comments

Comments

@yarikoptic
Copy link
Contributor

which obviously fails if I have no write access to that repository. Here it is invoked from within datalad (trimmed the backtrace to the point where we access GitPython's Repo in self.repo)

  File "/home/yoh/proj/datalad/datalad/datalad/support/gitrepo.py", line 1543, in get_submodules
    submodules = self.repo.submodules
  File "/home/yoh/proj/datalad/datalad/venv/dev-gitpython/local/lib/python2.7/site-packages/git/repo/base.py", line 276, in submodules
    return Submodule.list_items(self)
  File "/home/yoh/proj/datalad/datalad/venv/dev-gitpython/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/dev-gitpython/local/lib/python2.7/site-packages/git/objects/submodule/base.py", line 1185, in iter_items
    entry = index.entries[index.entry_key(p, 0)]
  File "/home/yoh/proj/datalad/datalad/venv/dev-gitpython/local/lib/python2.7/site-packages/gitdb/util.py", line 237, in __getattr__
    self._set_cache_(attr)
  File "/home/yoh/proj/datalad/datalad/venv/dev-gitpython/local/lib/python2.7/site-packages/git/index/base.py", line 120, in _set_cache_
    fd = lfd.open(write=False, stream=False)
  File "/home/yoh/proj/datalad/datalad/venv/dev-gitpython/local/lib/python2.7/site-packages/gitdb/util.py", line 314, in open
    raise IOError("Lock at %r could not be obtained" % self._lockfilepath())
IOError: Lock at '/tmp/physionet/.git/index.lock' could not be obtained
()
> /home/yoh/proj/datalad/datalad/venv/dev-gitpython/local/lib/python2.7/site-packages/gitdb/util.py(314)open()
-> raise IOError("Lock at %r could not be obtained" % self._lockfilepath())
(Pdb) import git
(Pdb) git.__version__
'2.1.1'

FWIW regular 'git submodule' command works fine.

@yarikoptic
Copy link
Contributor Author

any ideas on either this one could be reasonably resolved, or this locking is way too deep within GitPython?

@Byron
Copy link
Member

Byron commented Feb 25, 2017

@yarikoptic I believe this can be resolved by making the read-lock optional. Technically it's correct to obtain a lock for reading, just to hold off other writers, yet I believe in most cases, not having a read-lock would not be a problem. If one would only add a special case like: 'ignore the lock if it fails due to a permission error', this should already improve life for those who have no write permissions.
The latter is a valid case, which should certainly be supported.

@yarikoptic
Copy link
Contributor Author

And thank you in advance for that! :-)

@Byron
Copy link
Member

Byron commented Feb 25, 2017

You are welcome :)!
screen shot 2017-02-25 at 16 33 32

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

No branches or pull requests

2 participants