Skip to content

submodule_update() throws error and does not mimick git behaviour #93

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
bilderbuchi opened this issue Jan 31, 2013 · 5 comments
Closed

Comments

@bilderbuchi
Copy link

Hi!
Say you add a submodule to a repo by doing git submodule update --init, and then do git submodule update --init again to update it, git does not complain and just gives the same output as before.
In gitpython, this gives an error:

repo.submodule_update(init=True)
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-6-86ea9b78455b> in <module>()
----> 1 repo.submodule_update(init=True)

/usr/lib/python2.7/dist-packages/git/repo/base.pyc in submodule_update(self, *args, **kwargs)
    265                 take the previous state into consideration. For more information, please
    266         see the documentation of RootModule.update"""
--> 267                 return RootModule(self).update(*args, **kwargs)
    268 
    269         #}END submodules

/usr/lib/python2.7/dist-packages/git/objects/submodule/root.pyc in update(self, previous_commit, recursive, force_remove, init, to_latest_revision, progress, dry_run)
    293                         # update the submodule using the default method
    294             sm.update(recursive=False, init=init, to_latest_revision=to_latest_revision, 
--> 295                         progress=progress, dry_run=dry_run)
    296 
    297                         # update recursively depth first - question is which inconsitent

/usr/lib/python2.7/dist-packages/git/objects/submodule/base.pyc in update(self, recursive, init, to_latest_revision, progress, dry_run)
    376                                         os.rmdir(module_path)
    377                                 except OSError:
--> 378                                         raise OSError("Module directory at %r does already exist and is non-empty" % module_path)
    379                                 # END handle OSError
    380                         # END handle directory removal

OSError: Module directory at '/home/me/gitpython-test/somesubmodule' does already exist and is non-empty

Of course it exists, but imo gitpython should not error out about it (just like git does not). same happens when omitting the init=True option.
git.__version__: '0.3.2 RC1'

repo.git.submodule('update') works, though. although it does not display the output that git does, at least it doesn't seem to fail.

@Byron Byron added this to the v0.3.5 - bugfixes milestone Nov 19, 2014
@Byron
Copy link
Member

Byron commented Nov 19, 2014

git-pythons submodule implementation will need a proper review, as it has many flaws (by now), not properly implementing gits own submodule handling.

@Byron
Copy link
Member

Byron commented Jan 19, 2015

The test-suite has been adjusted to test for your case specifically.
Fortunately I was unable to reproduce the issue in the upcoming release, which strengthens my impression that the issue was caused by submodules which used .git files (instead of the actual repository).

@Byron
Copy link
Member

Byron commented Jan 19, 2015

The archived live-stream can be found on youtube

@bilderbuchi
Copy link
Author

thanks for fixing the bug! (although I have to admit I haven't used gitpython since the time when I reported the bug)

@Byron
Copy link
Member

Byron commented Jan 19, 2015

There is a time for everything, after all I didn't look at git-python for several years myself. And look who is back now ;).

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