Skip to content

Add init_submodules and update_submodules interfaces #692

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

Merged
merged 3 commits into from
Mar 22, 2017
Merged

Add init_submodules and update_submodules interfaces #692

merged 3 commits into from
Mar 22, 2017

Conversation

jasedit
Copy link
Contributor

@jasedit jasedit commented Mar 6, 2017

This exposes the ability to initialize and update submodules on a repository, which are useful for accessing files in submodules (or being able to use files in a repository which rely on submodule files.)

@jasedit
Copy link
Contributor Author

jasedit commented Mar 6, 2017

Odd - the unit tests for submodules all work without error for me on my local machine. I'm uncertain why the unit tests are reporting the construction of the git repositories is failing - if there's any insight as to what may be causing those errors, I'm happy to resolve them.

@jasedit
Copy link
Contributor Author

jasedit commented Mar 7, 2017

If I execute the submodule units tests as a standalone unit (e.g. python -m unittest test/test_submodule.py) the unit tests pass without error. However, using the command python setup.py test causes not only several submodule unit tests to fail (on my machine, these fail now fail with the error reading: _pygit2.GitError: unexpected data at the end of the pack), but several other tests suddenly fail, which don't fail on the CI execution.

I've also introduced the flag to allow automatically initializing submodules when executing an update command.

@jdavid
Copy link
Member

jdavid commented Mar 7, 2017

Hi Jason, thanks for contributing.

I don't know about the unexpected data at the end of the pack errors, maybe @carlosmn has a clue.

Could you please handle the Windows errors shown in AppVeyor?

@jasedit
Copy link
Contributor Author

jasedit commented Mar 7, 2017

Compiling under Visual Studio 10 has been fixed - it turns out the C support under Visual Studio 10 requires all variable declarations at the start of the function, which is different than the other compilers (Is Visual Studio 10 using the C89 standard as opposed to the C99 standard?)

@jdavid
Copy link
Member

jdavid commented Mar 7, 2017

Yes, as far as I know VS is stuck with C89.

@jasedit
Copy link
Contributor Author

jasedit commented Mar 8, 2017

Building under Visual Studio 10 works now, though the tests still fail with the mysterious unexpected data error.

@jdavid
Copy link
Member

jdavid commented Mar 16, 2017

I got the same errors locally. So eventually I will look into them, when I find some time.

@jasedit
Copy link
Contributor Author

jasedit commented Mar 16, 2017

I asked in the libgit2 Slack for help to make sure I wasn't making calls in an obviously incorrect fashion, but no one there had any major insights into the issue yet. I'm willing to chase down possible leads, but right now I'm at a bit of a loss.

@jdavid
Copy link
Member

jdavid commented Mar 22, 2017

Please rebase over the master branch, the tests should pass now.

Otherwise, cloning pygit2 from github makes the tests very slow; it would be nice to clone from the local disk instead. Also, since this feature is not performance sensible it is good candidate to be implemented with cffi, maybe you want to try.

@jasedit
Copy link
Contributor Author

jasedit commented Mar 22, 2017

I had initially attempted to use local repositories for submodules, but ran into errors attempting to operate on the relevant submodules. I don't happen to have the relevant errors on hand, since I resolved them by using a remote submodule.

What were the underlying issues that were interacting with this PR? It looks like there were issues related to running tests in sequence and side effects?

I'm not terribly familiar with writing interfaces using cffi - are there any decent tutorials or examples in the repository I can look at? I've spent a bit of time poking around a few files that appear to use it, but it doesn't seem as obvious as I would hope. I can see some of how to access/create C objects through CFFI, but I have no insight on how to implement callback functions.

@jdavid
Copy link
Member

jdavid commented Mar 22, 2017

The test_options changed some pygit2 options that made test_submodules to fail. I fixed it in commit d622e87 (though now there is 1 test in AppVeyor failing, and I don't have Windows to reproduce/fix it)

A number of features in pygit2 are implemented with cffi already. Anyway this is not a requirement for merging.

@jdavid jdavid merged commit 8327e1b into libgit2:master Mar 22, 2017
0-wiz-0 referenced this pull request in NetBSD/pkgsrc-wip Aug 14, 2017
0.26.0 (2017-07-06)
-------------------------

- Update to libgit2 v0.26
  `#713 <https://github.com/libgit2/pygit2/pull/713>`_

- Drop support for Python 3.2, add support for cffi 1.10
  `#706 <https://github.com/libgit2/pygit2/pull/706>`_
  `#694 <https://github.com/libgit2/pygit2/issues/694>`_

- New ``Repository.revert_commit(...)``
  `#711 <https://github.com/libgit2/pygit2/pull/711>`_
  `#710 <https://github.com/libgit2/pygit2/issues/710>`_

- New ``Branch.is_checked_out()``
  `#696 <https://github.com/libgit2/pygit2/pull/696>`_

- Various fixes
  `#706 <https://github.com/libgit2/pygit2/pull/706>`_
  `#707 <https://github.com/libgit2/pygit2/pull/707>`_
  `#708 <https://github.com/libgit2/pygit2/pull/708>`_

0.25.1 (2017-04-25)
-------------------------

- Add suport for Python 3.6

- New support for stash: repository methods ``stash``, ``stash_apply``,
  ``stash_drop`` and ``stash_pop``
  `#695 <https://github.com/libgit2/pygit2/pull/695>`_

- Improved support for submodules: new repository methods ``init_submodules``
  and ``update_submodules``
  `#692 <https://github.com/libgit2/pygit2/pull/692>`_

- New friendlier API for branches & references: ``Repository.branches`` and
  ``Repository.references``
  `#700 <https://github.com/libgit2/pygit2/pull/700>`_
  `#701 <https://github.com/libgit2/pygit2/pull/701>`_

- New support for custom backends
  `#690 <https://github.com/libgit2/pygit2/pull/690>`_

- Fix ``init_repository`` crash on None input
  `#688 <https://github.com/libgit2/pygit2/issues/688>`_
  `#697 <https://github.com/libgit2/pygit2/pull/697>`_

- Fix checkout with an orphan master branch
  `#669 <https://github.com/libgit2/pygit2/issues/669>`_
  `#685 <https://github.com/libgit2/pygit2/pull/685>`_

- Better error messages for opening repositories
  `#645 <https://github.com/libgit2/pygit2/issues/645>`_
  `#698 <https://github.com/libgit2/pygit2/pull/698>`_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants