Skip to content
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

Passing CloneOptions #127

Closed
cazgp opened this issue Jan 10, 2014 · 17 comments
Closed

Passing CloneOptions #127

cazgp opened this issue Jan 10, 2014 · 17 comments

Comments

@cazgp
Copy link

cazgp commented Jan 10, 2014

I tried using a javascript object, and various combinations of arrays and strings.

I then tried instantiating git.CloneOptions, but it was complaining about needing git_clone_options. There appears to be a libgit2 macro GIT_CLONE_OPTIONS_INIT but I've no idea how to call it.

Any help / pointers would be great, thank you.

@Glavin001
Copy link

+1, I would also like some more documentation on what CloneOptions is. Thanks!

Update:
I just found: http://libgit2.github.com/libgit2/#HEAD/type/git_clone_options

@scottnath
Copy link

Do you have a use example from your update @Glavin001 ?

I found this page too with seemingly more options:
http://libgit2.github.com/libgit2/#v0.18.0/type/git_clone_options
but I don't know how to implement.

This did nothing:

  git.Repo.clone("https://github.com/nodegit/nodegit.git", path, (remote_name='test'), function(error, repo) {...

thanks,
Scott

@Glavin001
Copy link

Do you have a use example from your update @Glavin001 ?

I did not end up trying it, unfortunately. You can see my basic usage here: https://github.com/Coders-Classroom/Coders-Classroom/blob/master/server/index.js#L80

This did nothing:
git.Repo.clone("https://github.com/nodegit/nodegit.git", path, (remote_name='test'), function(error, repo) {...

That's how I would suppose the usage would work.

Although, I don't follow your syntax for the object (typo?):

(remote_name='test')

Maybe try it with an exist branch (see https://github.com/nodegit/nodegit/branches ) such as gh-pages.

git.Repo.clone("https://github.com/nodegit/nodegit.git", path, { remote_name: 'gh-pages' }, function(error, repo) {
// ...
}

I am unable to try right now but I'll try and take a look later tonight.

@scottnath
Copy link

Thanks for getting back to me!

Tried an object in there, got this error when trying to run it:

Assertion failed: (handle->InternalFieldCount() > 0), function Unwrap, file /Users/person/.node-gyp/0.10.22/src/node_object_wrap.h, line 61.
Abort trap: 6

when it's an array, no error, but nothing changes. Using gh-pages had no effect either.

thanks,
Scott

@mccormicka
Copy link

I also can not get this to work. I am trying to pass checkout_branch as an argument.

git.Repo.clone('url', path, {checkout_branch:'name'}, callback);

@mccormicka
Copy link

If I add the clone_options.cc file to the binding.gyp and build using npm install file then I can create a new CloneOptions() object.
However it seems that on line 42 it is calling a method ->IsExternal() which is then throwing the error stated above by @cazcazn Error: git_clone_options is required. Is there a way to print out the contents of args in this file?

@mccormicka
Copy link

ok I have worked out that the clone_options do not need to be included in the gyp file because the repo.cc file checks that the value is an object and then tries to convert it into clone_options for you. So in theory clone('url', path', {'checkout_branch' " 'name' }, callback ); should work and in fact does pass the object to the clone_options.cc file. However the clone_options is unable to convert the object into the format it requires.

@scottnath
Copy link

Thank you for delving into this @mccormicka
Do you think this is an issue with nodegit or libgit2?

@mccormicka
Copy link

Hi @scottnath I think this is an issue with nodegit. It can not convert the javascript object to the correct GitCloneOptions object that nodegit requires. Unfortunately I can not find any good documentation on how to do this and I do not really have the time to get much deeper into the code. It would be great if one of the authors could pitch in on this issue.

@goloroden
Copy link

+1, same issue here.

@jaypozo
Copy link

jaypozo commented Apr 13, 2014

Would like to be able to pass the --mirror option to clone. +1 for getting this to work.

@xogeny
Copy link

xogeny commented Apr 28, 2014

I was impressed by the richness of the nodegit API, but almost immediately ran into the limitation that I need to work with something besides HEAD. Given how long this issue has been here and the fact that I don't see any developer comments, I'm somewhat pessimistic.

+1

@webjay
Copy link

webjay commented May 14, 2014

+1 for mirror

@tbranyen
Copy link
Member

tbranyen commented Jul 3, 2014

Will be available once #187 lands.

@tbranyen
Copy link
Member

We're working on this right now and should land sometime next week. #187 wasn't sufficient unfortunately. #195 will have the CloneMethods struct exposed and usable.

@tbranyen tbranyen mentioned this issue Oct 11, 2014
@johnhaley81
Copy link
Collaborator

This should be fixed on master now.

@danielbeeke
Copy link

            Git.Clone(commit.repo, builder.getSourcePath(commit), { checkoutBranch: commit.branch })

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

No branches or pull requests