You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
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.
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?
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.
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.
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.
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.
Activity
Glavin001 commentedon Jan 20, 2014
+1, I would also like some more documentation on what
CloneOptionsis. Thanks!Update:
I just found: http://libgit2.github.com/libgit2/#HEAD/type/git_clone_options
scottnath commentedon Feb 18, 2014
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:
thanks,
Scott
Glavin001 commentedon Feb 18, 2014
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
That's how I would suppose the usage would work.
Although, I don't follow your syntax for the object (typo?):
Maybe try it with an exist branch (see https://github.com/nodegit/nodegit/branches ) such as
gh-pages.I am unable to try right now but I'll try and take a look later tonight.
scottnath commentedon Feb 18, 2014
Thanks for getting back to me!
Tried an object in there, got this error when trying to run it:
when it's an array, no error, but nothing changes. Using gh-pages had no effect either.
thanks,
Scott
mccormicka commentedon Feb 24, 2014
I also can not get this to work. I am trying to pass checkout_branch as an argument.
mccormicka commentedon Feb 25, 2014
If I add the clone_options.cc file to the binding.gyp and build using
npm installfile 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 commentedon Feb 27, 2014
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 commentedon Feb 27, 2014
Thank you for delving into this @mccormicka
Do you think this is an issue with nodegit or libgit2?
mccormicka commentedon Feb 27, 2014
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 commentedon Mar 13, 2014
+1, same issue here.
jaypozo commentedon Apr 13, 2014
Would like to be able to pass the --mirror option to clone. +1 for getting this to work.
xogeny commentedon Apr 28, 2014
I was impressed by the richness of the
nodegitAPI, but almost immediately ran into the limitation that I need to work with something besidesHEAD. 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 commentedon May 14, 2014
+1 for mirror
tbranyen commentedon Jul 3, 2014
Will be available once #187 lands.
tbranyen commentedon Oct 11, 2014
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.
johnhaley81 commentedon Oct 23, 2014
This should be fixed on master now.
danielbeeke commentedon Jan 28, 2016