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

clone_repository() function not working #425

Closed
gmpuran opened this Issue Sep 13, 2014 · 5 comments

Comments

Projects
None yet
3 participants
@gmpuran

gmpuran commented Sep 13, 2014

Example given in the docs for clone repository results in empty repository at mentioned path.

from pygit2 import clone_repository
repo_url = 'git://github.com/libgit2/pygit2.git'
repo_path = '/path/to/create/repository'
repo = clone_repository(repo_url, repo_path) # Clones a non-bare repository

Code execution doesn't yield any errors, any clues?

@pypingou

This comment has been minimized.

pypingou commented Sep 13, 2014

Which version are you using?

@gmpuran

This comment has been minimized.

gmpuran commented Sep 13, 2014

Hi pypingou,

pygit2 - v0.21.2
libgit2 - v0.21.0

@carlosmn

This comment has been minimized.

Member

carlosmn commented Sep 13, 2014

It looks to be down to us not overriding the default checkout strategy, which is a no-op.

@carlosmn

This comment has been minimized.

Member

carlosmn commented Sep 13, 2014

Or rather, by not initializing with libgit2's defaults, which makes it checkout by default.

carlosmn added a commit to carlosmn/pygit2 that referenced this issue Sep 13, 2014

Properly initialize the clone options
libgit2 provides an initialization function to set sane defaults. Use
that instead of setting the version by hand, as that's not the only
thing it does.

Using C.git_clone_init_options() sets the checkout strategy to SAFE,
which will checkout the files after the clone, instead of the implicit
NONE which we're setting by hand.

This fixes libgit2#425,
@carlosmn

This comment has been minimized.

Member

carlosmn commented Sep 13, 2014

FTR the repository isn't empty, just its worktree.

carlosmn added a commit to carlosmn/pygit2 that referenced this issue Sep 13, 2014

Properly initialize the clone options
libgit2 provides an initialization function to set sane defaults. Use
that instead of setting the version by hand, as that's not the only
thing it does.

Using C.git_clone_init_options() sets the checkout strategy to SAFE,
which will checkout the files after the clone, instead of the implicit
NONE which we're setting by hand.

This fixes libgit2#425,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment